summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Coucheron <arco68@gmail.com>2017-07-13 01:36:11 +0200
committerLuK1337 <priv.luk@gmail.com>2019-10-21 21:50:32 +0200
commitccbf7a79ca64305fdb4543b53790e716e647f62f (patch)
tree9e92df58e9e44f85867be4bd327a22a0c978b1ef
parent075c174d7c6ceaa526ba25e160771c8cba6bc393 (diff)
downloadandroid_packages_apps_Gallery2-ccbf7a79ca64305fdb4543b53790e716e647f62f.tar.gz
android_packages_apps_Gallery2-ccbf7a79ca64305fdb4543b53790e716e647f62f.tar.bz2
android_packages_apps_Gallery2-ccbf7a79ca64305fdb4543b53790e716e647f62f.zip
Gallery2: Fix various issues and glitches
* Remove unnecessary navbar toggles, and add missing ones * Modify picker dialog style * 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.xml3
-rwxr-xr-xres/layout/gallery_main.xml37
-rw-r--r--res/layout/gl_root_group.xml3
-rw-r--r--res/layout/popup_list_item.xml4
-rwxr-xr-xres/layout/toolbar.xml21
-rw-r--r--res/menu/albumset.xml2
-rwxr-xr-xres/values/colors.xml2
-rw-r--r--res/values/styles.xml11
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java9
-rwxr-xr-xsrc/com/android/gallery3d/app/AlbumSetPage.java13
-rwxr-xr-xsrc/com/android/gallery3d/app/GalleryActivity.java7
-rwxr-xr-xsrc/com/android/gallery3d/app/PhotoPage.java5
-rw-r--r--src/com/android/gallery3d/app/SlideshowPage.java4
-rwxr-xr-xsrc/com/android/gallery3d/app/TimeLinePage.java4
-rwxr-xr-xsrc/com/android/gallery3d/filtershow/FilterShowActivity.java2
15 files changed, 72 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/gallery_main.xml b/res/layout/gallery_main.xml
index cd47ee32d..749d5bed1 100755
--- a/res/layout/gallery_main.xml
+++ b/res/layout/gallery_main.xml
@@ -41,29 +41,32 @@
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 161728663..892f736e2 100755
--- a/res/layout/toolbar.xml
+++ b/res/layout/toolbar.xml
@@ -28,13 +28,18 @@
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="?android:attr/actionBarSize"
- 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>
+ <Toolbar
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/actionBarSize"
+ android:background="@color/primary"
+ android:elevation="8dp"
+ android:titleTextAppearance="@style/ToolbarTitleStyle"
+ android:popupTheme="@style/ToolbarPopUpTheme" />
+
+</android.support.design.widget.AppBarLayout>
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..788339c50 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>
@@ -319,8 +321,7 @@
<item name="android:windowDisablePreview">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowBackground">@android:color/black</item>
- <item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:windowTranslucentStatus">true</item>
+ <item name="android:statusBarColor">#212121</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowActionModeOverlay">true</item>
@@ -338,6 +339,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 c3ef4c326..4f3f34814 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());
@@ -797,10 +800,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 2b87f97b4..7eaa2bc6a 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);
@@ -701,12 +708,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);
}*/
@@ -732,13 +739,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 d4b508782..04892378a 100755
--- a/src/com/android/gallery3d/app/GalleryActivity.java
+++ b/src/com/android/gallery3d/app/GalleryActivity.java
@@ -206,13 +206,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 76bd5db6d..6108c8e3d 100755
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -1025,7 +1025,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)) {
@@ -1044,7 +1043,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);
}
@@ -1669,7 +1668,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 bc8f7d8ee..5b1aa844c 100755
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -436,8 +436,6 @@ public class FilterShowActivity extends AbstractPermissionActivity implements On
if (mCurrentEditor.showsActionBar()) {
setActionBar();
showActionBar(true);
- } else {
- showActionBar(false);
}
if (representation.getFilterType() == FilterRepresentation.TYPE_WATERMARK_CATEGORY) {