Search in sources :

Example 1 with Action

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));
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) CategoryAdapter(com.android.gallery3d.filtershow.category.CategoryAdapter) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 2 with Action

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));
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) CategoryAdapter(com.android.gallery3d.filtershow.category.CategoryAdapter) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 3 with Action

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));
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) CategoryAdapter(com.android.gallery3d.filtershow.category.CategoryAdapter) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 4 with Action

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();
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterUserPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)

Example 5 with Action

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;
    }
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) Action(com.android.gallery3d.filtershow.category.Action) FilterPresetSource(com.android.gallery3d.filtershow.data.FilterPresetSource) DialogInterface(android.content.DialogInterface) CategoryView(com.android.gallery3d.filtershow.category.CategoryView) SwipableView(com.android.gallery3d.filtershow.category.SwipableView) WaterMarkView(com.android.gallery3d.filtershow.category.WaterMarkView) View(android.view.View) AdapterView(android.widget.AdapterView) Point(android.graphics.Point)

Aggregations

Action (com.android.gallery3d.filtershow.category.Action)20 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)12 FiltersManager (com.android.gallery3d.filtershow.filters.FiltersManager)12 CategoryAdapter (com.android.gallery3d.filtershow.category.CategoryAdapter)11 Point (android.graphics.Point)8 Rect (android.graphics.Rect)2 FilterPresetSource (com.android.gallery3d.filtershow.data.FilterPresetSource)2 SaveOption (com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)2 FilterPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterPresetRepresentation)2 FilterUserPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)2 ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)2 ArrayList (java.util.ArrayList)2 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 Uri (android.net.Uri)1 DialogFragment (android.support.v4.app.DialogFragment)1 Fragment (android.support.v4.app.Fragment)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 EditText (android.widget.EditText)1