diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2013-04-02 00:00:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-04-02 00:00:01 +0000 |
commit | bc0df4d0c02d701c57e6dcd3d4ad1d1977efc0e3 (patch) | |
tree | 436377bda1da01d01eb189d71e638f730006145e /src | |
parent | 461159a112fb3fa098962bd384ff1ca72e463045 (diff) | |
parent | b71ec3a67d425fb44621fe75086fec3bcc33eae7 (diff) | |
download | android_packages_apps_Snap-bc0df4d0c02d701c57e6dcd3d4ad1d1977efc0e3.tar.gz android_packages_apps_Snap-bc0df4d0c02d701c57e6dcd3d4ad1d1977efc0e3.tar.bz2 android_packages_apps_Snap-bc0df4d0c02d701c57e6dcd3d4ad1d1977efc0e3.zip |
Merge "Change panels organization. Also fixes border updates handling." into gb-ub-photos-bryce
Diffstat (limited to 'src')
3 files changed, 40 insertions, 12 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 8c5d7a4a6..3cd4262fa 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -402,7 +402,15 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, private void setupBorders() { LinearLayout list = (LinearLayout) findViewById(R.id.listBorders); Vector<FilterRepresentation> borders = new Vector<FilterRepresentation>(); + ImageButton borderButton = (ImageButton) findViewById(R.id.borderButton); + + // The "no border" implementation borders.add(new FilterImageBorderRepresentation(0)); + + // Google-build borders + FiltersManager.getManager().addBorders(borders); + + // Regular borders borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_4x5)); borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_brush)); borders.add(new FilterImageBorderRepresentation(R.drawable.filtershow_border_grunge)); @@ -424,7 +432,6 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, if (i == 0) { filter.setName(getString(R.string.none)); } - ImageButton borderButton = (ImageButton) findViewById(R.id.borderButton); FilterIconButton b = setupFilterRepresentationButton(filter, list, borderButton); if (i == 0) { mNullBorderFilter = b; diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java index b5c4de048..232de6460 100644 --- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java +++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java @@ -108,6 +108,10 @@ public abstract class BaseFiltersManager { filters.add(ImageFilterGeometry.class); } + public void addBorders(Vector<FilterRepresentation> representations) { + // Override + } + public void addLooks(Vector<FilterRepresentation> representations) { // Override } diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java index b2dd6b711..a35a18a7d 100644 --- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java @@ -117,15 +117,24 @@ public class ImagePreset { if (filterRepresentation == null) { return null; } - int position = getPositionForRepresentation(filterRepresentation); - if (position == -1) { - return null; - } FilterRepresentation representation = null; - try { - representation = mFilters.elementAt(position).clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); + if ((mBorder != null) + && (mBorder.getFilterClass() == filterRepresentation.getFilterClass())) { + // TODO: instead of special casing for border, we should correctly implements "filters priority set" + representation = mBorder; + } else { + int position = getPositionForRepresentation(filterRepresentation); + if (position == -1) { + return null; + } + representation = mFilters.elementAt(position); + } + if (representation != null) { + try { + representation = representation.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } } return representation; } @@ -138,9 +147,17 @@ public class ImagePreset { if (representation instanceof GeometryMetadata) { setGeometry((GeometryMetadata) representation); } else { - int position = getPositionForRepresentation(representation); - FilterRepresentation old = mFilters.elementAt(position); - old.updateTempParametersFrom(representation); + if ((mBorder != null) + && (mBorder.getFilterClass() == representation.getFilterClass())) { + mBorder.updateTempParametersFrom(representation); + } else { + int position = getPositionForRepresentation(representation); + if (position == -1) { + return; + } + FilterRepresentation old = mFilters.elementAt(position); + old.updateTempParametersFrom(representation); + } } } MasterImage.getImage().invalidatePreview(); |