summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);