Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 842257ca authored by Nicolas Roard's avatar Nicolas Roard Committed by Android Git Automerger
Browse files

am d3aebee7: Merge "Support XMP data, fixed read file on another thread" into gb-ub-photos-arches

* commit 'd3aebee7':
  Support XMP data, fixed read file on another thread
parents 413c7109 d3aebee7
Loading
Loading
Loading
Loading
+44 −6
Original line number Diff line number Diff line
@@ -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,14 +369,15 @@ public class FilterShowActivity extends Activity implements OnItemClickListener,
        if (data != null) {
            Uri uri = Uri.parse(data);
            mImageLoader.loadBitmap(uri, getScreenImageSize());
        } else {
            pickImage();
        }

            View tinyPlanetView = listColors.findViewById(R.id.tinyplanetButton);

        if (tinyPlanetView != null && !mImageLoader.isLightCycle360()) {
            if (tinyPlanetView != null) {
                tinyPlanetView.setVisibility(View.GONE);
                mCheckFor360 = new LightCycleChecker(tinyPlanetView);
                mCheckFor360.execute();
            }
        } else {
            pickImage();
        }

        String action = intent.getAction();
@@ -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();
+2 −4
Original line number Diff line number Diff line
@@ -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);