summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-01-13 16:14:08 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-01-13 16:14:08 -0800
commitf1f83352ee6fdccac53b79872a0762269a57fe06 (patch)
tree038474293ef0aba17e9fa4aa8dbd28a618b1daab /src/com
parentf8eb04d9c75174756fb022080c3629b55c329db3 (diff)
parentb7e005543bd8c13b43624dd933a584a229dd5ea4 (diff)
downloadandroid_packages_apps_Gallery2-f1f83352ee6fdccac53b79872a0762269a57fe06.tar.gz
android_packages_apps_Gallery2-f1f83352ee6fdccac53b79872a0762269a57fe06.tar.bz2
android_packages_apps_Gallery2-f1f83352ee6fdccac53b79872a0762269a57fe06.zip
Merge "Gallery2: fix display abnormal when reload photos."
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java36
-rw-r--r--src/com/android/gallery3d/app/AlbumSetPage.java29
-rwxr-xr-xsrc/com/android/gallery3d/app/TimeLinePage.java37
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);
+ }
}
}