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

Commit 8f442fae authored by nicolasroard's avatar nicolasroard
Browse files

Fix problem with N-1 caching when no filters / one filter

- also fix equals() for geometry

Change-Id: I6f6f21d1e274b3b95ac4b5189b2fa7f419912864
parent 086b6031
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -127,7 +127,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL


    private static final int SELECT_PICTURE = 1;
    private static final int SELECT_PICTURE = 1;
    private static final String LOGTAG = "FilterShowActivity";
    private static final String LOGTAG = "FilterShowActivity";
    protected static final boolean ANIMATE_PANELS = true;


    private boolean mShowingTinyPlanet = false;
    private boolean mShowingTinyPlanet = false;
    private boolean mShowingImageStatePanel = false;
    private boolean mShowingImageStatePanel = false;
@@ -142,7 +141,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
    private WeakReference<ProgressDialog> mSavingProgressDialog;
    private WeakReference<ProgressDialog> mSavingProgressDialog;


    private LoadBitmapTask mLoadBitmapTask;
    private LoadBitmapTask mLoadBitmapTask;
    private boolean mLoading = true;


    private Uri mOriginalImageUri = null;
    private Uri mOriginalImageUri = null;
    private ImagePreset mOriginalPreset = null;
    private ImagePreset mOriginalPreset = null;
@@ -420,7 +418,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
    }
    }


    private void startLoadBitmap(Uri uri) {
    private void startLoadBitmap(Uri uri) {
        mLoading = true;
        final View loading = findViewById(R.id.loading);
        final View loading = findViewById(R.id.loading);
        final View imageShow = findViewById(R.id.imageShow);
        final View imageShow = findViewById(R.id.imageShow);
        imageShow.setVisibility(View.INVISIBLE);
        imageShow.setVisibility(View.INVISIBLE);
@@ -653,7 +650,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
            if (mAction == TINY_PLANET_ACTION) {
            if (mAction == TINY_PLANET_ACTION) {
                showRepresentation(mCategoryFiltersAdapter.getTinyPlanet());
                showRepresentation(mCategoryFiltersAdapter.getTinyPlanet());
            }
            }
            mLoading = false;

            MasterImage.getImage().notifyGeometryChange();
            MasterImage.getImage().notifyGeometryChange();
            LoadHighresBitmapTask highresLoad = new LoadHighresBitmapTask();
            LoadHighresBitmapTask highresLoad = new LoadHighresBitmapTask();
            highresLoad.execute();
            highresLoad.execute();
+19 −0
Original line number Original line Diff line number Diff line
@@ -60,6 +60,25 @@ public class FilterCropRepresentation extends FilterRepresentation {
        mImage.set(r.mImage);
        mImage.set(r.mImage);
    }
    }


    @Override
    public boolean equals(FilterRepresentation rep) {
        if (!(rep instanceof FilterCropRepresentation)) {
            return false;
        }
        FilterCropRepresentation crop = (FilterCropRepresentation) rep;
        if (mCrop.bottom != crop.mCrop.bottom
            || mCrop.left != crop.mCrop.left
            || mCrop.right != crop.mCrop.right
            || mCrop.top != crop.mCrop.top
            || mImage.bottom != crop.mImage.bottom
            || mImage.left != crop.mImage.left
            || mImage.right != crop.mImage.right
            || mImage.top != crop.mImage.top) {
            return false;
        }
        return true;
    }

    public RectF getCrop() {
    public RectF getCrop() {
        return new RectF(mCrop);
        return new RectF(mCrop);
    }
    }
+12 −0
Original line number Original line Diff line number Diff line
@@ -79,6 +79,18 @@ public class FilterMirrorRepresentation extends FilterRepresentation {
        this(Mirror.NONE);
        this(Mirror.NONE);
    }
    }


    @Override
    public boolean equals(FilterRepresentation rep) {
        if (!(rep instanceof FilterMirrorRepresentation)) {
            return false;
        }
        FilterMirrorRepresentation mirror = (FilterMirrorRepresentation) rep;
        if (mirror.mMirror.value() != mirror.mMirror.value()) {
            return false;
        }
        return true;
    }

    public Mirror getMirror() {
    public Mirror getMirror() {
        return mMirror;
        return mMirror;
    }
    }
+12 −0
Original line number Original line Diff line number Diff line
@@ -133,6 +133,18 @@ public class FilterRotateRepresentation extends FilterRepresentation {
        writer.endObject();
        writer.endObject();
    }
    }


    @Override
    public boolean equals(FilterRepresentation rep) {
        if (!(rep instanceof FilterRotateRepresentation)) {
            return false;
        }
        FilterRotateRepresentation rotate = (FilterRotateRepresentation) rep;
        if (rotate.mRotation.value() != mRotation.value()) {
            return false;
        }
        return true;
    }

    @Override
    @Override
    public void deSerializeRepresentation(JsonReader reader) throws IOException {
    public void deSerializeRepresentation(JsonReader reader) throws IOException {
        boolean unset = true;
        boolean unset = true;
+12 −0
Original line number Original line Diff line number Diff line
@@ -55,6 +55,18 @@ public class FilterStraightenRepresentation extends FilterRepresentation {
        mStraighten = r.mStraighten;
        mStraighten = r.mStraighten;
    }
    }


    @Override
    public boolean equals(FilterRepresentation rep) {
        if (!(rep instanceof FilterStraightenRepresentation)) {
            return false;
        }
        FilterStraightenRepresentation straighten = (FilterStraightenRepresentation) rep;
        if (straighten.mStraighten != mStraighten) {
            return false;
        }
        return true;
    }

    public float getStraighten() {
    public float getStraighten() {
        return mStraighten;
        return mStraighten;
    }
    }
Loading