diff options
author | Nicolas Roard <nicolasroard@google.com> | 2012-10-23 19:40:46 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-23 19:40:46 -0700 |
commit | 63bf92dd121514abdaca9f8cac106bcbcfeb010d (patch) | |
tree | 4a475a41c0c80b5dd6d142213be9dcb10995c08a | |
parent | 3e23efc9cd3db42561f6b241c79c6d80aae53507 (diff) | |
parent | bc219f73dd60001c5ad035fab917cb5e2243093d (diff) | |
download | android_packages_apps_Snap-63bf92dd121514abdaca9f8cac106bcbcfeb010d.tar.gz android_packages_apps_Snap-63bf92dd121514abdaca9f8cac106bcbcfeb010d.tar.bz2 android_packages_apps_Snap-63bf92dd121514abdaca9f8cac106bcbcfeb010d.zip |
Merge "Support XMP data, fixed read file on another thread" into gb-ub-photos-arches
-rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 50 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/cache/ImageLoader.java | 6 |
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); |