summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-10-11 14:49:09 -0700
committerBobby Georgescu <georgescu@google.com>2012-10-11 15:20:07 -0700
commit5d4b8fd9fd2e601b780c027ef912c8fabfe3ee1e (patch)
treeee8e54eb210796428d211d54a3235acde06ede7e
parent37a9333651cead185d982d9b809cb3425a24d3d8 (diff)
downloadandroid_packages_apps_Gallery2-5d4b8fd9fd2e601b780c027ef912c8fabfe3ee1e.tar.gz
android_packages_apps_Gallery2-5d4b8fd9fd2e601b780c027ef912c8fabfe3ee1e.tar.bz2
android_packages_apps_Gallery2-5d4b8fd9fd2e601b780c027ef912c8fabfe3ee1e.zip
Change ActionBar spinner text size on rotate
Bug: 7333151 Update the grid/filmstrip spinner switch text to look and behave like the text in the Gmail app, as requested by UX. Change-Id: If822b21899172a35402477868d4f146a8e00cfea
-rw-r--r--res/layout/action_bar_two_line_text.xml50
-rw-r--r--res/values-land/styles.xml22
-rw-r--r--res/values/styles.xml2
-rw-r--r--src/com/android/gallery3d/app/AbstractGalleryActivity.java1
-rw-r--r--src/com/android/gallery3d/app/GalleryActionBar.java9
5 files changed, 59 insertions, 25 deletions
diff --git a/res/layout/action_bar_two_line_text.xml b/res/layout/action_bar_two_line_text.xml
index 9b76a8072..95faffa12 100644
--- a/res/layout/action_bar_two_line_text.xml
+++ b/res/layout/action_bar_two_line_text.xml
@@ -14,29 +14,29 @@
limitations under the License.
-->
<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
- android:paddingLeft="18dp"
- android:paddingRight="18dp"
- android:background="?android:attr/activatedBackgroundIndicator"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:mode="twoLine"
- android:gravity="center_vertical"
->
- <TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/text1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="end"
- android:textSize="15dp"
- />
- <TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/text2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@android:id/text1"
- android:textSize="9dp"
- android:singleLine="true"
- />
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:duplicateParentState="false"
+ android:layout_alignParentLeft="true"
+ android:layout_width="wrap_content" >
+ <TextView
+ android:id="@android:id/text1"
+ style="@style/ActionBarTwoLinePrimary"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:includeFontPadding="false"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ <TextView
+ android:id="@android:id/text2"
+ style="@style/ActionBarTwoLineSecondary"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:includeFontPadding="false"
+ android:layout_marginRight="4dp"
+ android:layout_below="@android:id/text1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
</TwoLineListItem>
diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml
new file mode 100644
index 000000000..c10362ea0
--- /dev/null
+++ b/res/values-land/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Spinner primary text is smaller than usual due to extra vertical padding in spinner asset -->
+ <style name="ActionBarTwoLinePrimary" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
+ <item name="android:textSize">14sp</item>
+ </style>
+</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index abcd4dd10..c534ad895 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -41,4 +41,6 @@
</style>
<bool name="picker_is_dialog">false</bool>
<color name="darker_transparent">#C1000000</color>
+ <style name="ActionBarTwoLinePrimary" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"></style>
+ <style name="ActionBarTwoLineSecondary" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle"></style>
</resources>
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
index 5e779cd59..cb3aa9d0a 100644
--- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java
+++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
@@ -84,6 +84,7 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext
public void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
mStateManager.onConfigurationChange(config);
+ getGalleryActionBar().onConfigurationChanged();
invalidateOptionsMenu();
toggleStatusBarByOrientation();
}
diff --git a/src/com/android/gallery3d/app/GalleryActionBar.java b/src/com/android/gallery3d/app/GalleryActionBar.java
index 1729c6433..f0be01a91 100644
--- a/src/com/android/gallery3d/app/GalleryActionBar.java
+++ b/src/com/android/gallery3d/app/GalleryActionBar.java
@@ -57,6 +57,7 @@ public class GalleryActionBar implements OnNavigationListener {
private AlbumModeAdapter mAlbumModeAdapter;
private OnAlbumModeSelectedListener mAlbumModeListener;
+ private int mLastAlbumModeSelected;
private CharSequence [] mAlbumModes;
public static final int ALBUM_FILMSTRIP_MODE_SELECTED = 0;
public static final int ALBUM_GRID_MODE_SELECTED = 1;
@@ -254,6 +255,13 @@ public class GalleryActionBar implements OnNavigationListener {
}
}
+ public void onConfigurationChanged() {
+ if (mActionBar != null && mAlbumModeListener != null) {
+ OnAlbumModeSelectedListener listener = mAlbumModeListener;
+ enableAlbumModeMenu(mLastAlbumModeSelected, listener);
+ }
+ }
+
public void enableAlbumModeMenu(int selected, OnAlbumModeSelectedListener listener) {
if (mActionBar != null) {
if (mAlbumModeAdapter == null) {
@@ -265,6 +273,7 @@ public class GalleryActionBar implements OnNavigationListener {
mAlbumModeAdapter = new AlbumModeAdapter();
}
mAlbumModeListener = null;
+ mLastAlbumModeSelected = selected;
mActionBar.setListNavigationCallbacks(mAlbumModeAdapter, this);
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
mActionBar.setSelectedNavigationItem(selected);