diff options
author | Arne Coucheron <arco68@gmail.com> | 2017-07-13 01:36:11 +0200 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2017-12-16 06:52:46 +0100 |
commit | ee48b40adc54619520bb2cd083175d6c0c7b1262 (patch) | |
tree | e9321a9c5904129ef4b0797265cdb23d8a3ccf3c | |
parent | 6b9ce51b6e79538328f6d6aa0d6b2254c7b36c2a (diff) | |
download | android_packages_apps_Gallery2-ee48b40adc54619520bb2cd083175d6c0c7b1262.tar.gz android_packages_apps_Gallery2-ee48b40adc54619520bb2cd083175d6c0c7b1262.tar.bz2 android_packages_apps_Gallery2-ee48b40adc54619520bb2cd083175d6c0c7b1262.zip |
Gallery2: Fix various issues and glitches
* Remove unnecessary navbar toggles, and add missing ones
* Modify picker dialog style
* Fix editor bottom bar glitch with API 25
* Update main gallery layout so new bottom navigation works
properly, and fix various other issues related to it
* Don't hide action bar in editor when adjusting effects, so
we can see the values we adjust
* Update toolbar layout
Change-Id: I2a8f0b57ec874434c0fd0bb55de784b5d8379091
-rw-r--r-- | res/layout/action_mode.xml | 3 | ||||
-rw-r--r-- | res/layout/filtershow_main_panel.xml | 2 | ||||
-rw-r--r-- | res/layout/gallery_main.xml | 39 | ||||
-rw-r--r-- | res/layout/gl_root_group.xml | 3 | ||||
-rw-r--r-- | res/layout/popup_list_item.xml | 4 | ||||
-rw-r--r-- | res/layout/toolbar.xml | 24 | ||||
-rw-r--r-- | res/menu/albumset.xml | 2 | ||||
-rwxr-xr-x | res/values/colors.xml | 2 | ||||
-rw-r--r-- | res/values/styles.xml | 8 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 9 | ||||
-rwxr-xr-x | src/com/android/gallery3d/app/AlbumSetPage.java | 13 | ||||
-rwxr-xr-x | src/com/android/gallery3d/app/GalleryActivity.java | 7 | ||||
-rwxr-xr-x | src/com/android/gallery3d/app/PhotoPage.java | 5 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/SlideshowPage.java | 4 | ||||
-rwxr-xr-x | src/com/android/gallery3d/app/TimeLinePage.java | 4 | ||||
-rwxr-xr-x | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 2 |
16 files changed, 76 insertions, 55 deletions
diff --git a/res/layout/action_mode.xml b/res/layout/action_mode.xml index efa920dda..186ce5ba6 100644 --- a/res/layout/action_mode.xml +++ b/res/layout/action_mode.xml @@ -24,6 +24,7 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent"> + <ImageView android:layout_gravity="right|center_vertical" android:layout_width="8dp" android:layout_height="8dp" @@ -33,7 +34,7 @@ android:divider="?android:attr/listDividerAlertDialog" android:textAppearance="?android:attr/textAppearanceLargePopupMenu" android:textColor="@color/black_transparent_4" - android:textSize="20sp" + android:textSize="18sp" android:singleLine="true" android:gravity="start|center_vertical" android:paddingEnd="15dip" diff --git a/res/layout/filtershow_main_panel.xml b/res/layout/filtershow_main_panel.xml index 5b0510a1c..a77221ce5 100644 --- a/res/layout/filtershow_main_panel.xml +++ b/res/layout/filtershow_main_panel.xml @@ -37,7 +37,7 @@ <FrameLayout android:id="@+id/category_panel_container" android:layout_width="match_parent" android:visibility="visible" - android:layout_height="0dip" + android:layout_height="wrap_content" android:layout_gravity="center" android:paddingRight="5dp" android:paddingLeft="5dp" diff --git a/res/layout/gallery_main.xml b/res/layout/gallery_main.xml index 7c6c2bc05..4b4edbd6b 100644 --- a/res/layout/gallery_main.xml +++ b/res/layout/gallery_main.xml @@ -34,35 +34,38 @@ android:id="@+id/drawerLayout" android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="match_parent" > + android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> - <!-- MAIN CONTENT --> <RelativeLayout android:id="@+id/gallery_root" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:layout_above="@+id/bottom_navigation"> - <android.support.design.widget.BottomNavigationView - android:id="@+id/bottom_navigation" - android:elevation="8dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - app:menu="@menu/navigation_items" - app:itemBackground="@color/primary" - app:itemIconTint="@drawable/item_bg" - app:itemTextColor="@drawable/item_bg" /> + <!-- Toolbar --> + <include layout="@layout/toolbar" /> + + <!-- Main content --> + <include layout="@layout/gl_root_group" /> - <include layout="@layout/gl_root_group"/> </RelativeLayout> - <!-- This layout will overlap all the others --> - <include - android:id="@+id/toolbar" - layout="@layout/toolbar" /> + <!-- Bottom bar --> + <android.support.design.widget.BottomNavigationView + android:id="@+id/bottom_navigation" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/primary" + android:layout_alignParentBottom="true" + app:menu="@menu/navigation_items" + app:itemBackground="@color/primary" + app:itemIconTint="@drawable/item_bg" + app:itemTextColor="@drawable/item_bg" /> + </RelativeLayout> + </LinearLayout> diff --git a/res/layout/gl_root_group.xml b/res/layout/gl_root_group.xml index eee2b49f8..630217153 100644 --- a/res/layout/gl_root_group.xml +++ b/res/layout/gl_root_group.xml @@ -19,8 +19,7 @@ <RelativeLayout android:id="@+id/gl_parent_layout" android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="56dp"> + android:layout_height="match_parent"> <com.android.gallery3d.ui.GLRootView android:id="@+id/gl_root_view" android:layout_width="match_parent" diff --git a/res/layout/popup_list_item.xml b/res/layout/popup_list_item.xml index 0fad174aa..a2f7c31bb 100644 --- a/res/layout/popup_list_item.xml +++ b/res/layout/popup_list_item.xml @@ -19,12 +19,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLargePopupMenu" - android:textSize="20sp" + android:textSize="18sp" android:textColor="@color/black_transparent_4" android:singleLine="true" android:gravity="center_vertical" android:paddingStart="16dp" android:paddingEnd="16dp" - android:minHeight="?android:attr/listPreferredItemHeight" + android:minHeight="?android:attr/listPreferredItemHeightSmall" android:minWidth="196dp" /> diff --git a/res/layout/toolbar.xml b/res/layout/toolbar.xml index cf9b8a9ca..4c2a03a4e 100644 --- a/res/layout/toolbar.xml +++ b/res/layout/toolbar.xml @@ -28,14 +28,20 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> -<Toolbar xmlns:android="http://schemas.android.com/apk/res/android" +<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="@dimen/toolbar_height" - android:paddingTop="24dp" - android:background="@color/primary" - android:elevation="8dp" - android:theme="@style/ToolbarTheme" - android:titleTextAppearance="@style/ToolbarTitleStyle" - android:popupTheme="@style/ToolbarPopUpTheme" > + android:layout_height="wrap_content" + android:theme="@style/ToolbarTheme"> + + <Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="@dimen/toolbar_height" + android:paddingTop="24dp" + android:background="@color/primary" + android:elevation="8dp" + android:titleTextAppearance="@style/ToolbarTitleStyle" + android:popupTheme="@style/ToolbarPopUpTheme" /> + +</android.support.design.widget.AppBarLayout> -</Toolbar> diff --git a/res/menu/albumset.xml b/res/menu/albumset.xml index 603fb9b7e..b21bf3d38 100644 --- a/res/menu/albumset.xml +++ b/res/menu/albumset.xml @@ -24,7 +24,7 @@ <item android:id="@+id/action_select" android:icon="@drawable/ic_selection" android:title="@string/select_album" - android:showAsAction="never" /> + android:showAsAction="ifRoom" /> <item android:id="@+id/action_manage_offline" android:title="@string/make_available_offline" android:visible="false" diff --git a/res/values/colors.xml b/res/values/colors.xml index 429348e35..9388e9898 100755 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -32,7 +32,7 @@ <color name="album_placeholder">@color/white</color> <!-- configuration for photo page --> - <color name="photo_background">@color/primary</color> + <color name="photo_background">@color/black</color> <color name="photo_placeholder">@color/light_black</color> <color name="photo_page_action_bar">#8A000000</color> <color name="photo_page_bottom_panel">#8A000000</color> diff --git a/res/values/styles.xml b/res/values/styles.xml index dafe0d9c9..ebc975da9 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -23,7 +23,7 @@ <item name="switchStyle">@android:style/Widget.CompoundButton</item> </style> - <style name="Theme.Gallery.Dialog" parent="android:Theme.Holo.Dialog" /> + <style name="Theme.Gallery.Dialog" parent="android:Theme.Material.Dialog" /> <style name="Theme.Gallery" parent="android:Theme.Material.Light"> <item name="android:colorPrimary">@color/primary</item> @@ -66,7 +66,9 @@ <item name="android:background">@null</item> <item name="android:src">@drawable/icn_media_play</item> </style> - <style name="DialogPickerTheme" parent="Theme.Gallery"> + <style name="DialogPickerTheme" parent="android:Theme.Material"> + <item name="android:colorPrimary">@color/primary</item> + <item name="android:colorPrimaryDark">@color/primaryDark</item> </style> <style name="Theme.ProxyLauncher" parent="@android:Theme.Translucent.NoTitleBar"> </style> @@ -338,6 +340,8 @@ <style name="ToolbarTheme" parent="android:Theme.Material" > <item name="android:actionOverflowButtonStyle">@style/WhiteOverflow</item> + <item name="colorPrimary">@color/primary</item> + <item name="colorPrimaryDark">@color/primaryDark</item> </style> <style name="ToolbarTitleStyle" parent="android:TextAppearance.Material.Widget.Toolbar.Title"> diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 080dfbab4..874670e83 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -285,7 +285,10 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster if (mInCameraApp) { GalleryUtils.startGalleryActivity(mActivity); } else if (mActivity.getStateManager().getStateCount() > 1) { - ((GalleryActivity) mActivity).toggleNavBar(true); + Toolbar toolbar = mActivity.getToolbar(); + if (toolbar != null) { + ((GalleryActivity) mActivity).toggleNavBar(true); + } super.onBackPressed(); } else if (mParentMediaSetString != null) { Bundle data = new Bundle(getData()); @@ -794,10 +797,14 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster case SelectionManager.ENTER_SELECTION_MODE: { mActionModeHandler.startActionMode(); performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + ((GalleryActivity) mActivity).toggleNavBar(false); break; } case SelectionManager.LEAVE_SELECTION_MODE: { mActionModeHandler.finishActionMode(); + if (mActivity.getStateManager().getStateCount() <= 1) { + ((GalleryActivity) mActivity).toggleNavBar(true); + } mRootPane.invalidate(); updateMenuItem(); break; diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index a82f0ed96..5b46e09ee 100755 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -278,6 +278,13 @@ public class AlbumSetPage extends ActivityState implements } private void pickAlbum(int slotIndex) { + if (mActivity.getStateManager().getStateCount() >= 1) { + android.widget.Toolbar toolbar = mActivity.getToolbar(); + if (toolbar != null) { + ((GalleryActivity) mActivity).toggleNavBar(false); + } + } + if (!mIsActive) return; MediaSet targetSet = mAlbumSetDataAdapter.getMediaSet(slotIndex); @@ -707,12 +714,12 @@ public class AlbumSetPage extends ActivityState implements //mActionBar.disableClusterMenu(true); mActionModeHandler.startActionMode(); performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - ((GalleryActivity)mActivity).toggleNavBar(false); + ((GalleryActivity) mActivity).toggleNavBar(false); break; } case SelectionManager.LEAVE_SELECTION_MODE: { mActionModeHandler.finishActionMode(); - ((GalleryActivity)mActivity).toggleNavBar(true); + ((GalleryActivity) mActivity).toggleNavBar(true); /*if (mShowClusterMenu) { mActionBar.enableClusterMenu(mSelectedAction, this); }*/ @@ -738,13 +745,11 @@ public class AlbumSetPage extends ActivityState implements mDetailsHelper.hide(); mAlbumSetView.setHighlightItemPath(null); mSlotView.invalidate(); - ((GalleryActivity)mActivity).toggleNavBar(true); } private void showDetails() { mShowDetails = true; if (mDetailsHelper == null) { - ((GalleryActivity)mActivity).toggleNavBar(false); mDetailsHelper = new DetailsHelper(mActivity, mRootPane, mDetailsSource); mDetailsHelper.setCloseListener(new CloseListener() { @Override diff --git a/src/com/android/gallery3d/app/GalleryActivity.java b/src/com/android/gallery3d/app/GalleryActivity.java index ee87bf58b..69c7e8807 100755 --- a/src/com/android/gallery3d/app/GalleryActivity.java +++ b/src/com/android/gallery3d/app/GalleryActivity.java @@ -202,13 +202,8 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On if (show) { mBottomNavigation.setVisibility(View.VISIBLE); } else { - mBottomNavigation.setVisibility(View.INVISIBLE); + mBottomNavigation.setVisibility(View.GONE); } - - // Convert dp to pixels - float dp = getApplicationContext().getResources().getDisplayMetrics().density; - - params.setMargins(0, 0, 0, show ? Math.round(56 * dp) : 0); } public void showScreen(int position) { diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 12187734a..05362d509 100755 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -1021,7 +1021,6 @@ public abstract class PhotoPage extends ActivityState implements @Override protected void onBackPressed() { showBars(); - ((GalleryActivity)mActivity).toggleNavBar(true); if (mShowDetails) { hideDetails(); } else if (mAppBridge == null || !switchWithCaptureAnimation(-1)) { @@ -1040,7 +1039,7 @@ public abstract class PhotoPage extends ActivityState implements mActionBar.setBackGroundDefault(); int count = mActivity.getStateManager().getStateCount(); if (mIsFromVideoScreen || count == 1 || mIsFromTimelineScreen) { - ((GalleryActivity)mActivity).toggleNavBar(true); + ((GalleryActivity) mActivity).toggleNavBar(true); if (mModel instanceof PhotoDataAdapter) { ((PhotoDataAdapter) mModel).setDataListener(null); } @@ -1665,7 +1664,7 @@ public abstract class PhotoPage extends ActivityState implements mActionBar.addOnMenuVisibilityListener(mMenuVisibilityListener); refreshBottomControlsWhenReady(); if (((mSecureAlbum == null) && (mSetPathString != null))) { - ((GalleryActivity)mActivity).toggleNavBar(false); + ((GalleryActivity) mActivity).toggleNavBar(false); } // if (mShowSpinner && mPhotoView.getFilmMode()) { // mActionBar.enableAlbumModeMenu( diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java index 2923ee998..29df60687 100644 --- a/src/com/android/gallery3d/app/SlideshowPage.java +++ b/src/com/android/gallery3d/app/SlideshowPage.java @@ -176,7 +176,9 @@ public class SlideshowPage extends ActivityState { @Override public void onPause() { super.onPause(); - ((GalleryActivity) mActivity).toggleNavBar(true); + if (mActivity.getStateManager().getStateCount() <= 1) { + ((GalleryActivity) mActivity).toggleNavBar(true); + } mIsActive = false; mModel.pause(); mSlideshowView.release(); diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java index 7810a1522..a9abc81ff 100755 --- a/src/com/android/gallery3d/app/TimeLinePage.java +++ b/src/com/android/gallery3d/app/TimeLinePage.java @@ -697,12 +697,12 @@ public class TimeLinePage extends ActivityState implements case SelectionManager.ENTER_SELECTION_MODE: { mActionModeHandler.startActionMode(); performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - ((GalleryActivity)mActivity).toggleNavBar(false); + ((GalleryActivity) mActivity).toggleNavBar(false); break; } case SelectionManager.LEAVE_SELECTION_MODE: { mActionModeHandler.finishActionMode(); - ((GalleryActivity)mActivity).toggleNavBar(true); + ((GalleryActivity) mActivity).toggleNavBar(true); mRootPane.invalidate(); break; } diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index ca5311769..0e790979e 100755 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -437,7 +437,7 @@ public class FilterShowActivity extends AbstractPermissionActivity implements On setActionBar(); showActionBar(true); } else { - showActionBar(false); + //showActionBar(false); } if (representation.getFilterType() == FilterRepresentation.TYPE_WATERMARK_CATEGORY) { |