summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-10-23 19:43:39 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-23 19:43:39 -0700
commit8c1c1fca54b3949c945f66980426b21f6173a155 (patch)
treea38df61c0be20e5779fc2d33e8ce00ef557a25fd
parentebef2f0ad3d49849040f2c23ff9e69753791258e (diff)
parent63bf92dd121514abdaca9f8cac106bcbcfeb010d (diff)
downloadandroid_packages_apps_Snap-8c1c1fca54b3949c945f66980426b21f6173a155.tar.gz
android_packages_apps_Snap-8c1c1fca54b3949c945f66980426b21f6173a155.tar.bz2
android_packages_apps_Snap-8c1c1fca54b3949c945f66980426b21f6173a155.zip
am d3aebee7: Merge "Support XMP data, fixed read file on another thread" into gb-ub-photos-arches
* commit 'd3aebee7b35ff969fce3607a5c051d607ca42ec7': Support XMP data, fixed read file on another thread
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java50
-rw-r--r--src/com/android/gallery3d/filtershow/cache/ImageLoader.java6
2 files changed, 46 insertions, 10 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 1d8502f0b..efcb2c3c3 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -30,6 +30,7 @@ import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.os.AsyncTask;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -140,6 +141,8 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
private WeakReference<ProgressDialog> mSavingProgressDialog;
private static final int SEEK_BAR_MAX = 600;
+ private LightCycleChecker mCheckFor360;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -366,16 +369,17 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
if (data != null) {
Uri uri = Uri.parse(data);
mImageLoader.loadBitmap(uri, getScreenImageSize());
+
+ View tinyPlanetView = listColors.findViewById(R.id.tinyplanetButton);
+ if (tinyPlanetView != null) {
+ tinyPlanetView.setVisibility(View.GONE);
+ mCheckFor360 = new LightCycleChecker(tinyPlanetView);
+ mCheckFor360.execute();
+ }
} else {
pickImage();
}
- View tinyPlanetView = listColors.findViewById(R.id.tinyplanetButton);
-
- if (tinyPlanetView != null && !mImageLoader.isLightCycle360()) {
- tinyPlanetView.setVisibility(View.GONE);
- }
-
String action = intent.getAction();
if (action.equalsIgnoreCase(CROP_ACTION)) {
mPanelController.showComponent(findViewById(R.id.cropButton));
@@ -384,6 +388,40 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
}
}
+ private class LightCycleChecker extends AsyncTask<Void, Void, Boolean> {
+ View mTinyPlanetButton;
+
+ public LightCycleChecker(View button) {
+ mTinyPlanetButton = button;
+ }
+
+ @Override
+ protected Boolean doInBackground(Void... params) {
+ return mImageLoader.queryLightCycle360();
+ }
+
+ @Override
+ protected void onPostExecute(Boolean result) {
+ if (isCancelled()) {
+ return;
+ }
+ if (result) {
+ mTinyPlanetButton.setVisibility(View.VISIBLE);
+ }
+ mCheckFor360 = null;
+ super.onPostExecute(result);
+ }
+
+ }
+
+ @Override
+ protected void onDestroy() {
+ if (mCheckFor360 != null) {
+ mCheckFor360.cancel(false);
+ }
+ super.onDestroy();
+ }
+
private int translateMainPanel(View viewPanel) {
int accessoryPanelWidth = viewPanel.getWidth();
int mainViewWidth = findViewById(R.id.mainView).getWidth();
diff --git a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
index a8ad6800f..138e8f722 100644
--- a/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
+++ b/src/com/android/gallery3d/filtershow/cache/ImageLoader.java
@@ -32,10 +32,8 @@ import android.provider.MediaStore;
import android.util.Log;
import com.adobe.xmp.XMPException;
-import com.adobe.xmp.XMPIterator;
import com.adobe.xmp.XMPMeta;
-import com.adobe.xmp.properties.XMPProperty;
-import com.adobe.xmp.properties.XMPPropertyInfo;
+
import com.android.gallery3d.R;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.filtershow.FilterShowActivity;
@@ -400,7 +398,7 @@ public class ImageLoader {
*
* @return true if it is a light Cycle image that is full 360
*/
- public boolean isLightCycle360() {
+ public boolean queryLightCycle360() {
try {
InputStream is = mContext.getContentResolver().openInputStream(getUri());
XMPMeta meta = XmpUtilHelper.extractXMPMeta(is);