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

Commit 32646aab authored by nicolasroard's avatar nicolasroard
Browse files

Fix reset

bug:10788166
Change-Id: I989c2caef8ccf4ff7ca84545aed35941248f8034
parent 3dcb77a2
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL

    public static final String TINY_PLANET_ACTION = "com.android.camera.action.TINY_PLANET";
    public static final String LAUNCH_FULLSCREEN = "launch-fullscreen";
    public static final boolean RESET_TO_LOADED = false;
    private ImageShow mImageShow = null;

    private View mSaveButton = null;
@@ -1264,8 +1265,17 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
        HistoryManager adapter = mMasterImage.getHistory();
        adapter.reset();
        HistoryItem historyItem = adapter.getItem(0);
        ImagePreset original = new ImagePreset(historyItem.getImagePreset());
        mMasterImage.setPreset(original, historyItem.getFilterRepresentation(), true);
        ImagePreset original = null;
        if (RESET_TO_LOADED) {
            original = new ImagePreset(historyItem.getImagePreset());
        } else {
            original = new ImagePreset();
        }
        FilterRepresentation rep = null;
        if (historyItem != null) {
            rep = historyItem.getFilterRepresentation();
        }
        mMasterImage.setPreset(original, rep, true);
        invalidateViews();
        backToMain();
    }
+4 −3
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ public class HistoryManager {
    }

    public HistoryItem getItem(int position) {
        if (position > mHistoryItems.size() - 1) {
            return null;
        }
        return mHistoryItems.elementAt(position);
    }

@@ -58,7 +61,7 @@ public class HistoryManager {
    }

    public boolean canReset() {
        if (getCount() <= 1) {
        if (getCount() <= 0) {
            return false;
        }
        return true;
@@ -108,9 +111,7 @@ public class HistoryManager {
        if (getCount() == 0) {
            return;
        }
        HistoryItem first = getItem(getCount() - 1);
        clear();
        addHistoryItem(first);
        updateMenuItems();
    }