OSDN Git Service

Make sure canceling a filter does not undo previous filter.
authorSascha Haeberling <haeberling@google.com>
Thu, 9 May 2013 00:34:18 +0000 (17:34 -0700)
committerSascha Haeberling <haeberling@google.com>
Thu, 9 May 2013 00:34:18 +0000 (17:34 -0700)
  Bug: 8770921

Change-Id: I2b8e5fac980f562eaf97b231ad15612004608164

src/com/android/gallery3d/filtershow/HistoryAdapter.java

index 8d68246..7fd6c84 100644 (file)
@@ -124,21 +124,8 @@ 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;
+        insert(preset, 0);
+        updateMenuItems();
     }
 
     @Override
@@ -155,9 +142,6 @@ public class HistoryAdapter extends ArrayAdapter<ImagePreset> {
             }
             mCurrentPresetPosition = position;
             this.notifyDataSetChanged();
-            if (!canAddHistoryItem(preset)) {
-                return;
-            }
         }
         super.insert(preset, position);
         mCurrentPresetPosition = position;