Camera fragment close button.

This commit is contained in:
Anton Chekulaev 2020-09-18 13:33:35 +10:00
parent c2299beaf6
commit d75dba401d
2 changed files with 23 additions and 0 deletions

View File

@ -16,4 +16,22 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/camera_close_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/small_spacing"
android:padding="@dimen/small_spacing"
android:background="@drawable/circle_touch_highlight_background"
android:clickable="true"
android:focusable="true">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/ic_baseline_clear_24"
android:tint="@android:color/white"/>
</FrameLayout>
</FrameLayout> </FrameLayout>

View File

@ -27,6 +27,7 @@ import android.view.animation.DecelerateInterpolator;
import android.view.animation.RotateAnimation; import android.view.animation.RotateAnimation;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView;
import com.bumptech.glide.load.MultiTransformation; import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.Transformation; import com.bumptech.glide.load.Transformation;
@ -51,6 +52,7 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
private TextureView cameraPreview; private TextureView cameraPreview;
private ViewGroup controlsContainer; private ViewGroup controlsContainer;
private View cameraCloseButton;
private ImageButton flipButton; private ImageButton flipButton;
private Button captureButton; private Button captureButton;
private Camera1Controller camera; private Camera1Controller camera;
@ -95,6 +97,7 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
cameraPreview = view.findViewById(R.id.camera_preview); cameraPreview = view.findViewById(R.id.camera_preview);
controlsContainer = view.findViewById(R.id.camera_controls_container); controlsContainer = view.findViewById(R.id.camera_controls_container);
cameraCloseButton = view.findViewById(R.id.camera_close_button);
onOrientationChanged(getResources().getConfiguration().orientation); onOrientationChanged(getResources().getConfiguration().orientation);
@ -102,6 +105,8 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
GestureDetector gestureDetector = new GestureDetector(flipGestureListener); GestureDetector gestureDetector = new GestureDetector(flipGestureListener);
cameraPreview.setOnTouchListener((v, event) -> gestureDetector.onTouchEvent(event)); cameraPreview.setOnTouchListener((v, event) -> gestureDetector.onTouchEvent(event));
cameraCloseButton.setOnClickListener(v -> requireActivity().onBackPressed());
} }
@Override @Override