summaryrefslogtreecommitdiffstats
path: root/photoviewer
diff options
context:
space:
mode:
authorPaul Westbrook <pwestbro@google.com>2012-10-12 17:05:23 -0700
committerPaul Westbrook <pwestbro@google.com>2012-10-13 16:11:25 -0700
commit14a4df6f91f3563ab956ed1730bdbf4e6976e5cd (patch)
treea2972e7fb778f9aeb032ec27c41a42db9524c66a /photoviewer
parentda4cfeec8ee8863089da547a643393ab3520f5d8 (diff)
downloadandroid_frameworks_ex-14a4df6f91f3563ab956ed1730bdbf4e6976e5cd.tar.gz
android_frameworks_ex-14a4df6f91f3563ab956ed1730bdbf4e6976e5cd.tar.bz2
android_frameworks_ex-14a4df6f91f3563ab956ed1730bdbf4e6976e5cd.zip
Load preview first
If the preview is available, load the it first, while waiting for the full size image to load Cherry-pick of https://googleplex-android-review.googlesource.com/#/c/238893/ Bug: 7340082 Bug: 7298245 Change-Id: I64934001d832844a776f8d9c1f2abcece552f79c
Diffstat (limited to 'photoviewer')
-rw-r--r--photoviewer/src/com/android/ex/photo/fragments/PhotoViewFragment.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/photoviewer/src/com/android/ex/photo/fragments/PhotoViewFragment.java b/photoviewer/src/com/android/ex/photo/fragments/PhotoViewFragment.java
index 8e47737..2e99bd8 100644
--- a/photoviewer/src/com/android/ex/photo/fragments/PhotoViewFragment.java
+++ b/photoviewer/src/com/android/ex/photo/fragments/PhotoViewFragment.java
@@ -209,7 +209,7 @@ public class PhotoViewFragment extends Fragment implements
mCallback.addScreenListener(this);
mCallback.addCursorListener(this);
- getLoaderManager().initLoader(LOADER_ID_PHOTO, null, this);
+ getLoaderManager().initLoader(LOADER_ID_THUMBNAIL, null, this);
super.onResume();
}
@@ -269,10 +269,6 @@ public class PhotoViewFragment extends Fragment implements
bindPhoto(data);
mPhotoPreviewAndProgress.setVisibility(View.GONE);
mProgressBarNeeded = false;
- } else {
- // Received a null result for the full size image. Instead attempt to load the
- // thumbnail
- getLoaderManager().initLoader(LOADER_ID_THUMBNAIL, null, this);
}
break;
case LOADER_ID_THUMBNAIL:
@@ -282,18 +278,20 @@ public class PhotoViewFragment extends Fragment implements
mPhotoPreviewAndProgress.setVisibility(View.GONE);
mProgressBarNeeded = false;
return;
- } else if (data == null) {
- // no preview, show default
- mPhotoPreviewImage.setVisibility(View.VISIBLE);
- mPhotoPreviewImage.setImageResource(R.drawable.default_image);
- mPhotoPreviewImage.setScaleType(ImageView.ScaleType.CENTER);
-
- mProgressBarNeeded = false;
} else {
+ // Make the preview image view visible
mPhotoPreviewImage.setVisibility(View.VISIBLE);
- mPhotoPreviewImage.setImageBitmap(data);
- mProgressBarNeeded = false;
+ if (data == null) {
+ // no preview, show default
+ mPhotoPreviewImage.setImageResource(R.drawable.default_image);
+ mPhotoPreviewImage.setScaleType(ImageView.ScaleType.CENTER);
+ } else {
+ // Show the preview
+ mPhotoPreviewImage.setImageBitmap(data);
+ }
+ // Now load the full size image
+ getLoaderManager().initLoader(LOADER_ID_PHOTO, null, this);
}
break;
default: