From d75dba401db4f21957bbcd3c50e523c3567ab40a Mon Sep 17 00:00:00 2001 From: Anton Chekulaev Date: Fri, 18 Sep 2020 13:33:35 +1000 Subject: [PATCH] Camera fragment close button. --- res/layout/camera_fragment.xml | 18 ++++++++++++++++++ .../securesms/mediasend/Camera1Fragment.java | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/res/layout/camera_fragment.xml b/res/layout/camera_fragment.xml index 3ce5bbe7d0..ccddcb26e3 100644 --- a/res/layout/camera_fragment.xml +++ b/res/layout/camera_fragment.xml @@ -16,4 +16,22 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> + + + + + + \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/mediasend/Camera1Fragment.java b/src/org/thoughtcrime/securesms/mediasend/Camera1Fragment.java index df51dba9f4..42285049df 100644 --- a/src/org/thoughtcrime/securesms/mediasend/Camera1Fragment.java +++ b/src/org/thoughtcrime/securesms/mediasend/Camera1Fragment.java @@ -27,6 +27,7 @@ import android.view.animation.DecelerateInterpolator; import android.view.animation.RotateAnimation; import android.widget.Button; import android.widget.ImageButton; +import android.widget.ImageView; import com.bumptech.glide.load.MultiTransformation; import com.bumptech.glide.load.Transformation; @@ -51,6 +52,7 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText private TextureView cameraPreview; private ViewGroup controlsContainer; + private View cameraCloseButton; private ImageButton flipButton; private Button captureButton; private Camera1Controller camera; @@ -95,6 +97,7 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText cameraPreview = view.findViewById(R.id.camera_preview); controlsContainer = view.findViewById(R.id.camera_controls_container); + cameraCloseButton = view.findViewById(R.id.camera_close_button); onOrientationChanged(getResources().getConfiguration().orientation); @@ -102,6 +105,8 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText GestureDetector gestureDetector = new GestureDetector(flipGestureListener); cameraPreview.setOnTouchListener((v, event) -> gestureDetector.onTouchEvent(event)); + + cameraCloseButton.setOnClickListener(v -> requireActivity().onBackPressed()); } @Override