Search in sources :

Example 6 with FilterRepresentation

use of com.android.gallery3d.filtershow.filters.FilterRepresentation 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 7 with FilterRepresentation

use of com.android.gallery3d.filtershow.filters.FilterRepresentation 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 8 with FilterRepresentation

use of com.android.gallery3d.filtershow.filters.FilterRepresentation 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 9 with FilterRepresentation

use of com.android.gallery3d.filtershow.filters.FilterRepresentation 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 10 with FilterRepresentation

use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.

the class EditorGrad method setUpPopupMenu.

private void setUpPopupMenu(Button button) {
    mPopupMenu = new PopupMenu(mImageShow.getActivity(), button);
    mPopupMenu.getMenuInflater().inflate(R.menu.filtershow_menu_grad, mPopupMenu.getMenu());
    FilterGradRepresentation rep = (FilterGradRepresentation) getLocalRepresentation();
    if (rep == null) {
        return;
    }
    updateMenuItems(rep);
    hackFixStrings(mPopupMenu.getMenu());
    setEffectName();
    updateText();
    mPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            FilterRepresentation tmpRep = getLocalRepresentation();
            if (tmpRep instanceof FilterGradRepresentation) {
                FilterGradRepresentation rep = (FilterGradRepresentation) tmpRep;
                int cmdID = item.getItemId();
                switch(cmdID) {
                    case R.id.editor_grad_brightness:
                        mSliderMode = MODE_BRIGHTNESS;
                        mEffectName = item.getTitle().toString();
                        break;
                    case R.id.editor_grad_contrast:
                        mSliderMode = MODE_CONTRAST;
                        mEffectName = item.getTitle().toString();
                        break;
                    case R.id.editor_grad_saturation:
                        mSliderMode = MODE_SATURATION;
                        mEffectName = item.getTitle().toString();
                        break;
                }
                updateMenuItems(rep);
                updateSeekBar(rep);
                commitLocalRepresentation();
                mView.invalidate();
            }
            return true;
        }
    });
}
Also used : FilterGradRepresentation(com.android.gallery3d.filtershow.filters.FilterGradRepresentation) MenuItem(android.view.MenuItem) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) PopupMenu(android.widget.PopupMenu)

Aggregations

FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)78 Action (com.android.gallery3d.filtershow.category.Action)12 FiltersManager (com.android.gallery3d.filtershow.filters.FiltersManager)12 CategoryAdapter (com.android.gallery3d.filtershow.category.CategoryAdapter)11 Point (android.graphics.Point)8 ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)8 Bitmap (android.graphics.Bitmap)7 FilterUserPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation)6 FilterShowActivity (com.android.gallery3d.filtershow.FilterShowActivity)5 FilterDualCamFusionRepresentation (com.android.gallery3d.filtershow.filters.FilterDualCamFusionRepresentation)5 FilterMirrorRepresentation (com.android.gallery3d.filtershow.filters.FilterMirrorRepresentation)5 MasterImage (com.android.gallery3d.filtershow.imageshow.MasterImage)5 FilterGradRepresentation (com.android.gallery3d.filtershow.filters.FilterGradRepresentation)4 FilterRotateRepresentation (com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)4 ArrayList (java.util.ArrayList)4 Uri (android.net.Uri)3 LayoutInflater (android.view.LayoutInflater)3 View (android.view.View)3 OnClickListener (android.view.View.OnClickListener)3 FilterCropRepresentation (com.android.gallery3d.filtershow.filters.FilterCropRepresentation)3