diff options
author | Kedi Xu <kedix@codeaurora.org> | 2016-10-21 15:13:32 +0800 |
---|---|---|
committer | Kedi Xu <kedix@codeaurora.org> | 2016-10-21 15:13:32 +0800 |
commit | fece30c283386fd0439831b63f0e373489b41166 (patch) | |
tree | b6c9c9ffcd95c8c825d3caefa5fdaaead56c4700 | |
parent | d277584b126e285e24aaf21847aef66234ac1f31 (diff) | |
download | android_packages_apps_Gallery2-fece30c283386fd0439831b63f0e373489b41166.tar.gz android_packages_apps_Gallery2-fece30c283386fd0439831b63f0e373489b41166.tar.bz2 android_packages_apps_Gallery2-fece30c283386fd0439831b63f0e373489b41166.zip |
SnapdragonGallery: Fix timetitle doesn't show
Some situation the ClusterAlbum's mKind is not correct,
if set in ClusterAlbumSet.updateClusters will cause some
other CR like 1038066, 1066615
Change-Id: I19d811d93fe3c9e9c981c835a7530fe66f12183b
CRs-Fixed: 1079497
-rwxr-xr-x | src/com/android/gallery3d/app/GalleryActivity.java | 4 | ||||
-rwxr-xr-x | src/com/android/gallery3d/app/PhotoPage.java | 6 | ||||
-rwxr-xr-x | src/com/android/gallery3d/app/TimeLinePage.java | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/gallery3d/data/ClusterAlbum.java | 31 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/gallery3d/data/FilterDeleteSet.java | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/gallery3d/data/MediaSet.java | 20 |
6 files changed, 36 insertions, 30 deletions
diff --git a/src/com/android/gallery3d/app/GalleryActivity.java b/src/com/android/gallery3d/app/GalleryActivity.java index 93ac5a4bc..e18f1c2c6 100755 --- a/src/com/android/gallery3d/app/GalleryActivity.java +++ b/src/com/android/gallery3d/app/GalleryActivity.java @@ -91,10 +91,6 @@ 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/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index cdd5742fd..008784c91 100755 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -481,7 +481,7 @@ public abstract class PhotoPage extends ActivityState implements mMediaSet = (FilterDeleteSet) mActivity.getDataManager() .getMediaSet(mSetPathString); if (mMediaSet != null && mIsFromTimelineScreen) { - mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_NO_TITLE); + mMediaSet.setShowAlbumsetTimeTitle(false); } if (mMediaSet == null) { Log.w(TAG, "failed to restore " + mSetPathString); @@ -987,7 +987,7 @@ public abstract class PhotoPage extends ActivityState implements } else { if (mMediaSet != null && mIsFromTimelineScreen) { //if back to TimeLinePage, need show timeline title - mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_TIME_TITLE); + mMediaSet.setShowAlbumsetTimeTitle(true); } super.onBackPressed(); mActionBar.setBackGroundDefault(); @@ -1613,7 +1613,7 @@ public abstract class PhotoPage extends ActivityState implements //if from TimeLinePage, don't show the timeline title if (mMediaSet != null && mIsFromTimelineScreen) { - mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_NO_TITLE); + mMediaSet.setShowAlbumsetTimeTitle(false); } mActionBar.setDisplayOptions( diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java index 978909849..fd3130566 100755 --- a/src/com/android/gallery3d/app/TimeLinePage.java +++ b/src/com/android/gallery3d/app/TimeLinePage.java @@ -450,7 +450,7 @@ public class TimeLinePage extends ActivityState implements setLoadingBit(BIT_LOADING_RELOAD); if (null != mMediaSet) { //set to show timeline title - mMediaSet.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_TIME_TITLE); + mMediaSet.setShowAlbumsetTimeTitle(true); } mLoadingFailed = false; mAlbumDataAdapter.resume(); diff --git a/src/com/android/gallery3d/data/ClusterAlbum.java b/src/com/android/gallery3d/data/ClusterAlbum.java index 4e2cc18ea..df88c48d9 100644..100755 --- a/src/com/android/gallery3d/data/ClusterAlbum.java +++ b/src/com/android/gallery3d/data/ClusterAlbum.java @@ -77,7 +77,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener { @Override public int getMediaItemCount() { - if (mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) { + if (MediaSet.isShowAlbumsetTimeTitle()) { return mPaths.size()+1; } return mPaths.size(); @@ -90,22 +90,28 @@ public class ClusterAlbum extends MediaSet implements ContentListener { public void setImageItemCount(int count) { mImageCount = count; - if (mTimelineTitleMediaItem != null && mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) { + if (mTimelineTitleMediaItem != null && MediaSet.isShowAlbumsetTimeTitle()) { mTimelineTitleMediaItem.setImageCount(count); } } public void setVideoItemCount(int count) { mVideoCount = count; - if (mTimelineTitleMediaItem != null && mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) { + if (mTimelineTitleMediaItem != null && MediaSet.isShowAlbumsetTimeTitle()) { mTimelineTitleMediaItem.setVideoCount(count); } } + private void updateItemCounts() { + setImageItemCount(mImageCount); + setVideoItemCount(mVideoCount); + } + @Override public ArrayList<MediaItem> getMediaItem(int start, int count) { //return getMediaItemFromPath(mPaths, start, count, mDataManager); - if (mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) { + updateItemCounts(); + if (MediaSet.isShowAlbumsetTimeTitle()) { if (mPaths.size() <= 0) return null; if (start == 0) { ArrayList<MediaItem> mediaItemList = new ArrayList<MediaItem>(); @@ -163,7 +169,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener { @Override public int getTotalMediaItemCount() { - if (mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) { + if (MediaSet.isShowAlbumsetTimeTitle()) { return mPaths.size()+1; } return mPaths.size(); @@ -172,7 +178,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener { @Override public int getMediaType() { // return correct type of Timeline Title. - if (mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) { + if (MediaSet.isShowAlbumsetTimeTitle()) { return MEDIA_TYPE_TIMELINE_TITLE; } return super.getMediaType(); @@ -203,7 +209,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener { @Override public int getSupportedOperations() { // Timeline title item doesn't support anything, just its sub objects supported. - if (mKind == ClusterSource.CLUSTER_ALBUMSET_TIME) { + if (MediaSet.isShowAlbumsetTimeTitle()) { return 0; } return SUPPORT_SHARE | SUPPORT_DELETE | SUPPORT_INFO; @@ -232,15 +238,4 @@ public class ClusterAlbum extends MediaSet implements ContentListener { return mTimelineTitleMediaItem; } - public void setClusterKind(int kind) { - if (mKind == kind) { - return; - } - mKind = kind; - refreshImageItemCount(); - } - - private void refreshImageItemCount() { - setImageItemCount(mImageCount); - } } diff --git a/src/com/android/gallery3d/data/FilterDeleteSet.java b/src/com/android/gallery3d/data/FilterDeleteSet.java index 799ea0e16..d0b5b0a90 100644..100755 --- a/src/com/android/gallery3d/data/FilterDeleteSet.java +++ b/src/com/android/gallery3d/data/FilterDeleteSet.java @@ -275,7 +275,4 @@ public class FilterDeleteSet extends MediaSet implements ContentListener { return mCurrent.size(); } - public void setClusterKind(int kind) { - mBaseSet.setClusterKind(kind); - } } diff --git a/src/com/android/gallery3d/data/MediaSet.java b/src/com/android/gallery3d/data/MediaSet.java index d0f0ec3c4..9d0233ef0 100644..100755 --- a/src/com/android/gallery3d/data/MediaSet.java +++ b/src/com/android/gallery3d/data/MediaSet.java @@ -385,5 +385,23 @@ public abstract class MediaSet extends MediaObject { } } - public void setClusterKind(int kind){}; + private static boolean sShowTitle = true; + + /** + * add for TimelinePage + * @param showTitle + * true: in TimelinePage we need show TimeTitle + * false: we don't need TimeTitle + */ + public static void setShowAlbumsetTimeTitle(boolean showTitle) { + sShowTitle = showTitle; + } + + /** + * @return true: in TimelinePage we need show TimeTitle + * false: we don't need TimeTitle + */ + public static boolean isShowAlbumsetTimeTitle() { + return sShowTitle; + } } |