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