- int type = current.getFilterType();
- if (found) {
- if (type != FilterRepresentation.TYPE_VIGNETTE) {
- mFilters.remove(i);
- continue;
- }
- }
- if (type == FilterRepresentation.TYPE_FX) {
- if (current instanceof FilterUserPresetRepresentation) {
- ImagePreset preset = ((FilterUserPresetRepresentation) current)
- .getImagePreset();
- // If we had an existing user preset, let's remove all the presets that
- // were added by it
- for (int j = 0; j < preset.nbFilters(); j++) {
- FilterRepresentation rep = preset.getFilterRepresentation(j);
- int pos = getPositionForRepresentation(rep);
- if (pos != -1) {
- mFilters.remove(pos);
- }
- }
- int pos = getPositionForRepresentation(current);
- if (pos != -1) {
- mFilters.remove(pos);
- } else {
- pos = 0;
- }
- if (!isNoneFxFilter(representation)) {
- mFilters.add(pos, representation);
- }
-
- } else {
- mFilters.remove(i);
- if (!isNoneFxFilter(representation)) {
- mFilters.add(i, representation);
- }
+ if (current.getFilterType() == FilterRepresentation.TYPE_FX) {
+ mFilters.remove(i);
+ replaced = true;
+ if (!isNoneFxFilter(representation)) {
+ mFilters.add(i, representation);