Search in sources :

Example 46 with FilterRepresentation

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

the class FilterShowActivity method resetHistory.

void resetHistory() {
    if (mMasterImage == null) {
        return;
    }
    HistoryManager adapter = mMasterImage.getHistory();
    adapter.reset();
    HistoryItem historyItem = adapter.getItem(0);
    ImagePreset original = null;
    original = new ImagePreset();
    FilterRepresentation rep = null;
    if (historyItem != null) {
        rep = historyItem.getFilterRepresentation();
    }
    mMasterImage.setPreset(original, rep, true);
    mMasterImage.setFusionUnderlay(null);
    mMasterImage.resetTranslation();
    mMasterImage.setScaleFactor(1);
    mMasterImage.setCurrentFilterRepresentation(null);
    ArrayList<FilterRepresentation> frList = FiltersManager.getManager().getTools();
    for (FilterRepresentation fr : frList) {
        if (fr instanceof FilterRotateRepresentation) {
            ((FilterRotateRepresentation) fr).resetRotation();
        }
    }
    showDefaultImageView();
    showSaveButtonIfNeed();
    invalidateViews();
}
Also used : HistoryManager(com.android.gallery3d.filtershow.history.HistoryManager) HistoryItem(com.android.gallery3d.filtershow.history.HistoryItem) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterRotateRepresentation(com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)

Example 47 with FilterRepresentation

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

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

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

the class CategoryAdapter method reflectImagePreset.

public void reflectImagePreset(ImagePreset preset) {
    if (preset == null) {
        return;
    }
    // if nothing found, select "none" (first element)
    int selected = 0;
    FilterRepresentation rep = null;
    if (mCategory == MainPanel.LOOKS) {
        int pos = preset.getPositionForType(FilterRepresentation.TYPE_FX);
        if (pos != -1) {
            rep = preset.getFilterRepresentation(pos);
        } else {
            pos = preset.getPositionForType(FilterRepresentation.TYPE_PRESETFILTER);
            if (pos != -1)
                rep = preset.getFilterRepresentation(pos);
        }
    } else if (mCategory == MainPanel.BORDERS) {
        int pos = preset.getPositionForType(FilterRepresentation.TYPE_BORDER);
        if (pos != -1) {
            rep = preset.getFilterRepresentation(pos);
        }
    } else if (mCategory == MainPanel.DUALCAM) {
        int pos = preset.getPositionForType(FilterRepresentation.TYPE_DUALCAM);
        if (pos != -1) {
            rep = preset.getFilterRepresentation(pos);
        }
    } else if (mCategory == MainPanel.TRUEPORTRAIT) {
        int pos = preset.getPositionForType(FilterRepresentation.TYPE_TRUEPORTRAIT);
        if (pos != -1) {
            rep = preset.getFilterRepresentation(pos);
        }
    } else if (mCategory == MainPanel.FILTERS || mCategory == MainPanel.MAKEUP) {
        selected = UNKNOWN_INDEX;
    }
    if (rep != null) {
        for (int i = 0; i < getCount(); i++) {
            FilterRepresentation itemRep = getItem(i).getRepresentation();
            if (itemRep == null) {
                continue;
            }
            if (rep.getName().equalsIgnoreCase(itemRep.getName())) {
                selected = i;
                break;
            }
        }
    }
    if (mSelectedPosition != selected) {
        mSelectedPosition = selected;
        this.notifyDataSetChanged();
    }
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 50 with FilterRepresentation

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

the class StatePanelTrack method checkEndState.

public void checkEndState() {
    mTouchPoint = null;
    mTouchTime = 0;
    if (mExited || mCurrentView.getBackgroundAlpha() < mDeleteSlope) {
        int origin = findChild(mCurrentView);
        if (origin != -1) {
            State current = mAdapter.getItem(origin);
            FilterRepresentation currentRep = MasterImage.getImage().getCurrentFilterRepresentation();
            FilterRepresentation removedRep = current.getFilterRepresentation();
            mAdapter.remove(current);
            fillContent(true);
            if (currentRep != null && removedRep != null && currentRep.getFilterClass() == removedRep.getFilterClass()) {
                FilterShowActivity activity = (FilterShowActivity) getContext();
                activity.backToMain();
                return;
            }
        }
    } else {
        mCurrentView.setBackgroundAlpha(1.0f);
        mCurrentView.setTranslationX(0);
        mCurrentView.setTranslationY(0);
    }
    if (mCurrentSelectedView != null) {
        mCurrentSelectedView.invalidate();
    }
    if (mCurrentView != null) {
        mCurrentView.invalidate();
    }
    mCurrentView = null;
    mExited = false;
    mStartedDrag = false;
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterShowActivity(com.android.gallery3d.filtershow.FilterShowActivity) Point(android.graphics.Point)

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