use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method useFilterRepresentation.
public void useFilterRepresentation(FilterRepresentation filterRepresentation) {
if (filterRepresentation == null) {
return;
}
if (!(filterRepresentation instanceof FilterRotateRepresentation) && !(filterRepresentation instanceof FilterMirrorRepresentation) && MasterImage.getImage().getCurrentFilterRepresentation() == filterRepresentation) {
return;
}
if (filterRepresentation.getFilterType() == FilterWatermarkRepresentation.TYPE_WATERMARK_CATEGORY) {
return;
}
boolean addToHistory = filterRepresentation.getFilterType() != FilterWatermarkRepresentation.TYPE_WATERMARK;
if (filterRepresentation instanceof FilterUserPresetRepresentation || filterRepresentation instanceof FilterRotateRepresentation || filterRepresentation instanceof FilterMirrorRepresentation) {
MasterImage.getImage().onNewLook(filterRepresentation);
}
ImagePreset oldPreset = MasterImage.getImage().getPreset();
ImagePreset copy = new ImagePreset(oldPreset);
FilterRepresentation representation = copy.getRepresentation(filterRepresentation);
if (representation == null) {
filterRepresentation = filterRepresentation.copy();
copy.addFilter(filterRepresentation);
} else {
if (filterRepresentation.allowsSingleInstanceOnly()) {
// null.
if (!representation.equals(filterRepresentation)) {
// Only do this if the filter isn't the same
// (state panel clicks can lead us here)
copy.removeFilter(representation);
copy.addFilter(filterRepresentation);
}
}
}
MasterImage.getImage().setPreset(copy, filterRepresentation, addToHistory);
MasterImage.getImage().setCurrentFilterRepresentation(filterRepresentation);
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method fillWaterMarks.
private void fillWaterMarks() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<ArrayList<FilterRepresentation>> filters = new ArrayList<>();
filters.add(filtersManager.getWaterMarks());
filters.add(filtersManager.getLocations());
filters.add(filtersManager.getTimes());
filters.add(filtersManager.getWeathers());
filters.add(filtersManager.getEmotions());
filters.add(filtersManager.getFoods());
if (mCategoryWatermarkAdapters != null) {
mCategoryWatermarkAdapters.clear();
}
mCategoryWatermarkAdapters = new ArrayList<>();
for (int i = 0; i < filters.size(); i++) {
mCategoryWatermarkAdapters.add(new CategoryAdapter(this));
for (FilterRepresentation representation : filters.get(i)) {
mCategoryWatermarkAdapters.get(i).add(new Action(this, representation));
}
}
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method fillTools.
private void fillTools() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getTools();
if (mCategoryGeometryAdapter != null) {
mCategoryGeometryAdapter.clear();
}
mCategoryGeometryAdapter = new CategoryAdapter(this);
for (FilterRepresentation representation : filtersRepresentations) {
mCategoryGeometryAdapter.add(new Action(this, representation));
}
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method removeFilterRepresentation.
public void removeFilterRepresentation(FilterRepresentation filterRepresentation) {
if (filterRepresentation == null) {
return;
}
ImagePreset oldPreset = MasterImage.getImage().getPreset();
ImagePreset copy = new ImagePreset(oldPreset);
copy.removeFilter(filterRepresentation);
MasterImage.getImage().setPreset(copy, copy.getLastRepresentation(), true);
if (MasterImage.getImage().getCurrentFilterRepresentation() == filterRepresentation) {
FilterRepresentation lastRepresentation = copy.getLastRepresentation();
MasterImage.getImage().setCurrentFilterRepresentation(lastRepresentation);
}
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method fillHazeBuster.
private void fillHazeBuster() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> hazeBusterRepresentations = filtersManager.getHazeBuster();
if (mCategoryHazeBusterAdapter != null) {
mCategoryHazeBusterAdapter.clear();
}
mCategoryHazeBusterAdapter = new CategoryAdapter(this);
for (FilterRepresentation representation : hazeBusterRepresentations) {
if (representation.getTextId() != 0) {
representation.setName(getString(representation.getTextId()));
}
mCategoryHazeBusterAdapter.add(new Action(this, representation));
}
}
Aggregations