Search in sources :

Example 1 with FilterChanSatRepresentation

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

the class EditorChanSat method getParameterToEdit.

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

Example 2 with FilterChanSatRepresentation

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

the class EditorChanSat method openUtilityPanel.

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

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

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

Example 3 with FilterChanSatRepresentation

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

the class EditorChanSat method onProgressChanged.

@Override
public void onProgressChanged(SeekBar sbar, int progress, boolean arg2) {
    FilterChanSatRepresentation rep = getChanSatRep();
    int value = progress - 100;
    switch(sbar.getId()) {
        case R.id.mainSeekbar:
            rep.setParameterMode(FilterChanSatRepresentation.MODE_MASTER);
            mMainValue.setText("" + value);
            break;
        case R.id.redSeekBar:
            rep.setParameterMode(FilterChanSatRepresentation.MODE_RED);
            mRedValue.setText("" + value);
            break;
        case R.id.yellowSeekBar:
            rep.setParameterMode(FilterChanSatRepresentation.MODE_YELLOW);
            mYellowValue.setText("" + value);
            break;
        case R.id.greenSeekBar:
            rep.setParameterMode(FilterChanSatRepresentation.MODE_GREEN);
            mGreenValue.setText("" + value);
            break;
        case R.id.cyanSeekBar:
            rep.setParameterMode(FilterChanSatRepresentation.MODE_CYAN);
            mCyanValue.setText("" + value);
            break;
        case R.id.blueSeekBar:
            rep.setParameterMode(FilterChanSatRepresentation.MODE_BLUE);
            mBlueValue.setText("" + value);
            break;
        case R.id.magentaSeekBar:
            rep.setParameterMode(FilterChanSatRepresentation.MODE_MAGENTA);
            mMagentaValue.setText("" + value);
            break;
    }
    rep.setCurrentParameter(value);
    commitLocalRepresentation();
}
Also used : FilterChanSatRepresentation(com.android.gallery3d.filtershow.filters.FilterChanSatRepresentation)

Example 4 with FilterChanSatRepresentation

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

the class EditorChanSat method reflectCurrentFilter.

@Override
public void reflectCurrentFilter() {
    if (useCompact(mContext)) {
        super.reflectCurrentFilter();
        updateText();
        return;
    }
    mLocalRepresentation = null;
    if (getLocalRepresentation() != null && getLocalRepresentation() instanceof FilterChanSatRepresentation) {
        FilterChanSatRepresentation rep = (FilterChanSatRepresentation) getLocalRepresentation();
        int value = rep.getValue(FilterChanSatRepresentation.MODE_MASTER);
        mMainBar.setProgress(value + 100);
        mMainValue.setText("" + value);
        value = rep.getValue(FilterChanSatRepresentation.MODE_RED);
        mRedBar.setProgress(value + 100);
        mRedValue.setText("" + value);
        value = rep.getValue(FilterChanSatRepresentation.MODE_YELLOW);
        mYellowBar.setProgress(value + 100);
        mYellowValue.setText("" + value);
        value = rep.getValue(FilterChanSatRepresentation.MODE_GREEN);
        mGreenBar.setProgress(value + 100);
        mGreenValue.setText("" + value);
        value = rep.getValue(FilterChanSatRepresentation.MODE_CYAN);
        mCyanBar.setProgress(value + 100);
        mCyanValue.setText("" + value);
        value = rep.getValue(FilterChanSatRepresentation.MODE_BLUE);
        mBlueBar.setProgress(value + 100);
        mBlueValue.setText("" + value);
        value = rep.getValue(FilterChanSatRepresentation.MODE_MAGENTA);
        mMagentaBar.setProgress(value + 100);
        mMagentaValue.setText("" + value);
        super.reflectCurrentFilter();
        updateText();
    }
}
Also used : FilterChanSatRepresentation(com.android.gallery3d.filtershow.filters.FilterChanSatRepresentation)

Example 5 with FilterChanSatRepresentation

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

the class EditorChanSat method calculateUserMessage.

@Override
public String calculateUserMessage(Context context, String effectName, Object parameterValue) {
    FilterRepresentation rep = getLocalRepresentation();
    if (rep == null || !(rep instanceof FilterChanSatRepresentation)) {
        return "";
    }
    FilterChanSatRepresentation csrep = (FilterChanSatRepresentation) 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) FilterChanSatRepresentation(com.android.gallery3d.filtershow.filters.FilterChanSatRepresentation)

Aggregations

FilterChanSatRepresentation (com.android.gallery3d.filtershow.filters.FilterChanSatRepresentation)7 Bitmap (android.graphics.Bitmap)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 PopupMenu (android.widget.PopupMenu)1 TextView (android.widget.TextView)1 BasicParameterStyle (com.android.gallery3d.filtershow.controller.BasicParameterStyle)1 FilterView (com.android.gallery3d.filtershow.controller.FilterView)1 Parameter (com.android.gallery3d.filtershow.controller.Parameter)1 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)1 ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)1