diff options
| author | yongga <yongga@codeaurora.org> | 2016-01-11 18:39:11 +0800 |
|---|---|---|
| committer | yongga <yongga@codeaurora.org> | 2016-01-11 18:39:11 +0800 |
| commit | b7e005543bd8c13b43624dd933a584a229dd5ea4 (patch) | |
| tree | 0852031b11165cef9f7828fd3ae3e1e34e820655 /src/com/android | |
| parent | 24af2c506c4b7ad200669cc951c43f664228eac9 (diff) | |
| download | android_packages_apps_Gallery2-b7e005543bd8c13b43624dd933a584a229dd5ea4.tar.gz android_packages_apps_Gallery2-b7e005543bd8c13b43624dd933a584a229dd5ea4.tar.bz2 android_packages_apps_Gallery2-b7e005543bd8c13b43624dd933a584a229dd5ea4.zip | |
Gallery2: fix display abnormal when reload photos.
tvEmptyAlbum is still shown because hideEmptyAlbumToast() not called
when mAlbumDataAdapter.size() != 0.
make sure don't create a new tvEmptyAlbum when showEmptyAlbumToast(),
and call hideEmptyAlbumToast() when mAlbumDataAdapter.size() != 0.
Change-Id: I494011e54b4e150801019a3e2f9b430fb9ed999a
CRs-Fixed: 955208
Diffstat (limited to 'src/com/android')
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 36 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumSetPage.java | 29 | ||||
| -rwxr-xr-x | src/com/android/gallery3d/app/TimeLinePage.java | 37 |
3 files changed, 55 insertions, 47 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index e730c070c..2f628a978 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -848,23 +848,23 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mLoadingBits &= ~loadTaskBit; if (mLoadingBits == 0 && mIsActive) { if (mAlbumDataAdapter.size() == 0) { - if (mIsVideoScreen) - { + if (mIsVideoScreen) { mShowedEmptyToastForSelf = true; showEmptyAlbumToast(Toast.LENGTH_LONG); + } else { + Intent result = new Intent(); + result.putExtra(KEY_EMPTY_ALBUM, true); + setStateResult(Activity.RESULT_OK, result); + mActivity.getStateManager().finishState(this); } - else { - Intent result = new Intent(); - result.putExtra(KEY_EMPTY_ALBUM, true); - setStateResult(Activity.RESULT_OK, result); - mActivity.getStateManager().finishState(this); - } return; + } else { + hideEmptyAlbumToast(); } } if (mShowedEmptyToastForSelf && mIsVideoScreen) { - mShowedEmptyToastForSelf = false; - hideEmptyAlbumToast(); + mShowedEmptyToastForSelf = false; + hideEmptyAlbumToast(); } } @@ -940,26 +940,26 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } - - private void showEmptyAlbumToast(int toastLength) { + private void showEmptyAlbumToast(int toastLength) { + RelativeLayout galleryRoot = (RelativeLayout) mActivity.findViewById(R.id.gallery_root); + if (galleryRoot == null) return; + if (tvEmptyAlbum == null) { tvEmptyAlbum = new TextView(mActivity); tvEmptyAlbum.setText(R.string.tvEmptyVideos); tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); tvEmptyAlbum.setGravity(Gravity.CENTER); - tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP,20); - RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) - .findViewById(R.id.gallery_root); + tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); galleryRoot.addView(tvEmptyAlbum, lp); } + tvEmptyAlbum.setVisibility(View.VISIBLE); + } private void hideEmptyAlbumToast() { - - if (tvEmptyAlbum != null) - { + if (tvEmptyAlbum != null) { tvEmptyAlbum.setVisibility(View.GONE); } } diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index c8916fe16..97c629a8c 100644 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -249,21 +249,23 @@ public class AlbumSetPage extends ActivityState implements RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) .findViewById(R.id.gallery_root); if (galleryRoot == null) return ; - tvEmptyAlbum = new TextView(mActivity); - tvEmptyAlbum.setText(R.string.tvEmptyAlbum); - tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); - tvEmptyAlbum.setGravity(Gravity.CENTER); - tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP,20); - RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - lp.addRule(RelativeLayout.CENTER_IN_PARENT); - galleryRoot.addView(tvEmptyAlbum, lp); + if (tvEmptyAlbum == null) { + tvEmptyAlbum = new TextView(mActivity); + tvEmptyAlbum.setText(R.string.tvEmptyAlbum); + tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); + tvEmptyAlbum.setGravity(Gravity.CENTER); + tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); + RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + lp.addRule(RelativeLayout.CENTER_IN_PARENT); + galleryRoot.addView(tvEmptyAlbum, lp); + } + tvEmptyAlbum.setVisibility(View.VISIBLE); } private void hideEmptyAlbumToast() { - if (tvEmptyAlbum != null) - { + if (tvEmptyAlbum != null) { tvEmptyAlbum.setVisibility(View.GONE); } } @@ -448,6 +450,9 @@ public class AlbumSetPage extends ActivityState implements showCameraButton(); } return; + } else { + hideEmptyAlbumToast(); + hideCameraButton(); } } // Hide the empty album toast if we are in the root instance of diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java index 0954727ba..c2f406680 100755 --- a/src/com/android/gallery3d/app/TimeLinePage.java +++ b/src/com/android/gallery3d/app/TimeLinePage.java @@ -759,6 +759,8 @@ public class TimeLinePage extends ActivityState implements mShowedEmptyToastForSelf = true; showEmptyAlbumToast(Toast.LENGTH_LONG); mSlotView.invalidate(); + } else { + hideEmptyAlbumToast(); } return; } @@ -859,25 +861,26 @@ public class TimeLinePage extends ActivityState implements } private void showEmptyAlbumToast(int toastLength) { - tvEmptyAlbum = new TextView(mActivity); - tvEmptyAlbum.setText(R.string.tvEmptyAlbum); - tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); - tvEmptyAlbum.setGravity(Gravity.CENTER); - tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP,20); - RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) - .findViewById(R.id.gallery_root); - RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( - RelativeLayout.LayoutParams.WRAP_CONTENT, - RelativeLayout.LayoutParams.WRAP_CONTENT); - lp.addRule(RelativeLayout.CENTER_IN_PARENT); - galleryRoot.addView(tvEmptyAlbum, lp); + RelativeLayout galleryRoot = (RelativeLayout) mActivity.findViewById(R.id.gallery_root); + if (galleryRoot == null) return; + if (tvEmptyAlbum == null) { + tvEmptyAlbum = new TextView(mActivity); + tvEmptyAlbum.setText(R.string.tvEmptyAlbum); + tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); + tvEmptyAlbum.setGravity(Gravity.CENTER); + tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); + RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.WRAP_CONTENT, + RelativeLayout.LayoutParams.WRAP_CONTENT); + lp.addRule(RelativeLayout.CENTER_IN_PARENT); + galleryRoot.addView(tvEmptyAlbum, lp); + } + tvEmptyAlbum.setVisibility(View.VISIBLE); } private void hideEmptyAlbumToast() { - - if (tvEmptyAlbum != null) - { - tvEmptyAlbum.setVisibility(View.GONE); - } + if (tvEmptyAlbum != null) { + tvEmptyAlbum.setVisibility(View.GONE); + } } } |
