Search in sources :

Example 1 with BasicParameterInt

use of com.android.gallery3d.filtershow.controller.BasicParameterInt 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 2 with BasicParameterInt

use of com.android.gallery3d.filtershow.controller.BasicParameterInt in project android_packages_apps_Gallery2 by LineageOS.

the class EditorColorBorderTabletUI method setColorBorderRepresentation.

public void setColorBorderRepresentation(FilterColorBorderRepresentation rep) {
    mRep = rep;
    BasicParameterInt size;
    size = (BasicParameterInt) mRep.getParam(FilterColorBorderRepresentation.PARAM_SIZE);
    mCBSizeSeekBar.setMax(size.getMaximum() - size.getMinimum());
    mCBSizeSeekBar.setProgress(size.getValue());
    BasicParameterInt radius;
    radius = (BasicParameterInt) mRep.getParam(FilterColorBorderRepresentation.PARAM_RADIUS);
    mCBCornerSizeSeekBar.setMax(radius.getMaximum() - radius.getMinimum());
    mCBCornerSizeSeekBar.setProgress(radius.getValue());
    ParameterColor color;
    color = (ParameterColor) mRep.getParam(FilterColorBorderRepresentation.PARAM_COLOR);
    mBasColors = color.getColorPalette();
    color.setValue(mBasColors[mSelectedColorButton]);
}
Also used : BasicParameterInt(com.android.gallery3d.filtershow.controller.BasicParameterInt) ParameterColor(com.android.gallery3d.filtershow.controller.ParameterColor)

Example 3 with BasicParameterInt

use of com.android.gallery3d.filtershow.controller.BasicParameterInt in project android_packages_apps_Gallery2 by LineageOS.

the class EditorDrawTabletUI method setDrawRepresentation.

public void setDrawRepresentation(FilterDrawRepresentation rep) {
    mRep = rep;
    BasicParameterInt size;
    size = (BasicParameterInt) mRep.getParam(FilterDrawRepresentation.PARAM_SIZE);
    mdrawSizeSeekBar.setMax(size.getMaximum() - size.getMinimum());
    mdrawSizeSeekBar.setProgress(size.getValue());
    ParameterColor color;
    color = (ParameterColor) mRep.getParam(FilterDrawRepresentation.PARAM_COLOR);
    color.setValue(mBasColors[mSelectedColorButton]);
    BasicParameterStyle style;
    style = (BasicParameterStyle) mRep.getParam(FilterDrawRepresentation.PARAM_STYLE);
    style.setSelected(mSelectedStyleButton);
}
Also used : BasicParameterInt(com.android.gallery3d.filtershow.controller.BasicParameterInt) ParameterColor(com.android.gallery3d.filtershow.controller.ParameterColor) BasicParameterStyle(com.android.gallery3d.filtershow.controller.BasicParameterStyle)

Example 4 with BasicParameterInt

use of com.android.gallery3d.filtershow.controller.BasicParameterInt 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)

Aggregations

BasicParameterInt (com.android.gallery3d.filtershow.controller.BasicParameterInt)4 ParameterColor (com.android.gallery3d.filtershow.controller.ParameterColor)2 FilterVignetteRepresentation (com.android.gallery3d.filtershow.filters.FilterVignetteRepresentation)2 SeekBar (android.widget.SeekBar)1 TextView (android.widget.TextView)1 BasicParameterStyle (com.android.gallery3d.filtershow.controller.BasicParameterStyle)1 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)1