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;
}
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();
}
}
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));
}
}
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();
}
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;
}
Aggregations