use of com.android.gallery3d.filtershow.category.Action in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method fillTruePortrait.
private void fillTruePortrait() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getTruePortrait();
if (mCategoryTruePortraitAdapter != null) {
mCategoryTruePortraitAdapter.clear();
}
mCategoryTruePortraitAdapter = new CategoryAdapter(this);
for (FilterRepresentation representation : filtersRepresentations) {
if (representation.getTextId() != 0) {
representation.setName(getString(representation.getTextId()));
}
mCategoryTruePortraitAdapter.add(new Action(this, representation));
}
}
use of com.android.gallery3d.filtershow.category.Action in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method fillTrueScanner.
private void fillTrueScanner() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> trueScannerRepresentations = filtersManager.getTrueScanner();
if (mCategoryTrueScannerAdapter != null) {
mCategoryTrueScannerAdapter.clear();
}
mCategoryTrueScannerAdapter = new CategoryAdapter(this);
for (FilterRepresentation representation : trueScannerRepresentations) {
if (representation.getTextId() != 0) {
representation.setName(getString(representation.getTextId()));
}
mCategoryTrueScannerAdapter.add(new Action(this, representation));
}
}
use of com.android.gallery3d.filtershow.category.Action in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method fillEffects.
private void fillEffects() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getEffects();
if (mCategoryFiltersAdapter != null) {
mCategoryFiltersAdapter.clear();
}
mCategoryFiltersAdapter = new CategoryAdapter(this);
for (FilterRepresentation representation : filtersRepresentations) {
if (representation.getTextId() != 0) {
representation.setName(getString(representation.getTextId()));
}
mCategoryFiltersAdapter.add(new Action(this, representation));
}
}
use of com.android.gallery3d.filtershow.category.Action in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method updateVersions.
public void updateVersions() {
mCategoryVersionsAdapter.clear();
FilterUserPresetRepresentation originalRep = new FilterUserPresetRepresentation(getString(R.string.filtershow_version_original), new ImagePreset(), -1);
mCategoryVersionsAdapter.add(new Action(this, originalRep, Action.FULL_VIEW));
ImagePreset current = new ImagePreset(MasterImage.getImage().getPreset());
FilterUserPresetRepresentation currentRep = new FilterUserPresetRepresentation(getString(R.string.filtershow_version_current), current, -1);
mCategoryVersionsAdapter.add(new Action(this, currentRep, Action.FULL_VIEW));
if (mVersions.size() > 0) {
mCategoryVersionsAdapter.add(new Action(this, Action.SPACER));
}
for (FilterUserPresetRepresentation rep : mVersions) {
mCategoryVersionsAdapter.add(new Action(this, rep, Action.FULL_VIEW, true));
}
mCategoryVersionsAdapter.notifyDataSetInvalidated();
}
use of com.android.gallery3d.filtershow.category.Action in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method handlePreset.
public void handlePreset(Action action, View view, int i) {
mChangeable = true;
mHandledSwipeView = view;
final Action ac = action;
mFilterPresetSource = new FilterPresetSource(this);
switch(i) {
case R.id.renameButton:
final View layout = View.inflate(this, R.layout.filtershow_default_edittext, null);
AlertDialog.Builder renameAlertDialogBuilder = new AlertDialog.Builder(this);
renameAlertDialogBuilder.setTitle(R.string.rename_before_exit);
renameAlertDialogBuilder.setView(layout);
renameAlertDialogBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
EditText mEditText = (EditText) layout.findViewById(R.id.filtershow_default_edit);
String name = String.valueOf(mEditText.getText());
if ((name.trim().length() == 0) || name.isEmpty()) {
Toast.makeText(getApplicationContext(), getString(R.string.filter_name_notification), Toast.LENGTH_SHORT).show();
} else if (isDuplicateName(name)) {
Toast.makeText(getApplicationContext(), getString(R.string.filter_name_duplicate), Toast.LENGTH_SHORT).show();
} else {
renamePreset(ac, name);
}
dialog.dismiss();
}
});
renameAlertDialogBuilder.setNegativeButton(mCancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
});
renameAlertDialogBuilder.create().show();
break;
case R.id.deleteButton:
String name = action.getName();
AlertDialog.Builder deleteAlertDialogBuilder = new AlertDialog.Builder(this);
String textview = "Do you want to delete " + name + "?";
deleteAlertDialogBuilder.setMessage(textview).setTitle(R.string.delete_before_exit);
deleteAlertDialogBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
((SwipableView) mHandledSwipeView).delete();
dialog.dismiss();
}
});
deleteAlertDialogBuilder.setNegativeButton(mCancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
deleteAlertDialogBuilder.create().show();
break;
}
}
Aggregations