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();
}
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));
}
}
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;
}
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();
}
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);
}
Aggregations