Search in sources :

Example 6 with Action

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

the class FilterShowActivity method fillSeeStraight.

private void fillSeeStraight() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<FilterRepresentation> hazeBusterRepresentations = filtersManager.getSeeStraight();
    if (mCategorySeeStraightAdapter != null) {
        mCategorySeeStraightAdapter.clear();
    }
    mCategorySeeStraightAdapter = new CategoryAdapter(this);
    for (FilterRepresentation representation : hazeBusterRepresentations) {
        if (representation.getTextId() != 0) {
            representation.setName(getString(representation.getTextId()));
        }
        mCategorySeeStraightAdapter.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 7 with Action

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

the class FilterShowActivity method fillBorders.

private void fillBorders() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<FilterRepresentation> borders = filtersManager.getBorders();
    mCategoryBordersAdapter = new CategoryAdapter(this);
    for (int i = 0; i < borders.size(); i++) {
        FilterRepresentation filter = borders.get(i);
        filter.setName(getString(R.string.frame, i));
        if (i == 0) {
            filter.setName(getString(R.string.none));
        }
        mCategoryBordersAdapter.add(new Action(this, filter, Action.FULL_VIEW));
    }
}
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) Point(android.graphics.Point)

Example 8 with Action

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

the class FilterShowActivity method fillPresetFilter.

private void fillPresetFilter() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getFilterPreset();
    if (mChangeable) {
        ArrayList<FilterRepresentation> mFilterPreset = new ArrayList<FilterRepresentation>();
        ArrayList<SaveOption> ret = mFilterPresetSource.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);
        }
        if (tempFilterArray.size() != 0) {
            for (int id = 0; id < tempFilterArray.size(); id++) {
                FilterPresetRepresentation representation = new FilterPresetRepresentation(tempFilterArray.get(id).name, tempFilterArray.get(id)._id, id + 1);
                Uri filteredUri = Uri.parse(tempFilterArray.get(id).Uri);
                representation.setUri(filteredUri);
                representation.setSerializationName("Custom");
                mFilterPreset.add(representation);
            }
        }
        filtersRepresentations = mFilterPreset;
        mChangeable = false;
    }
    if (filtersRepresentations == null)
        return;
    for (FilterRepresentation representation : filtersRepresentations) {
        mCategoryLooksAdapter.add(new Action(this, representation, Action.FULL_VIEW, true));
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) ArrayList(java.util.ArrayList) FilterPresetRepresentation(com.android.gallery3d.filtershow.filters.FilterPresetRepresentation) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) Uri(android.net.Uri) Point(android.graphics.Point) SaveOption(com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)

Example 9 with Action

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

the class UserPresetsAdapter method updateActionFromEditText.

private void updateActionFromEditText(EditText editText) {
    Action action = (Action) editText.getTag();
    String newName = editText.getText().toString();
    if (newName.length() > 0) {
        action.setName(editText.getText().toString());
        changePreset(action);
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action)

Example 10 with Action

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

the class UserPresetsAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    UserPresetViewHolder viewHolder;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.filtershow_presets_management_row, null);
        viewHolder = new UserPresetViewHolder();
        viewHolder.imageView = (ImageView) convertView.findViewById(R.id.imageView);
        viewHolder.editText = (EditText) convertView.findViewById(R.id.editView);
        viewHolder.deleteButton = (ImageButton) convertView.findViewById(R.id.deleteUserPreset);
        viewHolder.editText.setOnClickListener(this);
        viewHolder.editText.setOnFocusChangeListener(this);
        viewHolder.deleteButton.setOnClickListener(this);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (UserPresetViewHolder) convertView.getTag();
    }
    Action action = getItem(position);
    viewHolder.imageView.setImageBitmap(action.getImage());
    if (action.getImage() == null) {
        // queue image rendering for this action
        action.setImageFrame(new Rect(0, 0, mIconSize, mIconSize), CategoryView.VERTICAL);
    }
    viewHolder.deleteButton.setTag(action);
    viewHolder.editText.setTag(action);
    viewHolder.editText.setHint(action.getName());
    return convertView;
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) Rect(android.graphics.Rect)

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