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

Commit 7af7156a authored by Sascha Haeberling's avatar Sascha Haeberling Committed by Android (Google) Code Review
Browse files

Merge "Make sure canceling a filter does not undo previous filter." into gb-ub-photos-bryce

parents 26e3c48b a60a303c
Loading
Loading
Loading
Loading
+2 −18
Original line number Diff line number Diff line
@@ -133,22 +133,9 @@ public class HistoryAdapter extends ArrayAdapter<ImagePreset> {
    }

    public void addHistoryItem(ImagePreset preset) {
        if (canAddHistoryItem(preset)) {
        insert(preset, 0);
        updateMenuItems();
    }
    }

    public boolean canAddHistoryItem(ImagePreset preset) {
        if (getCount() > 0 && getCurrent().same(preset)) {
            // we may still want to insert if the previous
            // history element isn't the same
            if (getLast().historyName().equalsIgnoreCase(preset.historyName())) {
                return false;
            }
        }
        return true;
    }

    @Override
    public void insert(ImagePreset preset, int position) {
@@ -164,9 +151,6 @@ public class HistoryAdapter extends ArrayAdapter<ImagePreset> {
            }
            mCurrentPresetPosition = position;
            this.notifyDataSetChanged();
            if (!canAddHistoryItem(preset)) {
                return;
            }
        }
        super.insert(preset, position);
        mCurrentPresetPosition = position;