public class ImageShow extends View implements OnGestureListener,
ScaleGestureDetector.OnScaleGestureListener,
- OnDoubleTapListener,
- SliderListener,
- OnSeekBarChangeListener {
+ OnDoubleTapListener {
private static final String LOGTAG = "ImageShow";
return new GeometryMetadata(getImagePreset().mGeoData);
}
- public void setGeometry(GeometryMetadata d) {
- getImagePreset().mGeoData.set(d);
- }
-
- private boolean mShowControls = false;
private String mToast = null;
private boolean mShowToast = false;
private boolean mImportantToast = false;
- private SeekBar mSeekBar = null;
private PanelController mController = null;
private FilterShowActivity mActivity = null;
private final Handler mHandler = new Handler();
public void select() {
- if (mSeekBar != null) {
- mSeekBar.setOnSeekBarChangeListener(this);
- }
- }
-
- private int parameterToUI(int parameter, int minp, int maxp, int uimax) {
- return (uimax * (parameter - minp)) / (maxp - minp);
- }
-
- private int uiToParameter(int ui, int minp, int maxp, int uimax) {
- return ((maxp - minp) * ui) / uimax + minp;
- }
-
- public void updateSeekBar(int parameter, int minp, int maxp) {
- if (mSeekBar == null) {
- return;
- }
- int seekMax = mSeekBar.getMax();
- int progress = parameterToUI(parameter, minp, maxp, seekMax);
- mSeekBar.setProgress(progress);
}
public void unselect() {
-
}
public boolean hasModifications() {
return mController;
}
- @Override
public void onNewValue(int parameter) {
if (getImagePreset() != null) {
getImagePreset().fillImageStateAdapter(MasterImage.getImage().getState());
return mTouch;
}
- @Override
- public void onTouchDown(float x, float y) {
- mTouch.x = (int) x;
- mTouch.y = (int) y;
- invalidate();
- }
-
- @Override
- public void onTouchUp() {
- }
-
public ImageShow(Context context, AttributeSet attrs) {
super(context, attrs);
setMeasuredDimension(parentWidth, parentHeight);
}
- public void setSeekBar(SeekBar seekBar) {
- mSeekBar = seekBar;
- }
-
public ImageFilter getCurrentFilter() {
return MasterImage.getImage().getCurrentFilter();
}
}
}
- public ImageShow setShowControls(boolean value) {
- mShowControls = value;
- if (mShowControls) {
- if (mSeekBar != null) {
- mSeekBar.setVisibility(View.VISIBLE);
- }
- } else {
- if (mSeekBar != null) {
- mSeekBar.setVisibility(View.INVISIBLE);
- }
- }
- return this;
- }
-
- public boolean showControls() {
- return mShowControls;
- }
-
- public boolean showHires() {
- return true;
- }
-
public boolean showTitle() {
return false;
}
invalidate();
}
- public float getImageRotation() {
- return getImagePreset().mGeoData.getRotation();
- }
-
- public float getImageRotationZoomFactor() {
- return getImagePreset().mGeoData.getScaleFactor();
- }
-
- public void setImageRotation(float r) {
- getImagePreset().mGeoData.setRotation(r);
- }
-
- public void setImageRotationZoomFactor(float f) {
- getImagePreset().mGeoData.setScaleFactor(f);
- }
-
- public void setImageRotation(float imageRotation,
- float imageRotationZoomFactor) {
- float r = getImageRotation();
- if (imageRotation != r) {
- invalidate();
- }
- setImageRotation(imageRotation);
- setImageRotationZoomFactor(imageRotationZoomFactor);
- }
-
- @Override
- public void onProgressChanged(SeekBar arg0, int progress, boolean arg2) {
- int parameter = progress;
- onNewValue(parameter);
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar arg0) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar arg0) {
- // TODO Auto-generated method stub
- }
-
@Override
public boolean onDoubleTap(MotionEvent arg0) {
// TODO Auto-generated method stub