Search in sources :

Example 1 with FilterPresetRepresentation

use of com.android.gallery3d.filtershow.filters.FilterPresetRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method removePreset.

public void removePreset(Action action) {
    FilterPresetRepresentation rep = (FilterPresetRepresentation) action.getRepresentation();
    if (rep == null) {
        return;
    }
    if (tempFilterArray.size() != 0) {
        for (int i = 0; i < tempFilterArray.size(); i++) {
            if (rep.getId() == tempFilterArray.get(i)._id) {
                tempFilterArray.remove(i);
                fillLooks();
                return;
            }
        }
    }
    mFilterPresetSource.removePreset(rep.getId());
    fillLooks();
}
Also used : FilterPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterPresetRepresentation) Point(android.graphics.Point)

Example 2 with FilterPresetRepresentation

use of com.android.gallery3d.filtershow.filters.FilterPresetRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method fillPresetFilter.

private void fillPresetFilter() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getFilterPreset();
    if (mChangeable) {
        ArrayList<FilterRepresentation> mFilterPreset = new ArrayList<FilterRepresentation>();
        ArrayList<SaveOption> ret = mFilterPresetSource.getAllUserPresets();
        if (ret == null)
            return;
        for (int id = 0; id < ret.size(); id++) {
            FilterPresetRepresentation representation = new FilterPresetRepresentation(ret.get(id).name, ret.get(id)._id, id + 1);
            Uri filteredUri = Uri.parse(ret.get(id).Uri);
            representation.setUri(filteredUri);
            representation.setSerializationName("Custom");
            mFilterPreset.add(representation);
        }
        if (tempFilterArray.size() != 0) {
            for (int id = 0; id < tempFilterArray.size(); id++) {
                FilterPresetRepresentation representation = new FilterPresetRepresentation(tempFilterArray.get(id).name, tempFilterArray.get(id)._id, id + 1);
                Uri filteredUri = Uri.parse(tempFilterArray.get(id).Uri);
                representation.setUri(filteredUri);
                representation.setSerializationName("Custom");
                mFilterPreset.add(representation);
            }
        }
        filtersRepresentations = mFilterPreset;
        mChangeable = false;
    }
    if (filtersRepresentations == null)
        return;
    for (FilterRepresentation representation : filtersRepresentations) {
        mCategoryLooksAdapter.add(new Action(this, representation, Action.FULL_VIEW, true));
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) ArrayList(java.util.ArrayList) FilterPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterPresetRepresentation) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) Uri(android.net.Uri) Point(android.graphics.Point) SaveOption(com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)

Example 3 with FilterPresetRepresentation

use of com.android.gallery3d.filtershow.filters.FilterPresetRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method createUserPresentaion.

public FilterRepresentation createUserPresentaion(Uri selImg, int index) {
    FilterPresetRepresentation fp = new FilterPresetRepresentation(getString(R.string.filtershow_preset_title) + index, index, index);
    fp.setSerializationName("Custom");
    fp.setUri(selImg);
    return fp;
}
Also used : FilterPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterPresetRepresentation)

Example 4 with FilterPresetRepresentation

use of com.android.gallery3d.filtershow.filters.FilterPresetRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method renamePreset.

public void renamePreset(Action action, String name) {
    FilterPresetRepresentation rep = (FilterPresetRepresentation) action.getRepresentation();
    if (rep == null) {
        return;
    }
    if (tempFilterArray.size() != 0) {
        for (int i = 0; i < tempFilterArray.size(); i++) {
            if (rep.getId() == tempFilterArray.get(i)._id) {
                tempFilterArray.get(i).name = name;
                fillLooks();
                return;
            }
        }
    }
    mFilterPresetSource.updatePresetName(rep.getId(), name);
    fillLooks();
}
Also used : FilterPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterPresetRepresentation) Point(android.graphics.Point)

Example 5 with FilterPresetRepresentation

use of com.android.gallery3d.filtershow.filters.FilterPresetRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method onMediaPickerResult.

public void onMediaPickerResult(Uri selImg) {
    mFilterPresetSource = new FilterPresetSource(this);
    int id = nameFilter(mFilterPresetSource, tempFilterArray);
    FilterPresetRepresentation fp = new FilterPresetRepresentation(getString(R.string.filtershow_preset_title) + id, id, id);
    fp.setSerializationName("Custom");
    fp.setUri(selImg);
    ImagePreset preset = new ImagePreset();
    preset.addFilter(fp);
    SaveOption sp = new SaveOption();
    sp._id = id;
    sp.name = "Custom" + id;
    sp.Uri = selImg.toString();
    tempFilterArray.add(sp);
    FiltersManager.getManager().addRepresentation(fp);
    mCategoryLooksAdapter.add(new Action(this, fp, Action.FULL_VIEW, true));
    useFilterRepresentation(fp);
    int pos = mCategoryLooksAdapter.getPositionOfPresentation(fp);
    if (pos != -1)
        backAndSetCustomFilterSelected(pos);
}
Also used : FilterPresetSource(com.android.gallery3d.filtershow.data.FilterPresetSource) Action(com.android.gallery3d.filtershow.category.Action) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterPresetRepresentation) Point(android.graphics.Point) SaveOption(com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)

Aggregations

FilterPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterPresetRepresentation)5 Point (android.graphics.Point)4 Action (com.android.gallery3d.filtershow.category.Action)2 SaveOption (com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)2 Uri (android.net.Uri)1 FilterPresetSource (com.android.gallery3d.filtershow.data.FilterPresetSource)1 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)1 FiltersManager (com.android.gallery3d.filtershow.filters.FiltersManager)1 ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)1 ArrayList (java.util.ArrayList)1