use of com.android.gallery3d.filtershow.filters.FilterRepresentation 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.FilterRepresentation 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.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class ParametricEditor method setEditPanelUI.
@Override
public void setEditPanelUI(View editControl) {
mEditControl = editControl;
FilterRepresentation rep = getLocalRepresentation();
Parameter param = getParameterToEdit(rep);
if (param != null) {
control(param, editControl);
} else {
mSeekBar = (SeekBar) editControl.findViewById(R.id.primarySeekBar);
if (mSeekBar != null && showsSeekBar()) {
mSeekBar.setVisibility(View.VISIBLE);
}
mSeekBar.setOnSeekBarChangeListener(this);
}
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class StatePanelTrack method onTouchEvent.
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mCurrentView == null) {
return false;
}
if (mTouchTime == 0) {
mTouchTime = System.currentTimeMillis();
}
mGestureDetector.onTouchEvent(event);
if (mTouchPoint == null) {
mTouchPoint = new Point();
mTouchPoint.x = (int) event.getX();
mTouchPoint.y = (int) event.getY();
}
if (event.getActionMasked() == MotionEvent.ACTION_MOVE) {
float translation = event.getY() - mTouchPoint.y;
float alpha = 1.0f - (Math.abs(translation) / mCurrentView.getHeight());
if (getOrientation() == LinearLayout.VERTICAL) {
translation = event.getX() - mTouchPoint.x;
alpha = 1.0f - (Math.abs(translation) / mCurrentView.getWidth());
mCurrentView.setTranslationX(translation);
} else {
mCurrentView.setTranslationY(translation);
}
mCurrentView.setBackgroundAlpha(alpha);
if (ALLOWS_DRAG && alpha < 0.7) {
setOnDragListener(mDragListener);
DragShadowBuilder shadowBuilder = new DragShadowBuilder(mCurrentView);
mCurrentView.startDrag(null, shadowBuilder, mCurrentView, 0);
mStartedDrag = true;
}
}
if (!mExited && mCurrentView != null && mCurrentView.getBackgroundAlpha() > mDeleteSlope && event.getActionMasked() == MotionEvent.ACTION_UP && System.currentTimeMillis() - mTouchTime < mMaxTouchDelay) {
FilterRepresentation representation = mCurrentView.getState().getFilterRepresentation();
mCurrentView.setSelected(true);
if (representation != MasterImage.getImage().getCurrentFilterRepresentation()) {
FilterShowActivity activity = (FilterShowActivity) getContext();
activity.showRepresentation(representation);
mCurrentView.setSelected(false);
}
}
if (event.getActionMasked() == MotionEvent.ACTION_UP || (!mStartedDrag && event.getActionMasked() == MotionEvent.ACTION_CANCEL)) {
checkEndState();
if (mCurrentView != null) {
FilterRepresentation representation = mCurrentView.getState().getFilterRepresentation();
if (representation.getEditorId() == ImageOnlyEditor.ID) {
mCurrentView.setSelected(false);
}
}
}
return true;
}
use of com.android.gallery3d.filtershow.filters.FilterRepresentation in project android_packages_apps_Gallery2 by LineageOS.
the class MasterImage method hasFusionApplied.
public synchronized boolean hasFusionApplied() {
FilterRepresentation dcRepresentation = mPreset.getFilterWithSerializationName(FilterDualCamFusionRepresentation.SERIALIZATION_NAME);
FilterRepresentation tpRepresentation = mPreset.getFilterWithSerializationName(FilterTruePortraitFusionRepresentation.SERIALIZATION_NAME);
if (dcRepresentation instanceof FilterDualCamFusionRepresentation || tpRepresentation instanceof FilterTruePortraitFusionRepresentation) {
return true;
}
return false;
}
Aggregations