use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method resetHistory.
void resetHistory() {
if (mMasterImage == null) {
return;
}
HistoryManager adapter = mMasterImage.getHistory();
adapter.reset();
HistoryItem historyItem = adapter.getItem(0);
ImagePreset original = null;
original = new ImagePreset();
FilterRepresentation rep = null;
if (historyItem != null) {
rep = historyItem.getFilterRepresentation();
}
mMasterImage.setPreset(original, rep, true);
mMasterImage.setFusionUnderlay(null);
mMasterImage.resetTranslation();
mMasterImage.setScaleFactor(1);
mMasterImage.setCurrentFilterRepresentation(null);
ArrayList<FilterRepresentation> frList = FiltersManager.getManager().getTools();
for (FilterRepresentation fr : frList) {
if (fr instanceof FilterRotateRepresentation) {
((FilterRotateRepresentation) fr).resetRotation();
}
}
showDefaultImageView();
showSaveButtonIfNeed();
invalidateViews();
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method fillDualCamera.
private void fillDualCamera() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getDualCamera();
if (mCategoryDualCamAdapter != null) {
mCategoryDualCamAdapter.clear();
}
mCategoryDualCamAdapter = new CategoryAdapter(this);
for (FilterRepresentation representation : filtersRepresentations) {
if (representation.getTextId() != 0) {
representation.setName(getString(representation.getTextId()));
}
mCategoryDualCamAdapter.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 fillMakeup.
private void fillMakeup() {
if (!SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
return;
}
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> makeups = filtersManager.getMakeup();
if (mCategoryMakeupAdapter != null) {
mCategoryMakeupAdapter.clear();
}
mCategoryMakeupAdapter = new CategoryAdapter(this);
for (FilterRepresentation makeup : makeups) {
if (makeup.getTextId() != 0) {
makeup.setName(getString(makeup.getTextId()));
}
mCategoryMakeupAdapter.add(new Action(this, makeup));
}
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class CategoryAdapter method reflectImagePreset.
public void reflectImagePreset(ImagePreset preset) {
if (preset == null) {
return;
}
// if nothing found, select "none" (first element)
int selected = 0;
FilterRepresentation rep = null;
if (mCategory == MainPanel.LOOKS) {
int pos = preset.getPositionForType(FilterRepresentation.TYPE_FX);
if (pos != -1) {
rep = preset.getFilterRepresentation(pos);
} else {
pos = preset.getPositionForType(FilterRepresentation.TYPE_PRESETFILTER);
if (pos != -1)
rep = preset.getFilterRepresentation(pos);
}
} else if (mCategory == MainPanel.BORDERS) {
int pos = preset.getPositionForType(FilterRepresentation.TYPE_BORDER);
if (pos != -1) {
rep = preset.getFilterRepresentation(pos);
}
} else if (mCategory == MainPanel.DUALCAM) {
int pos = preset.getPositionForType(FilterRepresentation.TYPE_DUALCAM);
if (pos != -1) {
rep = preset.getFilterRepresentation(pos);
}
} else if (mCategory == MainPanel.TRUEPORTRAIT) {
int pos = preset.getPositionForType(FilterRepresentation.TYPE_TRUEPORTRAIT);
if (pos != -1) {
rep = preset.getFilterRepresentation(pos);
}
} else if (mCategory == MainPanel.FILTERS || mCategory == MainPanel.MAKEUP) {
selected = UNKNOWN_INDEX;
}
if (rep != null) {
for (int i = 0; i < getCount(); i++) {
FilterRepresentation itemRep = getItem(i).getRepresentation();
if (itemRep == null) {
continue;
}
if (rep.getName().equalsIgnoreCase(itemRep.getName())) {
selected = i;
break;
}
}
}
if (mSelectedPosition != selected) {
mSelectedPosition = selected;
this.notifyDataSetChanged();
}
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class StatePanelTrack method checkEndState.
public void checkEndState() {
mTouchPoint = null;
mTouchTime = 0;
if (mExited || mCurrentView.getBackgroundAlpha() < mDeleteSlope) {
int origin = findChild(mCurrentView);
if (origin != -1) {
State current = mAdapter.getItem(origin);
FilterRepresentation currentRep = MasterImage.getImage().getCurrentFilterRepresentation();
FilterRepresentation removedRep = current.getFilterRepresentation();
mAdapter.remove(current);
fillContent(true);
if (currentRep != null && removedRep != null && currentRep.getFilterClass() == removedRep.getFilterClass()) {
FilterShowActivity activity = (FilterShowActivity) getContext();
activity.backToMain();
return;
}
}
} else {
mCurrentView.setBackgroundAlpha(1.0f);
mCurrentView.setTranslationX(0);
mCurrentView.setTranslationY(0);
}
if (mCurrentSelectedView != null) {
mCurrentSelectedView.invalidate();
}
if (mCurrentView != null) {
mCurrentView.invalidate();
}
mCurrentView = null;
mExited = false;
mStartedDrag = false;
}
Aggregations