diff --git a/app/src/main/java/net/sourceforge/opencamera/MainActivity.java b/app/src/main/java/net/sourceforge/opencamera/MainActivity.java
index 2d612a3f7203daa7a32109385c5a9a274b9c5c6f..eae8cc0468d095eba9427e7c73712615d030f29a 100644
--- a/app/src/main/java/net/sourceforge/opencamera/MainActivity.java
+++ b/app/src/main/java/net/sourceforge/opencamera/MainActivity.java
@@ -395,6 +395,8 @@ public class MainActivity extends Activity {
takePhotoVideoButton.setVisibility(View.GONE);
View cancelPanoramaButton = findViewById(R.id.cancel_panorama);
cancelPanoramaButton.setVisibility(View.GONE);
+ View finishPanoramaButton = findViewById(R.id.finish_panorama);
+ finishPanoramaButton.setVisibility(View.GONE);
// We initialise optional controls to invisible/gone, so they don't show while the camera is opening - the actual visibility is
// set in cameraSetup().
@@ -1430,6 +1432,13 @@ public class MainActivity extends Activity {
applicationInterface.stopPanorama(true);
}
+ public void clickedFinishPanorama(View view) {
+ if (MyDebug.LOG) {
+ Log.d(TAG, "clickedFinishPanorama");
+ }
+ this.takePicture(false);
+ }
+
public void clickedCycleRaw(View view) {
if( MyDebug.LOG )
Log.d(TAG, "clickedCycleRaw");
@@ -3404,10 +3413,12 @@ public class MainActivity extends Activity {
/** Listens for the response from the Storage Access Framework dialog to select a folder
* (as opened with openFolderChooserDialogSAF()).
*/
+ @SuppressLint("WrongConstant")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void onActivityResult(int requestCode, int resultCode, Intent resultData) {
- if( MyDebug.LOG )
+ if (MyDebug.LOG) {
Log.d(TAG, "onActivityResult: " + requestCode);
+ }
switch( requestCode ) {
case CHOOSE_SAVE_FOLDER_SAF_CODE:
if( resultCode == RESULT_OK && resultData != null ) {
diff --git a/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java b/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java
index d52ed93309e7c82bd35ce6038b9e762dfd46826c..4e1a180da3579cea88139974e77483855484770c 100644
--- a/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java
+++ b/app/src/main/java/net/sourceforge/opencamera/MyApplicationInterface.java
@@ -1720,9 +1720,7 @@ public class MyApplicationInterface extends BasicApplicationInterface {
panorama_pic_accepted = false;
panorama_dir_left_to_right = true;
- main_activity.getMainUI().setTakePhotoIcon();
- View cancelPanoramaButton = main_activity.findViewById(R.id.cancel_panorama);
- cancelPanoramaButton.setVisibility(View.VISIBLE);
+ main_activity.getMainUI().handlePanoromaModeButtonsVisibility();
main_activity.getMainUI().closeExposureUI(); // close seekbars if open (popup is already closed when taking a photo)
// taking the photo will end up calling MainUI.showGUI(), which will hide the other on-screen icons
}
@@ -1758,9 +1756,7 @@ public class MyApplicationInterface extends BasicApplicationInterface {
if( is_cancelled ) {
imageSaver.flushImageBatch();
}
- main_activity.getMainUI().setTakePhotoIcon();
- View cancelPanoramaButton = main_activity.findViewById(R.id.cancel_panorama);
- cancelPanoramaButton.setVisibility(View.GONE);
+ main_activity.getMainUI().handlePanoromaModeButtonsVisibility();
main_activity.getMainUI().showGUI(); // refresh UI icons now that we've stopped panorama
}
diff --git a/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java b/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java
index d34ce58b0dfddbdee8b2a59d79fc96c564899a68..cbee3a3c4024e7a15b192dfaa6e22fa71c90e98b 100644
--- a/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java
+++ b/app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java
@@ -458,6 +458,9 @@ public class MainUI {
view = main_activity.findViewById(R.id.cancel_panorama);
setViewRotation(view, ui_rotation);
+ view = main_activity.findViewById(R.id.finish_panorama);
+ setViewRotation(view, ui_rotation);
+
view = main_activity.findViewById(R.id.switch_video);
setViewRotation(view, ui_rotation);
@@ -755,13 +758,6 @@ public class MainUI {
: R.drawable.ic_camera_video;
content_description = main_activity.getPreview().isVideoRecording() ? R.string.stop_video : R.string.start_video;
switch_video_content_description = R.string.switch_to_photo;
- } else if (main_activity.getApplicationInterface().getPhotoMode() == MyApplicationInterface.PhotoMode.Panorama &&
- main_activity.getApplicationInterface().getGyroSensor().isRecording()) {
- if (MyDebug.LOG)
- Log.d(TAG, "set icon to recording panorama");
- resource = R.drawable.ic_done;
- content_description = R.string.finish_panorama;
- switch_video_content_description = R.string.switch_to_video;
} else {
if (MyDebug.LOG)
Log.d(TAG, "set icon to photo");
@@ -781,6 +777,33 @@ public class MainUI {
}
}
+ /**
+ * Show/hide photoShutter, panorama cancel & finish buttons on photoMode.
+ * If user save not to show photoShutter button, don't show photoShutter & panorama finish buttons.
+ * If user wants to view the shutter button, update the shutterButton's icon to the appropriate one.
+ */
+ public void handlePanoromaModeButtonsVisibility() {
+ boolean isPanoramaRunning = (main_activity.getApplicationInterface().getPhotoMode() == MyApplicationInterface.PhotoMode.Panorama &&
+ main_activity.getApplicationInterface().getGyroSensor().isRecording());
+
+ View view = main_activity.findViewById(R.id.cancel_panorama);
+ view.setVisibility(isPanoramaRunning ? View.VISIBLE : View.GONE);
+
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(main_activity);
+ if (!sharedPreferences.getBoolean(PreferenceKeys.ShowTakePhotoPreferenceKey, true)) {
+ return;
+ }
+
+ view = main_activity.findViewById(R.id.finish_panorama);
+ view.setVisibility(isPanoramaRunning ? View.VISIBLE : View.GONE);
+
+ view = main_activity.findViewById(R.id.take_photo);
+ view.setVisibility(isPanoramaRunning ? View.INVISIBLE : View.VISIBLE);
+ if (!isPanoramaRunning) {
+ setTakePhotoIcon();
+ }
+ }
+
/**
* Set content description for switch camera button.
*/
@@ -1035,21 +1058,31 @@ public class MainUI {
}
String pref_immersive_mode = sharedPreferences.getString(PreferenceKeys.ImmersiveModePreferenceKey, "immersive_mode_low_profile");
if (pref_immersive_mode.equals("immersive_mode_everything")) {
- if (sharedPreferences.getBoolean(PreferenceKeys.ShowTakePhotoPreferenceKey, true)) {
+ final boolean showTakePhotoPreferenceKey = sharedPreferences.getBoolean(PreferenceKeys.ShowTakePhotoPreferenceKey, true);
+
+ if (showTakePhotoPreferenceKey) {
View takePhotoButton = main_activity.findViewById(R.id.take_photo);
takePhotoButton.setVisibility(visibility);
}
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && main_activity.getPreview().isVideoRecording()) {
View pauseVideoButton = main_activity.findViewById(R.id.pause_video);
pauseVideoButton.setVisibility(visibility);
}
+
if (main_activity.getPreview().supportsPhotoVideoRecording() && main_activity.getApplicationInterface().usePhotoVideoRecording() && main_activity.getPreview().isVideoRecording()) {
View takePhotoVideoButton = main_activity.findViewById(R.id.take_photo_when_video_recording);
takePhotoVideoButton.setVisibility(visibility);
}
+
if (main_activity.getApplicationInterface().getGyroSensor().isRecording()) {
View cancelPanoramaButton = main_activity.findViewById(R.id.cancel_panorama);
cancelPanoramaButton.setVisibility(visibility);
+
+ if (showTakePhotoPreferenceKey) {
+ View finishPanoramaButton = main_activity.findViewById(R.id.finish_panorama);
+ finishPanoramaButton.setVisibility(visibility);
+ }
}
}
if (!immersive_mode) {
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 092274048dbdfa99cbd8e2342313cbad92b1ae72..24b654ffd01f429531b1c59829c3aca4daba4bd1 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -28,7 +28,21 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:clickable="false"
- android:focusable="false"/>
+ android:focusable="false"
+ android:visibility="invisible"/>
+
+
+
+
0dp
70dp
36dp
+ 48dp
195dp