use of com.android.gallery3d.filtershow.data.FilterPresetSource 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;
}
}
use of com.android.gallery3d.filtershow.data.FilterPresetSource 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);
}
use of com.android.gallery3d.filtershow.data.FilterPresetSource in project android_packages_apps_Gallery2 by LineageOS.
the class BaseFiltersManager method addFilterPreset.
public void addFilterPreset(Context context) {
FilterPresetSource fp = new FilterPresetSource(context);
ArrayList<SaveOption> ret = fp.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);
ImagePreset preset = new ImagePreset();
preset.addFilter(representation);
addRepresentation(representation);
}
}
Aggregations