Search in sources :

Example 16 with Action

use of com.android.gallery3d.filtershow.category.Action 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);
}
Also used : FilterPresetSource(com.android.gallery3d.filtershow.data.FilterPresetSource) Action(com.android.gallery3d.filtershow.category.Action) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterPresetRepresentation) Point(android.graphics.Point) SaveOption(com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)

Example 17 with Action

use of com.android.gallery3d.filtershow.category.Action 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));
    }
}
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 18 with Action

use of com.android.gallery3d.filtershow.category.Action 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));
    }
}
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 19 with Action

use of com.android.gallery3d.filtershow.category.Action in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method updateUserPresetsFromManager.

public void updateUserPresetsFromManager() {
    ArrayList<FilterUserPresetRepresentation> presets = mUserPresetsManager.getRepresentations();
    if (presets == null) {
        return;
    }
    if (mCategoryLooksAdapter != null) {
        fillLooks();
    }
    /*  if (presets.size() > 0) {
            mCategoryLooksAdapter.add(new Action(this, Action.SPACER));
        } */
    mUserPresetsAdapter.clear();
    if (presets.size() > 0) {
        mCategoryLooksAdapter.add(new Action(this, Action.ADD_ACTION));
    }
    for (int i = 0; i < presets.size(); i++) {
        FilterUserPresetRepresentation representation = presets.get(i);
        mCategoryLooksAdapter.add(new Action(this, representation, Action.FULL_VIEW, true));
        mUserPresetsAdapter.add(new Action(this, representation, Action.FULL_VIEW));
    }
    mCategoryLooksAdapter.notifyDataSetChanged();
    mCategoryLooksAdapter.notifyDataSetInvalidated();
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) FilterUserPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation) Point(android.graphics.Point)

Example 20 with Action

use of com.android.gallery3d.filtershow.category.Action in project android_packages_apps_Gallery2 by LineageOS.

the class UserPresetsAdapter method onClick.

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.editView:
            v.requestFocus();
            break;
        case R.id.deleteUserPreset:
            Action action = (Action) v.getTag();
            deletePreset(action);
            break;
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action)

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