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-12 17:07:41 -0700
commit28c2b3bde4084af90a4951b27f5570a7fe7c5fa9 (patch)
tree803f2d88240af16fcea9554eefd8969bcbc3bf10 /photoviewer
parent917f53e9762be3c8b2eafa58cf6ab825d2cc9c9e (diff)
downloadandroid_frameworks_ex-28c2b3bde4084af90a4951b27f5570a7fe7c5fa9.tar.gz
android_frameworks_ex-28c2b3bde4084af90a4951b27f5570a7fe7c5fa9.tar.bz2
android_frameworks_ex-28c2b3bde4084af90a4951b27f5570a7fe7c5fa9.zip
Load preview first
If the preview is available, load the it first, while waiting for the full size image to load 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: