diff --git a/CameraFilter/src/main/java/com/frank/camerafilter/widget/BeautyCameraView.java b/CameraFilter/src/main/java/com/frank/camerafilter/widget/BeautyCameraView.java
index e7d1181..a3a4add 100644
--- a/CameraFilter/src/main/java/com/frank/camerafilter/widget/BeautyCameraView.java
+++ b/CameraFilter/src/main/java/com/frank/camerafilter/widget/BeautyCameraView.java
@@ -40,11 +40,21 @@ public class BeautyCameraView extends GLSurfaceView {
}
public void setFilter(BeautyFilterType type) {
+ if (mCameraRender == null)
+ return;
mCameraRender.setFilter(type);
}
public void setRecording(boolean isRecording) {
+ if (mCameraRender == null)
+ return;
mCameraRender.setRecording(isRecording);
}
+ public boolean isRecording() {
+ if (mCameraRender == null)
+ return false;
+ return mCameraRender.isRecording();
+ }
+
}
diff --git a/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java b/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java
index 464c588..9b989a4 100644
--- a/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java
+++ b/CameraFilter/src/main/java/com/frank/camerafilter/widget/CameraRender.java
@@ -216,6 +216,10 @@ public class CameraRender implements GLSurfaceView.Renderer, SurfaceTexture.OnFr
recordEnable = isRecording;
}
+ public boolean isRecording() {
+ return recordEnable;
+ }
+
public void setFilter(final BeautyFilterType type) {
mCameraView.queueEvent(new Runnable() {
@Override
diff --git a/app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt
index ae5bfb3..0cdb44b 100644
--- a/app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt
+++ b/app/src/main/java/com/frank/ffmpeg/activity/CameraFilterActivity.kt
@@ -1,10 +1,8 @@
package com.frank.ffmpeg.activity
import android.os.Bundle
-import android.view.SurfaceView
import android.view.View
import com.frank.camerafilter.widget.BeautyCameraView
-import com.frank.ffmpeg.FFMediaPlayer
import com.frank.ffmpeg.R
class CameraFilterActivity : BaseActivity() {
@@ -22,10 +20,22 @@ class CameraFilterActivity : BaseActivity() {
fun initView() {
cameraView = getView(R.id.surface_camera_filter)
+ initViewsWithClick(R.id.btn_video_recorder)
+ initViewsWithClick(R.id.btn_camera_filter)
}
override fun onViewClick(view: View) {
-
+ if (view.id == R.id.btn_video_recorder) {
+ val isRecording = cameraView!!.isRecording
+ cameraView!!.isRecording = !isRecording
+ if (!isRecording) {
+ showToast("start recording...")
+ } else {
+ showToast("stop recording...")
+ }
+ } else if (view.id == R.id.btn_camera_filter) {
+
+ }
}
override fun onSelectedFile(filePath: String) {
diff --git a/app/src/main/res/drawable-xhdpi/ic_camera_filter.png b/app/src/main/res/drawable-xhdpi/ic_camera_filter.png
new file mode 100644
index 0000000..b14d201
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_camera_filter.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_video_record.png b/app/src/main/res/drawable-xhdpi/ic_video_record.png
new file mode 100644
index 0000000..fec7e59
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_video_record.png differ
diff --git a/app/src/main/res/layout/activity_camera_filter.xml b/app/src/main/res/layout/activity_camera_filter.xml
index 63e112e..dc72267 100644
--- a/app/src/main/res/layout/activity_camera_filter.xml
+++ b/app/src/main/res/layout/activity_camera_filter.xml
@@ -4,8 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.CameraFilterActivity"
- android:layout_marginTop="66dp"
- android:layout_marginBottom="66dp">
+ android:layout_marginTop="30dp"
+ android:layout_marginBottom="30dp">
+
+
+
+
+
+
+
+
\ No newline at end of file