Search in sources :

Example 1 with FilterGradRepresentation

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

the class EditorGrad method setUpPopupMenu.

private void setUpPopupMenu(Button button) {
    mPopupMenu = new PopupMenu(mImageShow.getActivity(), button);
    mPopupMenu.getMenuInflater().inflate(R.menu.filtershow_menu_grad, mPopupMenu.getMenu());
    FilterGradRepresentation rep = (FilterGradRepresentation) getLocalRepresentation();
    if (rep == null) {
        return;
    }
    updateMenuItems(rep);
    hackFixStrings(mPopupMenu.getMenu());
    setEffectName();
    updateText();
    mPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            FilterRepresentation tmpRep = getLocalRepresentation();
            if (tmpRep instanceof FilterGradRepresentation) {
                FilterGradRepresentation rep = (FilterGradRepresentation) tmpRep;
                int cmdID = item.getItemId();
                switch(cmdID) {
                    case R.id.editor_grad_brightness:
                        mSliderMode = MODE_BRIGHTNESS;
                        mEffectName = item.getTitle().toString();
                        break;
                    case R.id.editor_grad_contrast:
                        mSliderMode = MODE_CONTRAST;
                        mEffectName = item.getTitle().toString();
                        break;
                    case R.id.editor_grad_saturation:
                        mSliderMode = MODE_SATURATION;
                        mEffectName = item.getTitle().toString();
                        break;
                }
                updateMenuItems(rep);
                updateSeekBar(rep);
                commitLocalRepresentation();
                mView.invalidate();
            }
            return true;
        }
    });
}
Also used : FilterGradRepresentation(com.android.gallery3d.filtershow.filters.FilterGradRepresentation) MenuItem(android.view.MenuItem) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) PopupMenu(android.widget.PopupMenu)

Example 2 with FilterGradRepresentation

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

the class EditorGrad method reflectCurrentFilter.

@Override
public void reflectCurrentFilter() {
    super.reflectCurrentFilter();
    FilterRepresentation tmpRep = getLocalRepresentation();
    if (tmpRep instanceof FilterGradRepresentation) {
        FilterGradRepresentation rep = (FilterGradRepresentation) tmpRep;
        boolean f = rep.showParameterValue();
        mImageGrad.setRepresentation(rep);
    }
}
Also used : FilterGradRepresentation(com.android.gallery3d.filtershow.filters.FilterGradRepresentation) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation)

Example 3 with FilterGradRepresentation

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

the class EditorGrad method calculateUserMessage.

@Override
public String calculateUserMessage(Context context, String effectName, Object parameterValue) {
    FilterGradRepresentation rep = getGradRepresentation();
    if (rep == null) {
        return mEffectName;
    }
    int val = rep.getParameter(mSliderMode);
    return mEffectName + ((val > 0) ? " +" : " ") + val;
}
Also used : FilterGradRepresentation(com.android.gallery3d.filtershow.filters.FilterGradRepresentation)

Example 4 with FilterGradRepresentation

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

the class EditorGrad method setValue.

@Override
public void setValue(int value) {
    FilterGradRepresentation rep = getGradRepresentation();
    if (rep == null) {
        return;
    }
    rep.setParameter(mSliderMode, value);
}
Also used : FilterGradRepresentation(com.android.gallery3d.filtershow.filters.FilterGradRepresentation)

Example 5 with FilterGradRepresentation

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

the class EditorGrad method fireLeftAction.

@Override
public void fireLeftAction() {
    FilterGradRepresentation rep = getGradRepresentation();
    if (rep == null) {
        return;
    }
    rep.addBand(MasterImage.getImage().getOriginalBounds());
    updateMenuItems(rep);
    updateSeekBar(rep);
    commitLocalRepresentation();
    mView.invalidate();
}
Also used : FilterGradRepresentation(com.android.gallery3d.filtershow.filters.FilterGradRepresentation)

Aggregations

FilterGradRepresentation (com.android.gallery3d.filtershow.filters.FilterGradRepresentation)8 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)4 MenuItem (android.view.MenuItem)1 PopupMenu (android.widget.PopupMenu)1