summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-10-01 17:49:30 -0700
committerBobby Georgescu <georgescu@google.com>2012-10-01 18:15:52 -0700
commitee899c09c88e5b054397ac44ad20e5055cd24f39 (patch)
tree0ac846de9ca43a3b61416a7231028dbf416800fc /src
parent3cf502a91b36bf6ce633f897505b0a2c3fc53ad5 (diff)
downloadandroid_packages_apps_Gallery2-ee899c09c88e5b054397ac44ad20e5055cd24f39.tar.gz
android_packages_apps_Gallery2-ee899c09c88e5b054397ac44ad20e5055cd24f39.tar.bz2
android_packages_apps_Gallery2-ee899c09c88e5b054397ac44ad20e5055cd24f39.zip
Improve display of ActionBar album mode switcher
Bug: 7265942 Bug: 7266862 - Ellipsize the title of the album when appropriate - Show correctly title when swiping from camera to gallery - Hide the delete icon in the overflow menu to match the latest UX mocks, making more room for title Change-Id: Ief77f65c972e75086c5dbf4229c9462cbcc17940
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/GalleryActionBar.java9
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java6
-rw-r--r--src/com/android/gallery3d/data/ComboAlbum.java6
3 files changed, 17 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/GalleryActionBar.java b/src/com/android/gallery3d/app/GalleryActionBar.java
index 6525ae542..f253c8c49 100644
--- a/src/com/android/gallery3d/app/GalleryActionBar.java
+++ b/src/com/android/gallery3d/app/GalleryActionBar.java
@@ -23,6 +23,7 @@ import android.content.Context;
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.View;
import android.view.ViewGroup;
@@ -150,24 +151,26 @@ public class GalleryActionBar implements OnNavigationListener {
return position;
}
- private View getView(CharSequence label, View convertView, ViewGroup parent) {
+ private View getView(CharSequence label, View convertView,
+ ViewGroup parent, boolean ellipsize) {
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);
return convertView;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
- return getView(mActionBar.getTitle(), convertView, 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);
+ return getView((CharSequence) getItem(position), convertView, parent, false);
}
}
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index a9aa8e729..8c2319547 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -42,6 +42,7 @@ import com.android.gallery3d.R;
import com.android.gallery3d.anim.FloatAnimation;
import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.Utils;
+import com.android.gallery3d.data.ComboAlbum;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.FilterDeleteSet;
import com.android.gallery3d.data.MediaDetails;
@@ -369,6 +370,11 @@ public class PhotoPage extends ActivityState implements
MediaSet originalSet = mActivity.getDataManager()
.getMediaSet(mSetPathString);
+ if (originalSet instanceof ComboAlbum) {
+ // Use the name of the camera album rather than the default
+ // ComboAlbum behavior
+ ((ComboAlbum) originalSet).useNameOfChild(1);
+ }
mSelectionManager.setSourceMediaSet(originalSet);
mSetPathString = "/filter/delete/{" + mSetPathString + "}";
mMediaSet = (FilterDeleteSet) mActivity.getDataManager()
diff --git a/src/com/android/gallery3d/data/ComboAlbum.java b/src/com/android/gallery3d/data/ComboAlbum.java
index e100dc3e6..cadd9f8af 100644
--- a/src/com/android/gallery3d/data/ComboAlbum.java
+++ b/src/com/android/gallery3d/data/ComboAlbum.java
@@ -27,7 +27,7 @@ public class ComboAlbum extends MediaSet implements ContentListener {
@SuppressWarnings("unused")
private static final String TAG = "ComboAlbum";
private final MediaSet[] mSets;
- private final String mName;
+ private String mName;
public ComboAlbum(Path path, MediaSet[] mediaSets, String name) {
super(path, nextVersionNumber());
@@ -76,6 +76,10 @@ public class ComboAlbum extends MediaSet implements ContentListener {
return mName;
}
+ public void useNameOfChild(int i) {
+ if (i < mSets.length) mName = mSets[i].getName();
+ }
+
@Override
public long reload() {
boolean changed = false;