Search in sources :

Example 6 with FiltersManager

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

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

the class ProcessingService method setupPipeline.

public void setupPipeline() {
    Resources res = getResources();
    FiltersManager.setResources(res);
    CachingPipeline.createRenderscriptContext(this);
    FiltersManager filtersManager = FiltersManager.getManager();
    filtersManager.addLooks(this);
    filtersManager.addBorders(this);
    filtersManager.addTools(this);
    filtersManager.addEffects();
    filtersManager.addDualCam(this);
    filtersManager.addMakeups(this);
    filtersManager.addTrueScanner();
    filtersManager.addHazeBuster();
    filtersManager.addSeeStraight();
    filtersManager.addTruePortrait(this);
    filtersManager.addFilterPreset(this);
    filtersManager.addWaterMarks(this);
    filtersManager.addLocations(this);
    filtersManager.addTimes(this);
    filtersManager.addWeather(this);
    filtersManager.addEmotions(this);
    filtersManager.addFoods(this);
    FiltersManager highresFiltersManager = FiltersManager.getHighresManager();
    highresFiltersManager.addLooks(this);
    highresFiltersManager.addBorders(this);
    highresFiltersManager.addTools(this);
    highresFiltersManager.addEffects();
    highresFiltersManager.addDualCam(this);
    // highresFiltersManager.addMakeups(this);
    highresFiltersManager.addTrueScanner();
    highresFiltersManager.addHazeBuster();
    highresFiltersManager.addSeeStraight();
    highresFiltersManager.addTruePortrait(this);
    highresFiltersManager.addFilterPreset(this);
    highresFiltersManager.addWaterMarks(this);
    highresFiltersManager.addLocations(this);
    highresFiltersManager.addTimes(this);
    highresFiltersManager.addWeather(this);
    highresFiltersManager.addEmotions(this);
    highresFiltersManager.addFoods(this);
}
Also used : FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) Resources(android.content.res.Resources)

Example 8 with FiltersManager

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

the class FilterShowActivity method fillLooks.

private void fillLooks() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getLooks();
    if (mCategoryLooksAdapter != null) {
        mCategoryLooksAdapter.clear();
    }
    mCategoryLooksAdapter = new CategoryAdapter(this);
    int verticalItemHeight = (int) getResources().getDimension(R.dimen.action_item_height);
    mCategoryLooksAdapter.setItemHeight(verticalItemHeight);
    for (FilterRepresentation representation : filtersRepresentations) {
        mCategoryLooksAdapter.add(new Action(this, representation, Action.FULL_VIEW));
    }
    if (FilterGeneratorNativeEngine.getInstance().isLibLoaded()) {
        if (mUserPresetsManager.getRepresentations() == null || mUserPresetsManager.getRepresentations().size() == 0) {
            mCategoryLooksAdapter.add(new Action(this, Action.ADD_ACTION));
        }
    }
    fillPresetFilter();
    Fragment panel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
    if (panel != null) {
        if (panel instanceof MainPanel) {
            MainPanel mainPanel = (MainPanel) panel;
            mainPanel.loadCategoryLookPanel(true);
        }
    }
}
Also used : Action(com.android.gallery3d.filtershow.category.Action) FiltersManager(com.android.gallery3d.filtershow.filters.FiltersManager) MainPanel(com.android.gallery3d.filtershow.category.MainPanel) CategoryAdapter(com.android.gallery3d.filtershow.category.CategoryAdapter) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) Fragment(android.support.v4.app.Fragment) MediaPickerFragment(com.android.gallery3d.filtershow.mediapicker.MediaPickerFragment) DialogFragment(android.support.v4.app.DialogFragment) Point(android.graphics.Point)

Example 9 with FiltersManager

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

the class FilterShowActivity method fillWaterMarks.

private void fillWaterMarks() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<ArrayList<FilterRepresentation>> filters = new ArrayList<>();
    filters.add(filtersManager.getWaterMarks());
    filters.add(filtersManager.getLocations());
    filters.add(filtersManager.getTimes());
    filters.add(filtersManager.getWeathers());
    filters.add(filtersManager.getEmotions());
    filters.add(filtersManager.getFoods());
    if (mCategoryWatermarkAdapters != null) {
        mCategoryWatermarkAdapters.clear();
    }
    mCategoryWatermarkAdapters = new ArrayList<>();
    for (int i = 0; i < filters.size(); i++) {
        mCategoryWatermarkAdapters.add(new CategoryAdapter(this));
        for (FilterRepresentation representation : filters.get(i)) {
            mCategoryWatermarkAdapters.get(i).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) ArrayList(java.util.ArrayList) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) Point(android.graphics.Point)

Example 10 with FiltersManager

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

the class FilterShowActivity method fillTools.

private void fillTools() {
    FiltersManager filtersManager = FiltersManager.getManager();
    ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getTools();
    if (mCategoryGeometryAdapter != null) {
        mCategoryGeometryAdapter.clear();
    }
    mCategoryGeometryAdapter = new CategoryAdapter(this);
    for (FilterRepresentation representation : filtersRepresentations) {
        mCategoryGeometryAdapter.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)

Aggregations

FiltersManager (com.android.gallery3d.filtershow.filters.FiltersManager)15 Action (com.android.gallery3d.filtershow.category.Action)12 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)12 CategoryAdapter (com.android.gallery3d.filtershow.category.CategoryAdapter)11 Point (android.graphics.Point)4 ArrayList (java.util.ArrayList)2 Resources (android.content.res.Resources)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 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 FilterShowActivity (com.android.gallery3d.filtershow.FilterShowActivity)1 MainPanel (com.android.gallery3d.filtershow.category.MainPanel)1 SaveOption (com.android.gallery3d.filtershow.data.FilterPresetSource.SaveOption)1 FilterPresetRepresentation (com.android.gallery3d.filtershow.filters.FilterPresetRepresentation)1 MediaPickerFragment (com.android.gallery3d.filtershow.mediapicker.MediaPickerFragment)1