summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/app/GalleryActivity.java4
-rwxr-xr-xsrc/com/android/gallery3d/app/PhotoDataAdapter.java9
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java18
-rw-r--r--src/com/android/gallery3d/app/TimeLinePage.java4
-rw-r--r--src/com/android/gallery3d/data/ClusterAlbumSet.java21
5 files changed, 44 insertions, 12 deletions
diff --git a/src/com/android/gallery3d/app/GalleryActivity.java b/src/com/android/gallery3d/app/GalleryActivity.java
index f05528291..c328af73c 100644
--- a/src/com/android/gallery3d/app/GalleryActivity.java
+++ b/src/com/android/gallery3d/app/GalleryActivity.java
@@ -94,6 +94,10 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On
public static final String KEY_FROM_SNAPCAM = "from-snapcam";
public static final String KEY_TOTAL_NUMBER = "total-number";
+ //add for TimelinePage and PhotoPage: -1 don't show timeline title, 0 show timeline title
+ public static final int CLUSTER_ALBUMSET_NO_TITLE = -1;
+ public static final int CLUSTER_ALBUMSET_TIME_TITLE = 0;
+
private static final String TAG = "GalleryActivity";
private Dialog mVersionCheckDialog;
private ListView mDrawerListView;
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java
index 79cea8936..05bd37687 100755
--- a/src/com/android/gallery3d/app/PhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java
@@ -1079,12 +1079,11 @@ public class PhotoDataAdapter implements PhotoPage.Model {
private Path mPath;
private void free() {
- if (null != mGifEntry.gifDecoder) {
- mGifEntry.gifDecoder.free();
- mGifEntry.gifDecoder = null;
- }
-
if (null != mGifEntry) {
+ if (null != mGifEntry.gifDecoder) {
+ mGifEntry.gifDecoder.free();
+ mGifEntry.gifDecoder = null;
+ }
mGifEntry = null;
}
}
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index fa94daa01..f9db9fda5 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -484,8 +484,8 @@ public abstract class PhotoPage extends ActivityState implements
mSetPathString = "/filter/delete/{" + mSetPathString + "}";
mMediaSet = (FilterDeleteSet) mActivity.getDataManager()
.getMediaSet(mSetPathString);
- if(mMediaSet != null && mIsFromTimelineScreen) {
- mMediaSet.setClusterKind(-1);
+ if (mMediaSet != null && mIsFromTimelineScreen) {
+ mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_NO_TITLE);
}
if (mMediaSet == null) {
Log.w(TAG, "failed to restore " + mSetPathString);
@@ -570,8 +570,7 @@ public abstract class PhotoPage extends ActivityState implements
// We only want to finish the PhotoPage if there is no
// deletion that the user can undo.
if (mMediaSet.getNumberOfDeletions() == 0) {
- mActivity.getStateManager().finishState(
- PhotoPage.this);
+ onBackPressed();
}
}
}
@@ -987,12 +986,13 @@ public abstract class PhotoPage extends ActivityState implements
} else if (mTreatBackAsUp) {
onUpPressed();
} else {
+ if (mMediaSet != null && mIsFromTimelineScreen) {
+ //if back to TimeLinePage, need show timeline title
+ mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_TIME_TITLE);
+ }
super.onBackPressed();
mActionBar.setBackGroundDefault();
int count = mActivity.getStateManager().getStateCount();
- if(mIsFromTimelineScreen) {
- mMediaSet.setClusterKind(0);
- }
if (mIsFromVideoScreen || count == 1 || mIsFromTimelineScreen) {
mActivity.getToolbar().setNavigationContentDescription(
"drawer");
@@ -1605,6 +1605,10 @@ public abstract class PhotoPage extends ActivityState implements
mIsActive = true;
setContentPane(mRootPane);
+ //if from TimeLinePage, don't show the timeline title
+ if (mMediaSet != null && mIsFromTimelineScreen) {
+ mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_NO_TITLE);
+ }
mModel.resume();
mPhotoView.resume();
mActionBar.setDisplayOptions(
diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java
index a1f56b062..46e5c7d63 100644
--- a/src/com/android/gallery3d/app/TimeLinePage.java
+++ b/src/com/android/gallery3d/app/TimeLinePage.java
@@ -448,6 +448,10 @@ public class TimeLinePage extends ActivityState implements
// Set the reload bit here to prevent it exit this page in clearLoadingBit().
setLoadingBit(BIT_LOADING_RELOAD);
+ if (null != mMediaSet) {
+ //set to show timeline title
+ mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_TIME_TITLE);
+ }
mLoadingFailed = false;
mAlbumDataAdapter.resume();
diff --git a/src/com/android/gallery3d/data/ClusterAlbumSet.java b/src/com/android/gallery3d/data/ClusterAlbumSet.java
index 9ed3a7841..3dc1ec0c5 100644
--- a/src/com/android/gallery3d/data/ClusterAlbumSet.java
+++ b/src/com/android/gallery3d/data/ClusterAlbumSet.java
@@ -85,6 +85,12 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
}
private void updateClusters() {
+ //save last paths to find the empty albums
+ ArrayList<Path> oldPaths = new ArrayList<Path>();
+ for (ClusterAlbum album : mAlbums) {
+ oldPaths.add(album.getPath());
+ }
+
mAlbums.clear();
Clustering clustering;
Context context = mApplication.getAndroidContext();
@@ -133,6 +139,21 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
album.setImageItemCount(clustering.getClusterImageCount(i));
album.setVideoItemCount(clustering.getClusterVideoCount(i));
mAlbums.add(album);
+
+ int size = oldPaths.size();
+ for (int j = size - 1; j >= 0; j--) {
+ if (oldPaths.get(j) == childPath) {
+ oldPaths.remove(j);
+ break;
+ }
+ }
+ }
+ //set the empty path to the albums which don't exist from dataManger
+ for (Path path : oldPaths) {
+ ClusterAlbum album = (ClusterAlbum) dataManager.peekMediaObject(path);
+ if (album != null) {
+ album.setMediaItems(new ArrayList<Path>());
+ }
}
}