Search in sources :

Example 1 with FilterVignetteRepresentation

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

the class EditorVignette method calculateUserMessage.

@Override
public String calculateUserMessage(Context context, String effectName, Object parameterValue) {
    FilterRepresentation rep = getLocalRepresentation();
    if (rep == null || !(rep instanceof FilterVignetteRepresentation)) {
        return "";
    }
    FilterVignetteRepresentation csrep = (FilterVignetteRepresentation) rep;
    int mode = csrep.getParameterMode();
    String paramString;
    paramString = mContext.getString(mMenuStrings[mode]);
    int val = csrep.getCurrentParameter();
    return paramString + ((val > 0) ? " +" : " ") + val;
}
Also used : FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterVignetteRepresentation(com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)

Example 2 with FilterVignetteRepresentation

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

the class EditorVignette method reflectCurrentFilter.

@Override
public void reflectCurrentFilter() {
    if (useCompact(mContext)) {
        super.reflectCurrentFilter();
        FilterRepresentation rep = getLocalRepresentation();
        if (rep != null && getLocalRepresentation() instanceof FilterVignetteRepresentation) {
            FilterVignetteRepresentation drawRep = (FilterVignetteRepresentation) rep;
            mImageVignette.setRepresentation(drawRep);
        }
        updateText();
        return;
    }
    mLocalRepresentation = null;
    if (getLocalRepresentation() != null && getLocalRepresentation() instanceof FilterVignetteRepresentation) {
        FilterVignetteRepresentation rep = (FilterVignetteRepresentation) getLocalRepresentation();
        int min;
        int[] mode = { FilterVignetteRepresentation.MODE_VIGNETTE, FilterVignetteRepresentation.MODE_EXPOSURE, FilterVignetteRepresentation.MODE_SATURATION, FilterVignetteRepresentation.MODE_CONTRAST, FilterVignetteRepresentation.MODE_FALLOFF };
        SeekBar[] sliders = { mVignetteBar, mExposureBar, mSaturationBar, mContrastBar, mFalloffBar };
        TextView[] label = { mVignetteValue, mExposureValue, mSaturationValue, mContrastValue, mFalloffValue };
        for (int i = 0; i < mode.length; i++) {
            BasicParameterInt p = (BasicParameterInt) rep.getFilterParameter(mode[i]);
            int value = p.getValue();
            sliders[i].setMax(p.getMaximum() - p.getMinimum());
            sliders[i].setProgress(value - p.getMinimum());
            label[i].setText("" + value);
        }
        mImageVignette.setRepresentation(rep);
        super.reflectCurrentFilter();
        updateText();
    }
}
Also used : SeekBar(android.widget.SeekBar) BasicParameterInt(com.android.gallery3d.filtershow.controller.BasicParameterInt) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) TextView(android.widget.TextView) FilterVignetteRepresentation(com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)

Example 3 with FilterVignetteRepresentation

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

the class EditorVignette method openUtilityPanel.

@Override
public void openUtilityPanel(final LinearLayout accessoryViewList) {
    mButton = (SwapButton) accessoryViewList.findViewById(R.id.applyEffect);
    mButton.setText(mContext.getString(R.string.vignette_main));
    if (useCompact(mContext)) {
        final PopupMenu popupMenu = new PopupMenu(mImageShow.getActivity(), mButton);
        popupMenu.getMenuInflater().inflate(R.menu.filtershow_menu_vignette, popupMenu.getMenu());
        popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem item) {
                selectMenuItem(item);
                return true;
            }
        });
        mButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                popupMenu.show();
                ((FilterShowActivity) mContext).onShowMenu(popupMenu);
            }
        });
        mButton.setListener(this);
        FilterVignetteRepresentation csrep = getVignetteRep();
        String menuString = mContext.getString(mMenuStrings[0]);
        switchToMode(csrep, FilterVignetteRepresentation.MODE_VIGNETTE, menuString);
    } else {
        mButton.setText(mContext.getString(R.string.vignette_main));
    }
}
Also used : MenuItem(android.view.MenuItem) TextView(android.widget.TextView) View(android.view.View) FilterVignetteRepresentation(com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation) PopupMenu(android.widget.PopupMenu)

Example 4 with FilterVignetteRepresentation

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

the class EditorVignette method onProgressChanged.

@Override
public void onProgressChanged(SeekBar sbar, int progress, boolean arg2) {
    FilterVignetteRepresentation rep = getVignetteRep();
    int value = progress;
    BasicParameterInt p;
    switch(sbar.getId()) {
        case R.id.mainVignetteSeekbar:
            rep.setParameterMode(FilterVignetteRepresentation.MODE_VIGNETTE);
            p = rep.getFilterParameter(rep.getParameterMode());
            value += p.getMinimum();
            mVignetteValue.setText("" + value);
            break;
        case R.id.exposureSeekBar:
            rep.setParameterMode(FilterVignetteRepresentation.MODE_EXPOSURE);
            p = rep.getFilterParameter(rep.getParameterMode());
            value += p.getMinimum();
            mExposureValue.setText("" + value);
            break;
        case R.id.saturationSeekBar:
            rep.setParameterMode(FilterVignetteRepresentation.MODE_SATURATION);
            p = rep.getFilterParameter(rep.getParameterMode());
            value += p.getMinimum();
            mSaturationValue.setText("" + value);
            break;
        case R.id.contrastSeekBar:
            rep.setParameterMode(FilterVignetteRepresentation.MODE_CONTRAST);
            p = rep.getFilterParameter(rep.getParameterMode());
            value += p.getMinimum();
            mContrastValue.setText("" + value);
            break;
        case R.id.falloffSeekBar:
            rep.setParameterMode(FilterVignetteRepresentation.MODE_FALLOFF);
            p = rep.getFilterParameter(rep.getParameterMode());
            value += p.getMinimum();
            mFalloffValue.setText("" + value);
            break;
    }
    rep.setCurrentParameter(value);
    commitLocalRepresentation();
}
Also used : BasicParameterInt(com.android.gallery3d.filtershow.controller.BasicParameterInt) FilterVignetteRepresentation(com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)

Example 5 with FilterVignetteRepresentation

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

the class EditorVignette method getParameterToEdit.

@Override
protected Parameter getParameterToEdit(FilterRepresentation rep) {
    if (rep instanceof FilterVignetteRepresentation) {
        FilterVignetteRepresentation csrep = (FilterVignetteRepresentation) rep;
        Parameter param = csrep.getFilterParameter(csrep.getParameterMode());
        return param;
    }
    return null;
}
Also used : Parameter(com.android.gallery3d.filtershow.controller.Parameter) FilterVignetteRepresentation(com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)

Aggregations

FilterVignetteRepresentation (com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)6 TextView (android.widget.TextView)2 BasicParameterInt (com.android.gallery3d.filtershow.controller.BasicParameterInt)2 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)2 MenuItem (android.view.MenuItem)1 View (android.view.View)1 PopupMenu (android.widget.PopupMenu)1 SeekBar (android.widget.SeekBar)1 Parameter (com.android.gallery3d.filtershow.controller.Parameter)1