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

Commit d88683e3 authored by Ruben Brunk's avatar Ruben Brunk
Browse files

Change panels organization. Also fixes border updates handling.

Change-Id: If96754e821b1e80238d2a04e65f1b57ee9683efe
parent ce9ca226
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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
    }
+28 −11
Original line number Diff line number Diff line
@@ -117,16 +117,25 @@ public class ImagePreset {
        if (filterRepresentation == null) {
            return null;
        }
        FilterRepresentation representation = null;
        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;
            }
        FilterRepresentation representation = null;
            representation = mFilters.elementAt(position);
        }
        if (representation != null) {
            try {
            representation = mFilters.elementAt(position).clone();
                representation = representation.clone();
            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
            }
        }
        return representation;
    }

@@ -137,12 +146,20 @@ public class ImagePreset {
        synchronized (mFilters) {
            if (representation instanceof GeometryMetadata) {
                setGeometry((GeometryMetadata) representation);
            } else {
                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();
        fillImageStateAdapter(MasterImage.getImage().getState());
    }