Commit 0b007bc40e911b3ebb99213943a945bd6c87b064
1 parent
ecf81cbe
前置摄像头关闭闪光灯
Showing
3 changed files
with
6 additions
and
8 deletions
config.gradle
lib_media/src/main/java/com/cnlive/media/frame/view/RecordFragmentView.java
| @@ -10,11 +10,8 @@ import android.view.MotionEvent; | @@ -10,11 +10,8 @@ import android.view.MotionEvent; | ||
| 10 | import android.view.View; | 10 | import android.view.View; |
| 11 | import android.view.animation.OvershootInterpolator; | 11 | import android.view.animation.OvershootInterpolator; |
| 12 | 12 | ||
| 13 | -import androidx.activity.OnBackPressedCallback; | ||
| 14 | - | ||
| 15 | import com.cnlive.libs.base.util.AlertUtil; | 13 | import com.cnlive.libs.base.util.AlertUtil; |
| 16 | import com.cnlive.media.PickerConfig; | 14 | import com.cnlive.media.PickerConfig; |
| 17 | -import com.cnlive.media.ui.activity.MediaActivity; | ||
| 18 | import com.cnlive.media.ui.activity.RecordActivity; | 15 | import com.cnlive.media.ui.activity.RecordActivity; |
| 19 | import com.cnlive.media.ui.fragment.RecordFragment; | 16 | import com.cnlive.media.ui.fragment.RecordFragment; |
| 20 | import com.cnlive.media.utils.AndroidQUtil; | 17 | import com.cnlive.media.utils.AndroidQUtil; |
| @@ -71,9 +68,9 @@ public class RecordFragmentView implements MvpView, PLRecordStateListener { | @@ -71,9 +68,9 @@ public class RecordFragmentView implements MvpView, PLRecordStateListener { | ||
| 71 | if (cameraSetting == null) | 68 | if (cameraSetting == null) |
| 72 | cameraSetting = new PLCameraSetting(); | 69 | cameraSetting = new PLCameraSetting(); |
| 73 | //设置摄像头 | 70 | //设置摄像头 |
| 74 | - if (SamsungCamaerUtil.isSamsungAndOpenFont(mFragment.getActivity())){ | 71 | + if (SamsungCamaerUtil.isSamsungAndOpenFont(mFragment.getActivity())) { |
| 75 | cameraSetting.setCameraId(PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_FRONT); | 72 | cameraSetting.setCameraId(PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_FRONT); |
| 76 | - }else { | 73 | + } else { |
| 77 | cameraSetting.setCameraId(chooseCameraFacingId()); | 74 | cameraSetting.setCameraId(chooseCameraFacingId()); |
| 78 | } | 75 | } |
| 79 | 76 | ||
| @@ -163,6 +160,7 @@ public class RecordFragmentView implements MvpView, PLRecordStateListener { | @@ -163,6 +160,7 @@ public class RecordFragmentView implements MvpView, PLRecordStateListener { | ||
| 163 | } else if (PLCameraSetting.hasCameraFacing(PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_BACK)) { | 160 | } else if (PLCameraSetting.hasCameraFacing(PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_BACK)) { |
| 164 | return PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_BACK; | 161 | return PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_BACK; |
| 165 | } else { | 162 | } else { |
| 163 | + processFlash(false); | ||
| 166 | return PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_FRONT; | 164 | return PLCameraSetting.CAMERA_FACING_ID.CAMERA_FACING_FRONT; |
| 167 | } | 165 | } |
| 168 | } | 166 | } |
lib_media/src/main/java/com/cnlive/media/ui/fragment/RecordFragment.java
| @@ -17,7 +17,6 @@ import androidx.core.app.ActivityCompat; | @@ -17,7 +17,6 @@ import androidx.core.app.ActivityCompat; | ||
| 17 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 17 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 18 | import com.cnlive.libs.base.util.DoublePressed; | 18 | import com.cnlive.libs.base.util.DoublePressed; |
| 19 | import com.cnlive.libs.util.Config; | 19 | import com.cnlive.libs.util.Config; |
| 20 | -import com.cnlive.media.PickerConfig; | ||
| 21 | import com.cnlive.media.R; | 20 | import com.cnlive.media.R; |
| 22 | import com.cnlive.media.databinding.FragmentRecordBinding; | 21 | import com.cnlive.media.databinding.FragmentRecordBinding; |
| 23 | import com.cnlive.media.frame.presenter.RecordFragmentPresenter; | 22 | import com.cnlive.media.frame.presenter.RecordFragmentPresenter; |
| @@ -134,7 +133,7 @@ public class RecordFragment extends MvpBindingFragment<RecordFragmentView, Recor | @@ -134,7 +133,7 @@ public class RecordFragment extends MvpBindingFragment<RecordFragmentView, Recor | ||
| 134 | if (plShortVideoRecorder != null) { | 133 | if (plShortVideoRecorder != null) { |
| 135 | binding.rcControl.resetRecord(); | 134 | binding.rcControl.resetRecord(); |
| 136 | plShortVideoRecorder.pause(); | 135 | plShortVideoRecorder.pause(); |
| 137 | - isFlash=false; | 136 | + isFlash = false; |
| 138 | getMvpView().processFlash(isFlash); | 137 | getMvpView().processFlash(isFlash); |
| 139 | } | 138 | } |
| 140 | } | 139 | } |
| @@ -180,6 +179,7 @@ public class RecordFragment extends MvpBindingFragment<RecordFragmentView, Recor | @@ -180,6 +179,7 @@ public class RecordFragment extends MvpBindingFragment<RecordFragmentView, Recor | ||
| 180 | } else { | 179 | } else { |
| 181 | if (DoublePressed.onDoublePressed()) return; | 180 | if (DoublePressed.onDoublePressed()) return; |
| 182 | plShortVideoRecorder.switchCamera(); | 181 | plShortVideoRecorder.switchCamera(); |
| 182 | + getMvpView().processFlash(false); | ||
| 183 | } | 183 | } |
| 184 | } else if (state == RecordCameraViewObservable.CLICK_FINISH) { | 184 | } else if (state == RecordCameraViewObservable.CLICK_FINISH) { |
| 185 | requireActivity().getOnBackPressedDispatcher().onBackPressed(); | 185 | requireActivity().getOnBackPressedDispatcher().onBackPressed(); |