Merge "Update design for grid/filmstrip switcher" into gb-ub-photos-arches
diff --git a/res/layout/action_bar_two_line_text.xml b/res/layout/action_bar_two_line_text.xml
new file mode 100644
index 0000000..37cb375
--- /dev/null
+++ b/res/layout/action_bar_two_line_text.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2006 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.
+-->
+<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
+ android:paddingLeft="18dp"
+ android:paddingRight="18dp"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:layout_width="fill_parent"
+ 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="match_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:gravity="top"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:minHeight="?attr/listPreferredItemHeightSmall"
+ />
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="bottom"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:singleLine="true"
+ android:minHeight="?attr/listPreferredItemHeightSmall"
+ />
+</TwoLineListItem>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 61b45a2..67ba40d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -459,10 +459,10 @@
<string name="no_external_storage">No external storage available</string>
<!-- Label for album filmstrip button -->
- <string name="switch_photo_filmstrip">Filmstrip</string>
+ <string name="switch_photo_filmstrip">Filmstrip view</string>
<!-- Label for album grid button -->
- <string name="switch_photo_grid">Grid</string>
+ <string name="switch_photo_grid">Grid view</string>
<!-- The tilte of a dialog showing trimming in progress. [CHAR LIMIT=20] -->
<string name="trimming">Trimming</string>
diff --git a/src/com/android/gallery3d/app/GalleryActionBar.java b/src/com/android/gallery3d/app/GalleryActionBar.java
index 4b9ef53..1729c64 100644
--- a/src/com/android/gallery3d/app/GalleryActionBar.java
+++ b/src/com/android/gallery3d/app/GalleryActionBar.java
@@ -26,7 +26,6 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
-import android.text.TextUtils.TruncateAt;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
@@ -35,6 +34,7 @@
import android.widget.BaseAdapter;
import android.widget.ShareActionProvider;
import android.widget.TextView;
+import android.widget.TwoLineListItem;
import com.android.gallery3d.R;
import com.android.gallery3d.common.ApiHelper;
@@ -151,27 +151,28 @@
return position;
}
- private View getView(CharSequence label, View convertView,
- ViewGroup parent, boolean ellipsize) {
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ if (convertView == null) {
+ convertView = mInflater.inflate(R.layout.action_bar_two_line_text,
+ parent, false);
+ }
+ TwoLineListItem view = (TwoLineListItem) convertView;
+ view.getText1().setText(mActionBar.getTitle());
+ view.getText2().setText((CharSequence) getItem(position));
+ return convertView;
+ }
+
+ @Override
+ public View getDropDownView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.action_bar_text,
parent, false);
}
TextView view = (TextView) convertView;
- view.setEllipsize(ellipsize ? TruncateAt.END : null);
- view.setText(label);
+ view.setText((CharSequence) getItem(position));
return convertView;
}
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- return getView(mActionBar.getTitle(), convertView, parent, true);
- }
-
- @Override
- public View getDropDownView(int position, View convertView, ViewGroup parent) {
- return getView((CharSequence) getItem(position), convertView, parent, false);
- }
}
public static String getClusterByTypeString(Context context, int type) {