dymmycode蓝筹股是什么意思思

/ MicroDym
项目语言:JAVA
权限:read-only(如需更高权限请先加入项目)
Index: PhotoViewAttacher.java
===================================================================
--- PhotoViewAttacher.java (revision 0)
+++ PhotoViewAttacher.java (revision 2)
@@ -0,0 +1,1079 @@
+/*******************************************************************************
+ * Copyright
Chris Banes.
+ * Licensed under the Apache License, Version 2.0 (the &License&);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an &AS IS& BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *******************************************************************************/
+package com.esun.microdym.
+import static android.view.MotionEvent.ACTION_CANCEL;
+import static android.view.MotionEvent.ACTION_DOWN;
+import static android.view.MotionEvent.ACTION_UP;
+import java.lang.ref.WeakR
+import android.content.C
+import android.graphics.B
+import android.graphics.M
+import android.graphics.Matrix.ScaleToF
+import android.graphics.RectF;
+import android.graphics.drawable.D
+import android.util.FloatM
+import android.util.L
+import android.view.MotionE
+import android.view.GestureD
+import android.view.V
+import android.view.View.OnLongClickL
+import android.view.ViewP
+import android.view.ViewTreeO
+import android.view.animation.AccelerateDecelerateI
+import android.view.animation.I
+import android.widget.ImageV
+import android.widget.ImageView.ScaleT
+public class PhotoViewAttacher implements IPhotoView, View.OnTouchListener,
OnGestureListener,
ViewTreeObserver.OnGlobalLayoutListener {
private static final String LOG_TAG = &PhotoViewAttacher&;
// let debug flag be dynamic, but still Proguard can be used to remove from
// release builds
private static final boolean DEBUG = Log.isLoggable(LOG_TAG, Log.DEBUG);
static final Interpolator sInterpolator = new AccelerateDecelerateInterpolator();
int ZOOM_DURATION = DEFAULT_ZOOM_DURATION;
static final int EDGE_NONE = -1;
static final int EDGE_LEFT = 0;
static final int EDGE_RIGHT = 1;
static final int EDGE_BOTH = 2;
private float mMinScale = DEFAULT_MIN_SCALE;
private float mMidScale = DEFAULT_MID_SCALE;
private float mMaxScale = DEFAULT_MAX_SCALE;
private boolean mAllowParentInterceptOnEdge =
private static void checkZoomLevels(float minZoom, float midZoom,
float maxZoom) {
if (minZoom &= midZoom) {
throw new IllegalArgumentException(
&MinZoom has to be less than MidZoom&);
} else if (midZoom &= maxZoom) {
throw new IllegalArgumentException(
&MidZoom has to be less than MaxZoom&);
* @return true if the ImageView exists, and it's Drawable existss
private static boolean hasDrawable(ImageView imageView) {
return null != imageView && null != imageView.getDrawable();
* @return true if the ScaleType is supported.
private static boolean isSupportedScaleType(final ScaleType scaleType) {
if (null == scaleType) {
switch (scaleType) {
case MATRIX:
throw new IllegalArgumentException(scaleType.name()
+ & is not supported in PhotoView&);
* Set's the ImageView's ScaleType to Matrix.
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
* PhotoView sets it's own ScaleType to Matrix, then diverts all calls
* setScaleType to this.setScaleType automatically.
if (null != imageView && !(imageView instanceof IPhotoView)) {
if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
imageView.setScaleType(ScaleType.MATRIX);
private WeakReference&ImageView& mImageV
// Gesture Detectors
private GestureDetector mGestureD
private com.esun.microdym.browseralbum.GestureDetector mScaleDragD
// These are set so we don't keep allocating them on the heap
private final Matrix mBaseMatrix = new Matrix();
private final Matrix mDrawMatrix = new Matrix();
private final Matrix mSuppMatrix = new Matrix();
private final RectF mDisplayRect = new RectF();
private final float[] mMatrixValues = new float[9];
// Listeners
private OnMatrixChangedListener mMatrixChangeL
private OnPhotoTapListener mPhotoTapL
private OnViewTapListener mViewTapL
private OnLongClickListener mLongClickL
private int mIvTop, mIvRight, mIvBottom, mIvL
private FlingRunnable mCurrentFlingR
private int mScrollEdge = EDGE_BOTH;
private boolean mRotationDetectionEnabled =
private boolean mZoomE
private ScaleType mScaleType = ScaleType.FIT_CENTER;
public PhotoViewAttacher(ImageView imageView) {
mImageView = new WeakReference&ImageView&(imageView);
imageView.setDrawingCacheEnabled(true);
imageView.setOnTouchListener(this);
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer)
observer.addOnGlobalLayoutListener(this);
// Make sure we using MATRIX Scale Type
setImageViewScaleTypeMatrix(imageView);
if (imageView.isInEditMode()) {
// Create Gesture Detectors...
mScaleDragDetector = VersionedGestureDetector.newInstance(imageView.getContext(), this);
mGestureDetector = new GestureDetector(imageView.getContext(),
new GestureDetector.SimpleOnGestureListener() {
// forward long click listener
public void onLongPress(MotionEvent e) {
if (null != mLongClickListener) {
mLongClickListener.onLongClick(getImageView());
mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
// Finally, update the UI so that we're zoomable
setZoomable(true);
* Sets custom double tap listener, to intercept default given functions. To reset behavior to
* default, you can just pass in &null& or public field of PhotoViewAttacher.defaultOnDoubleTapListener
* @param newOnDoubleTapListener custom OnDoubleTapListener to be set on ImageView
public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener newOnDoubleTapListener) {
if (newOnDoubleTapListener != null)
this.mGestureDetector.setOnDoubleTapListener(newOnDoubleTapListener);
this.mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
public boolean canZoom() {
return mZoomE
* Clean-up the resources attached to this object. This needs to be called when the ImageView is
* no longer used. A good example is from {@link android.view.View#onDetachedFromWindow()} or
* from {@link android.app.Activity#onDestroy()}. This is automatically called if you are using
* {@link uk.co.senab.photoview.PhotoView}.
@SuppressWarnings(&deprecation&)
public void cleanup() {
if (null == mImageView) {
+ // cleanup already done
final ImageView imageView = mImageView.get();
if (null != imageView) {
// Remove this as a global layout listener
ViewTreeObserver observer = imageView.getViewTreeObserver();
if (null != observer && observer.isAlive()) {
observer.removeGlobalOnLayoutListener(this);
// Remove the ImageView's reference to this
imageView.setOnTouchListener(null);
// make sure a pending fling runnable won't be run
cancelFling();
if (null != mGestureDetector) {
mGestureDetector.setOnDoubleTapListener(null);
// Clear listeners too
mMatrixChangeListener =
mPhotoTapListener =
mViewTapListener =
// Finally, clear ImageView
mImageView =
public RectF getDisplayRect() {
checkMatrixBounds();
return getDisplayRect(getDrawMatrix());
public boolean setDisplayMatrix(Matrix finalMatrix) {
if (finalMatrix == null)
throw new IllegalArgumentException(&Matrix cannot be null&);
ImageView imageView = getImageView();
if (null == imageView)
if (null == imageView.getDrawable())
mSuppMatrix.set(finalMatrix);
setImageViewMatrix(getDrawMatrix());
checkMatrixBounds();
private float mLastRotation = 0;
public void setPhotoViewRotation(float degrees) {
degrees %= 360;
mSuppMatrix.postRotate(mLastRotation - degrees);
mLastRotation =
checkAndDisplayMatrix();
public ImageView getImageView() {
ImageView imageView =
if (null != mImageView) {
imageView = mImageView.get();
// If we don't have an ImageView, call cleanup()
if (null == imageView) {
cleanup();
Log.i(LOG_TAG,
&ImageView no longer exists. You should not use this PhotoViewAttacher any more.&);
return imageV
@Deprecated
public float getMinScale() {
return getMinimumScale();
public float getMinimumScale() {
return mMinS
@Deprecated
public float getMidScale() {
return getMediumScale();
public float getMediumScale() {
return mMidS
@Deprecated
public float getMaxScale() {
return getMaximumScale();
public float getMaximumScale() {
return mMaxS
public float getScale() {
return FloatMath.sqrt((float) Math.pow(getValue(mSuppMatrix, Matrix.MSCALE_X), 2) + (float) Math.pow(getValue(mSuppMatrix, Matrix.MSKEW_Y), 2));
public ScaleType getScaleType() {
return mScaleT
public void onDrag(float dx, float dy) {
if (mScaleDragDetector.isScaling()) {
+ // Do not drag if we are already scaling
if (DEBUG) {
LogManager.getLogger().d(LOG_TAG,
String.format(&onDrag: dx: %.2f. dy: %.2f&, dx, dy));
ImageView imageView = getImageView();
mSuppMatrix.postTranslate(dx, dy);
checkAndDisplayMatrix();
* Here we decide whether to let the ImageView's parent to start taking
* over the touch event.
* First we check whether this function is enabled. We never want the
* parent to take over if we're scaling. We then check the edge we're
* on, and the direction of the scroll (i.e. if we're pulling against
* the edge, aka 'overscrolling', let the parent take over).
ViewParent parent = imageView.getParent();
if (mAllowParentInterceptOnEdge) {
if (mScrollEdge == EDGE_BOTH
|| (mScrollEdge == EDGE_LEFT && dx &= 1f)
|| (mScrollEdge == EDGE_RIGHT && dx &= -1f)) {
if (null != parent)
parent.requestDisallowInterceptTouchEvent(false);
if (null != parent) {
parent.requestDisallowInterceptTouchEvent(true);
public void onFling(float startX, float startY, float velocityX,
float velocityY) {
if (DEBUG) {
LogManager.getLogger().d(
&onFling. sX: & + startX + & sY: & + startY + & Vx: &
+ velocityX + & Vy: & + velocityY);
ImageView imageView = getImageView();
mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
mCurrentFlingRunnable.fling(getImageViewWidth(imageView),
getImageViewHeight(imageView), (int) velocityX, (int) velocityY);
imageView.post(mCurrentFlingRunnable);
public void onGlobalLayout() {
ImageView imageView = getImageView();
if (null != imageView) {
if (mZoomEnabled) {
final int top = imageView.getTop();
final int right = imageView.getRight();
final int bottom = imageView.getBottom();
final int left = imageView.getLeft();
* We need to check whether the ImageView's bounds have changed.
* This would be easier if we targeted API 11+ as we could just use
* View.OnLayoutChangeListener. Instead we have to replicate the
* work, keeping track of the ImageView's bounds and then checking
* if the values change.
if (top != mIvTop || bottom != mIvBottom || left != mIvLeft
|| right != mIvRight) {
// Update our base matrix, as the bounds have changed
updateBaseMatrix(imageView.getDrawable());
// Update values as something has changed
mIvRight =
mIvBottom =
updateBaseMatrix(imageView.getDrawable());
public void onScale(float scaleFactor, float focusX, float focusY) {
if (DEBUG) {
LogManager.getLogger().d(
String.format(&onScale: scale: %.2f. fX: %.2f. fY: %.2f&,
scaleFactor, focusX, focusY));
if (getScale() & mMaxScale || scaleFactor & 1f) {
mSuppMatrix.postScale(scaleFactor, scaleFactor, focusX, focusY);
checkAndDisplayMatrix();
public boolean onTouch(View v, MotionEvent ev) {
boolean handled =
if (mZoomEnabled && hasDrawable((ImageView) v)) {
ViewParent parent = v.getParent();
switch (ev.getAction()) {
case ACTION_DOWN:
// First, disable the Parent from intercepting the touch
if (null != parent)
parent.requestDisallowInterceptTouchEvent(true);
Log.i(LOG_TAG, &onTouch getParent() returned null&);
// If we're flinging, and the user presses down, cancel
cancelFling();
case ACTION_CANCEL:
case ACTION_UP:
// If the user has zoomed less than min scale, zoom back
// to min scale
if (getScale() & mMinScale) {
RectF rect = getDisplayRect();
if (null != rect) {
v.post(new AnimatedZoomRunnable(getScale(), mMinScale,
rect.centerX(), rect.centerY()));
// Try the Scale/Drag detector
if (null != mScaleDragDetector
&& mScaleDragDetector.onTouchEvent(ev)) {
// Check to see if the user double tapped
if (null != mGestureDetector && mGestureDetector.onTouchEvent(ev)) {
public void setAllowParentInterceptOnEdge(boolean allow) {
mAllowParentInterceptOnEdge =
@Deprecated
public void setMinScale(float minScale) {
setMinimumScale(minScale);
public void setMinimumScale(float minimumScale) {
checkZoomLevels(minimumScale, mMidScale, mMaxScale);
mMinScale = minimumS
@Deprecated
public void setMidScale(float midScale) {
setMediumScale(midScale);
public void setMediumScale(float mediumScale) {
checkZoomLevels(mMinScale, mediumScale, mMaxScale);
mMidScale = mediumS
@Deprecated
public void setMaxScale(float maxScale) {
setMaximumScale(maxScale);
public void setMaximumScale(float maximumScale) {
checkZoomLevels(mMinScale, mMidScale, maximumScale);
mMaxScale = maximumS
public void setOnLongClickListener(OnLongClickListener listener) {
mLongClickListener =
public void setOnMatrixChangeListener(OnMatrixChangedListener listener) {
mMatrixChangeListener =
public void setOnPhotoTapListener(OnPhotoTapListener listener) {
mPhotoTapListener =
public OnPhotoTapListener getOnPhotoTapListener() {
return mPhotoTapL
public void setOnViewTapListener(OnViewTapListener listener) {
mViewTapListener =
public OnViewTapListener getOnViewTapListener() {
return mViewTapL
public void setScale(float scale) {
setScale(scale, false);
public void setScale(float scale, boolean animate) {
ImageView imageView = getImageView();
if (null != imageView) {
setScale(scale,
(imageView.getRight()) / 2,
(imageView.getBottom()) / 2,
public void setScale(float scale, float focalX, float focalY,
boolean animate) {
ImageView imageView = getImageView();
if (null != imageView) {
// Check to see if the scale is within bounds
if (scale & mMinScale || scale & mMaxScale) {
LogManager
.getLogger()
.i(LOG_TAG,
&Scale must be within the range of minScale and maxScale&);
if (animate) {
imageView.post(new AnimatedZoomRunnable(getScale(), scale,
focalX, focalY));
mSuppMatrix.setScale(scale, scale, focalX, focalY);
checkAndDisplayMatrix();
public void setScaleType(ScaleType scaleType) {
if (isSupportedScaleType(scaleType) && scaleType != mScaleType) {
mScaleType = scaleT
// Finally update
public void setZoomable(boolean zoomable) {
mZoomEnabled =
public void update() {
ImageView imageView = getImageView();
if (null != imageView) {
if (mZoomEnabled) {
// Make sure we using MATRIX Scale Type
setImageViewScaleTypeMatrix(imageView);
// Update the base matrix using the current drawable
updateBaseMatrix(imageView.getDrawable());
// Reset the Matrix...
resetMatrix();
public Matrix getDisplayMatrix() {
return new Matrix(getDrawMatrix());
public Matrix getDrawMatrix() {
mDrawMatrix.set(mBaseMatrix);
mDrawMatrix.postConcat(mSuppMatrix);
return mDrawM
private void cancelFling() {
if (null != mCurrentFlingRunnable) {
mCurrentFlingRunnable.cancelFling();
mCurrentFlingRunnable =
* Helper method that simply checks the Matrix, and then displays the result
private void checkAndDisplayMatrix() {
if (checkMatrixBounds()) {
setImageViewMatrix(getDrawMatrix());
private void checkImageViewScaleType() {
ImageView imageView = getImageView();
* PhotoView's getScaleType() will just divert to this.getScaleType() so
* only call if we're not attached to a PhotoView.
if (null != imageView && !(imageView instanceof IPhotoView)) {
if (!ScaleType.MATRIX.equals(imageView.getScaleType())) {
throw new IllegalStateException(
&The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher&);
private boolean checkMatrixBounds() {
final ImageView imageView = getImageView();
if (null == imageView) {
final RectF rect = getDisplayRect(getDrawMatrix());
if (null == rect) {
final float height = rect.height(), width = rect.width();
float deltaX = 0, deltaY = 0;
final int viewHeight = getImageViewHeight(imageView);
if (height &= viewHeight) {
switch (mScaleType) {
case FIT_START:
deltaY = -rect.
case FIT_END:
deltaY = viewHeight - height - rect.
deltaY = (viewHeight - height) / 2 - rect.
} else if (rect.top & 0) {
deltaY = -rect.
} else if (rect.bottom & viewHeight) {
deltaY = viewHeight - rect.
final int viewWidth = getImageViewWidth(imageView);
if (width &= viewWidth) {
switch (mScaleType) {
case FIT_START:
deltaX = -rect.
case FIT_END:
deltaX = viewWidth - width - rect.
deltaX = (viewWidth - width) / 2 - rect.
mScrollEdge = EDGE_BOTH;
} else if (rect.left & 0) {
mScrollEdge = EDGE_LEFT;
deltaX = -rect.
} else if (rect.right & viewWidth) {
deltaX = viewWidth - rect.
mScrollEdge = EDGE_RIGHT;
mScrollEdge = EDGE_NONE;
// Finally actually translate the matrix
mSuppMatrix.postTranslate(deltaX, deltaY);
* Helper method that maps the supplied Matrix to the current Drawable
* @param matrix - Matrix to map Drawable against
* @return RectF - Displayed Rectangle
private RectF getDisplayRect(Matrix matrix) {
ImageView imageView = getImageView();
if (null != imageView) {
Drawable d = imageView.getDrawable();
if (null != d) {
mDisplayRect.set(0, 0, d.getIntrinsicWidth(),
d.getIntrinsicHeight());
matrix.mapRect(mDisplayRect);
return mDisplayR
public Bitmap getVisibleRectangleBitmap() {
ImageView imageView = getImageView();
return imageView == null ? null : imageView.getDrawingCache();
public void setZoomTransitionDuration(int milliseconds) {
if (milliseconds & 0)
milliseconds = DEFAULT_ZOOM_DURATION;
this.ZOOM_DURATION =
* Helper method that 'unpacks' a Matrix and returns the required value
* @param matrix
- Matrix to unpack
* @param whichValue - Which value from Matrix.M* to return
* @return float - returned value
private float getValue(Matrix matrix, int whichValue) {
matrix.getValues(mMatrixValues);
return mMatrixValues[whichValue];
* Resets the Matrix back to FIT_CENTER, and then displays it.s
private void resetMatrix() {
mSuppMatrix.reset();
setImageViewMatrix(getDrawMatrix());
checkMatrixBounds();
private void setImageViewMatrix(Matrix matrix) {
ImageView imageView = getImageView();
if (null != imageView) {
checkImageViewScaleType();
imageView.setImageMatrix(matrix);
// Call MatrixChangedListener if needed
if (null != mMatrixChangeListener) {
RectF displayRect = getDisplayRect(matrix);
if (null != displayRect) {
mMatrixChangeListener.onMatrixChanged(displayRect);
* Calculate Matrix for FIT_CENTER
* @param d - Drawable being displayed
private void updateBaseMatrix(Drawable d) {
ImageView imageView = getImageView();
if (null == imageView || null == d) {
final float viewWidth = getImageViewWidth(imageView);
final float viewHeight = getImageViewHeight(imageView);
final int drawableWidth = d.getIntrinsicWidth();
final int drawableHeight = d.getIntrinsicHeight();
mBaseMatrix.reset();
final float widthScale = viewWidth / drawableW
final float heightScale = viewHeight / drawableH
if (mScaleType == ScaleType.CENTER) {
mBaseMatrix.postTranslate((viewWidth - drawableWidth) / 2F,
(viewHeight - drawableHeight) / 2F);
} else if (mScaleType == ScaleType.CENTER_CROP) {
float scale = Math.max(widthScale, heightScale);
mBaseMatrix.postScale(scale, scale);
mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F,
(viewHeight - drawableHeight * scale) / 2F);
} else if (mScaleType == ScaleType.CENTER_INSIDE) {
float scale = Math.min(1.0f, Math.min(widthScale, heightScale));
mBaseMatrix.postScale(scale, scale);
mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F,
(viewHeight - drawableHeight * scale) / 2F);
RectF mTempSrc = new RectF(0, 0, drawableWidth, drawableHeight);
RectF mTempDst = new RectF(0, 0, viewWidth, viewHeight);
switch (mScaleType) {
case FIT_CENTER:
mBaseMatrix
.setRectToRect(mTempSrc, mTempDst, ScaleToFit.CENTER);
case FIT_START:
mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.START);
case FIT_END:
mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.END);
case FIT_XY:
mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.FILL);
resetMatrix();
private int getImageViewWidth(ImageView imageView) {
if (null == imageView)
return imageView.getWidth() - imageView.getPaddingLeft() - imageView.getPaddingRight();
private int getImageViewHeight(ImageView imageView) {
if (null == imageView)
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
* Interface definition for a callback to be invoked when the internal Matrix has changed for
* this View.
* @author Chris Banes
public static interface OnMatrixChangedListener {
* Callback for when the Matrix displaying the Drawable has changed. This could be because
* the View's bounds have changed, or the user has zoomed.
* @param rect - Rectangle displaying the Drawable's new bounds.
void onMatrixChanged(RectF rect);
* Interface definition for a callback to be invoked when the Photo is tapped with a single
* @author Chris Banes
public static interface OnPhotoTapListener {
* A callback to receive where the user taps on a photo. You will only receive a callback if
* the user taps on the actual photo, tapping on 'whitespace' will be ignored.
* @param view - View the user tapped.
* @param x
- where the user tapped from the of the Drawable, as percentage of the
Drawable width.
* @param y
- where the user tapped from the top of the Drawable, as percentage of the
Drawable height.
void onPhotoTap(View view, float x, float y);
* Interface definition for a callback to be invoked when the ImageView is tapped with a single
* @author Chris Banes
public static interface OnViewTapListener {
* A callback to receive where the user taps on a ImageView. You will receive a callback if
* the user taps anywhere on the view, tapping on 'whitespace' will not be ignored.
* @param view - View the user tapped.
* @param x
- where the user tapped from the left of the View.
* @param y
- where the user tapped from the top of the View.
void onViewTap(View view, float x, float y);
private class AnimatedZoomRunnable implements Runnable {
private final float mFocalX, mFocalY;
private final long mStartT
private final float mZoomStart, mZoomE
public AnimatedZoomRunnable(final float currentZoom, final float targetZoom,
final float focalX, final float focalY) {
mFocalX = focalX;
mFocalY = focalY;
mStartTime = System.currentTimeMillis();
mZoomStart = currentZ
mZoomEnd = targetZ
public void run() {
ImageView imageView = getImageView();
if (imageView == null) {
float t = interpolate();
float scale = mZoomStart + t * (mZoomEnd - mZoomStart);
float deltaScale = scale / getScale();
mSuppMatrix.postScale(deltaScale, deltaScale, mFocalX, mFocalY);
checkAndDisplayMatrix();
// We haven't hit our target scale yet, so post ourselves again
if (t & 1f) {
Compat.postOnAnimation(imageView, this);
private float interpolate() {
float t = 1f * (System.currentTimeMillis() - mStartTime) / ZOOM_DURATION;
t = Math.min(1f, t);
t = sInterpolator.getInterpolation(t);
private class FlingRunnable implements Runnable {
private final ScrollerProxy mS
private int mCurrentX, mCurrentY;
public FlingRunnable(Context context) {
mScroller = ScrollerProxy.getScroller(context);
public void cancelFling() {
if (DEBUG) {
LogManager.getLogger().d(LOG_TAG, &Cancel Fling&);
mScroller.forceFinished(true);
public void fling(int viewWidth, int viewHeight, int velocityX,
int velocityY) {
final RectF rect = getDisplayRect();
if (null == rect) {
final int startX = Math.round(-rect.left);
final int minX, maxX, minY, maxY;
if (viewWidth & rect.width()) {
maxX = Math.round(rect.width() - viewWidth);
minX = maxX = startX;
final int startY = Math.round(-rect.top);
if (viewHeight & rect.height()) {
maxY = Math.round(rect.height() - viewHeight);
minY = maxY = startY;
mCurrentX = startX;
mCurrentY = startY;
if (DEBUG) {
LogManager.getLogger().d(
&fling. StartX:& + startX + & StartY:& + startY
+ & MaxX:& + maxX + & MaxY:& + maxY);
// If we actually can move, fling the scroller
if (startX != maxX || startY != maxY) {
mScroller.fling(startX, startY, velocityX, velocityY, minX,
maxX, minY, maxY, 0, 0);
public void run() {
if (mScroller.isFinished()) {
// remaining post that should not be handled
ImageView imageView = getImageView();
if (null != imageView && puteScrollOffset()) {
final int newX = mScroller.getCurrX();
final int newY = mScroller.getCurrY();
if (DEBUG) {
LogManager.getLogger().d(
&fling run(). CurrentX:& + mCurrentX + & CurrentY:&
+ mCurrentY + & NewX:& + newX + & NewY:&
mSuppMatrix.postTranslate(mCurrentX - newX, mCurrentY - newY);
setImageViewMatrix(getDrawMatrix());
mCurrentX = newX;
mCurrentY = newY;
// Post On animation
Compat.postOnAnimation(imageView, this);
(C)&&2013&&Alibaba&&Inc.&&All&&rights&&resvered.
Powered by}

我要回帖

更多关于 蓝筹股是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信