Loading app/src/androidTest/java/net/sourceforge/opencamera/test/MainActivityTest.java +0 −119 Original line number Diff line number Diff line Loading @@ -8184,125 +8184,6 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv } } /* Tests against a bug where popup wouldn't show with left UI placement, due to 0 popup view height. */ public void testPopupLeftLayout() { Log.d(TAG, "testPopupLeftLayout"); setToDefault(); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity); SharedPreferences.Editor editor = settings.edit(); editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_left"); editor.apply(); updateForSettings(); View popup_view = mActivity.findViewById(net.sourceforge.opencamera.R.id.popup_container); View popupButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.popup); assertFalse(mActivity.popupIsOpen()); clickView(popupButton); while( !mActivity.popupIsOpen() ) { } int popup_width = popup_view.getWidth(); int popup_height = popup_view.getHeight(); int test_popup_width = mActivity.getMainUI().test_saved_popup_width; int test_popup_height = mActivity.getMainUI().test_saved_popup_height; Log.d(TAG, "popup_width: " + popup_width); Log.d(TAG, "popup_height: " + popup_height); Log.d(TAG, "test_popup_width: " + test_popup_width); Log.d(TAG, "test_popup_height: " + test_popup_height); assertTrue(popup_width > 0); assertTrue(popup_height > 0); assertEquals(popup_width, test_popup_width); assertEquals(popup_height, test_popup_height); // now reopen popup view, and check the same dimensions clickView(popupButton); while( mActivity.popupIsOpen() ) { } clickView(popupButton); while( !mActivity.popupIsOpen() ) { } int new_popup_width = popup_view.getWidth(); int new_popup_height = popup_view.getHeight(); test_popup_width = mActivity.getMainUI().test_saved_popup_width; test_popup_height = mActivity.getMainUI().test_saved_popup_height; Log.d(TAG, "new_popup_width: " + new_popup_width); Log.d(TAG, "new_popup_height: " + new_popup_height); Log.d(TAG, "test_popup_width: " + test_popup_width); Log.d(TAG, "test_popup_height: " + test_popup_height); assertEquals(popup_width, new_popup_width); assertEquals(popup_height, new_popup_height); assertEquals(popup_width, test_popup_width); assertEquals(popup_height, test_popup_height); } /* Tests with ui_right vs ui_top layout. */ public void testRightLayout() { Log.d(TAG, "testRightLayout"); setToDefault(); { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity); SharedPreferences.Editor editor = settings.edit(); editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_right"); editor.apply(); updateForSettings(); } View popupButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.popup); assertFalse(mActivity.popupIsOpen()); clickView(popupButton); while( !mActivity.popupIsOpen() ) { } Point display_size = new Point(); { Display display = mActivity.getWindowManager().getDefaultDisplay(); display.getSize(display_size); Log.d(TAG, "display_size: " + display_size.x + " x " + display_size.y); } View settingsButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.settings); View galleryButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.gallery); Log.d(TAG, "settings right: " + settingsButton.getRight()); Log.d(TAG, "settings top: " + settingsButton.getTop()); Log.d(TAG, "gallery right: " + galleryButton.getRight()); Log.d(TAG, "gallery top: " + galleryButton.getTop()); assertTrue(settingsButton.getRight() > (int)(0.8*display_size.x)); assertEquals(0, settingsButton.getTop()); assertEquals(display_size.x, galleryButton.getRight()); assertEquals(0, galleryButton.getTop()); { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity); SharedPreferences.Editor editor = settings.edit(); editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_top"); editor.apply(); updateForSettings(); } Log.d(TAG, "settings right: " + settingsButton.getRight()); Log.d(TAG, "settings top: " + settingsButton.getTop()); Log.d(TAG, "gallery right: " + galleryButton.getRight()); Log.d(TAG, "gallery top: " + galleryButton.getTop()); assertTrue(settingsButton.getRight() < (int)(0.2*display_size.x)); assertEquals(0, settingsButton.getTop()); assertEquals(display_size.x, galleryButton.getRight()); assertEquals(0, galleryButton.getTop()); assertFalse(mActivity.popupIsOpen()); clickView(popupButton); while( !mActivity.popupIsOpen() ) { } } /* Tests layout bug with popup menu. * Note, in practice this doesn't seem to reproduce the problem, but keep the test anyway. * Currently not autotested as the problem isn't fixed, and this would just be a test that Loading app/src/main/java/net/sourceforge/opencamera/PreferenceKeys.java +0 −2 Original line number Diff line number Diff line Loading @@ -174,8 +174,6 @@ public class PreferenceKeys { public static final String Camera2PhotoVideoRecordingPreferenceKey = "preference_camera2_photo_video_recording"; public static final String UIPlacementPreferenceKey = "preference_ui_placement"; public static final String TouchCapturePreferenceKey = "preference_touch_capture"; public static final String PausePreviewPreferenceKey = "preference_pause_preview"; Loading app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java +1 −10 Original line number Diff line number Diff line Loading @@ -168,16 +168,7 @@ public class MainUI { } private UIPlacement computeUIPlacement() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(main_activity); String ui_placement_string = sharedPreferences.getString(PreferenceKeys.UIPlacementPreferenceKey, "ui_top"); switch (ui_placement_string) { case "ui_left": return UIPlacement.UIPLACEMENT_LEFT; case "ui_top": return UIPlacement.UIPLACEMENT_TOP; default: return UIPlacement.UIPLACEMENT_RIGHT; } } private void layoutUI(boolean popup_container_only) { Loading app/src/main/res/xml/preferences.xml +0 −9 Original line number Diff line number Diff line Loading @@ -563,15 +563,6 @@ android:icon="@drawable/ic_more_horiz_white_48dp" android:persistent="false"> <ListPreference android:key="preference_ui_placement" android:title="@string/preference_ui_placement" android:summary="%s" android:entries="@array/preference_ui_placement_entries" android:entryValues="@array/preference_ui_placement_values" android:defaultValue="ui_top" /> <!-- if we move this to another PreferenceGroup, we should update code to remove this Preference --> <ListPreference android:key="preference_immersive_mode" Loading Loading
app/src/androidTest/java/net/sourceforge/opencamera/test/MainActivityTest.java +0 −119 Original line number Diff line number Diff line Loading @@ -8184,125 +8184,6 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv } } /* Tests against a bug where popup wouldn't show with left UI placement, due to 0 popup view height. */ public void testPopupLeftLayout() { Log.d(TAG, "testPopupLeftLayout"); setToDefault(); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity); SharedPreferences.Editor editor = settings.edit(); editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_left"); editor.apply(); updateForSettings(); View popup_view = mActivity.findViewById(net.sourceforge.opencamera.R.id.popup_container); View popupButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.popup); assertFalse(mActivity.popupIsOpen()); clickView(popupButton); while( !mActivity.popupIsOpen() ) { } int popup_width = popup_view.getWidth(); int popup_height = popup_view.getHeight(); int test_popup_width = mActivity.getMainUI().test_saved_popup_width; int test_popup_height = mActivity.getMainUI().test_saved_popup_height; Log.d(TAG, "popup_width: " + popup_width); Log.d(TAG, "popup_height: " + popup_height); Log.d(TAG, "test_popup_width: " + test_popup_width); Log.d(TAG, "test_popup_height: " + test_popup_height); assertTrue(popup_width > 0); assertTrue(popup_height > 0); assertEquals(popup_width, test_popup_width); assertEquals(popup_height, test_popup_height); // now reopen popup view, and check the same dimensions clickView(popupButton); while( mActivity.popupIsOpen() ) { } clickView(popupButton); while( !mActivity.popupIsOpen() ) { } int new_popup_width = popup_view.getWidth(); int new_popup_height = popup_view.getHeight(); test_popup_width = mActivity.getMainUI().test_saved_popup_width; test_popup_height = mActivity.getMainUI().test_saved_popup_height; Log.d(TAG, "new_popup_width: " + new_popup_width); Log.d(TAG, "new_popup_height: " + new_popup_height); Log.d(TAG, "test_popup_width: " + test_popup_width); Log.d(TAG, "test_popup_height: " + test_popup_height); assertEquals(popup_width, new_popup_width); assertEquals(popup_height, new_popup_height); assertEquals(popup_width, test_popup_width); assertEquals(popup_height, test_popup_height); } /* Tests with ui_right vs ui_top layout. */ public void testRightLayout() { Log.d(TAG, "testRightLayout"); setToDefault(); { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity); SharedPreferences.Editor editor = settings.edit(); editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_right"); editor.apply(); updateForSettings(); } View popupButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.popup); assertFalse(mActivity.popupIsOpen()); clickView(popupButton); while( !mActivity.popupIsOpen() ) { } Point display_size = new Point(); { Display display = mActivity.getWindowManager().getDefaultDisplay(); display.getSize(display_size); Log.d(TAG, "display_size: " + display_size.x + " x " + display_size.y); } View settingsButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.settings); View galleryButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.gallery); Log.d(TAG, "settings right: " + settingsButton.getRight()); Log.d(TAG, "settings top: " + settingsButton.getTop()); Log.d(TAG, "gallery right: " + galleryButton.getRight()); Log.d(TAG, "gallery top: " + galleryButton.getTop()); assertTrue(settingsButton.getRight() > (int)(0.8*display_size.x)); assertEquals(0, settingsButton.getTop()); assertEquals(display_size.x, galleryButton.getRight()); assertEquals(0, galleryButton.getTop()); { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity); SharedPreferences.Editor editor = settings.edit(); editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_top"); editor.apply(); updateForSettings(); } Log.d(TAG, "settings right: " + settingsButton.getRight()); Log.d(TAG, "settings top: " + settingsButton.getTop()); Log.d(TAG, "gallery right: " + galleryButton.getRight()); Log.d(TAG, "gallery top: " + galleryButton.getTop()); assertTrue(settingsButton.getRight() < (int)(0.2*display_size.x)); assertEquals(0, settingsButton.getTop()); assertEquals(display_size.x, galleryButton.getRight()); assertEquals(0, galleryButton.getTop()); assertFalse(mActivity.popupIsOpen()); clickView(popupButton); while( !mActivity.popupIsOpen() ) { } } /* Tests layout bug with popup menu. * Note, in practice this doesn't seem to reproduce the problem, but keep the test anyway. * Currently not autotested as the problem isn't fixed, and this would just be a test that Loading
app/src/main/java/net/sourceforge/opencamera/PreferenceKeys.java +0 −2 Original line number Diff line number Diff line Loading @@ -174,8 +174,6 @@ public class PreferenceKeys { public static final String Camera2PhotoVideoRecordingPreferenceKey = "preference_camera2_photo_video_recording"; public static final String UIPlacementPreferenceKey = "preference_ui_placement"; public static final String TouchCapturePreferenceKey = "preference_touch_capture"; public static final String PausePreviewPreferenceKey = "preference_pause_preview"; Loading
app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java +1 −10 Original line number Diff line number Diff line Loading @@ -168,16 +168,7 @@ public class MainUI { } private UIPlacement computeUIPlacement() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(main_activity); String ui_placement_string = sharedPreferences.getString(PreferenceKeys.UIPlacementPreferenceKey, "ui_top"); switch (ui_placement_string) { case "ui_left": return UIPlacement.UIPLACEMENT_LEFT; case "ui_top": return UIPlacement.UIPLACEMENT_TOP; default: return UIPlacement.UIPLACEMENT_RIGHT; } } private void layoutUI(boolean popup_container_only) { Loading
app/src/main/res/xml/preferences.xml +0 −9 Original line number Diff line number Diff line Loading @@ -563,15 +563,6 @@ android:icon="@drawable/ic_more_horiz_white_48dp" android:persistent="false"> <ListPreference android:key="preference_ui_placement" android:title="@string/preference_ui_placement" android:summary="%s" android:entries="@array/preference_ui_placement_entries" android:entryValues="@array/preference_ui_placement_values" android:defaultValue="ui_top" /> <!-- if we move this to another PreferenceGroup, we should update code to remove this Preference --> <ListPreference android:key="preference_immersive_mode" Loading