Java Code Examples for android.widget.ImageView#removeCallbacks()
The following examples show how to use
android.widget.ImageView#removeCallbacks() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RawDataDiceView.java From bither-android with Apache License 2.0 | 6 votes |
public void removeAllData() { int size = data.size(); data.clear(); for (int i = 0; i < size; i++) { final ImageView iv = (ImageView) ((FrameLayout) getChildAt(i)).getChildAt(0); if (iv.getVisibility() == View.VISIBLE) { ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(300); anim.setFillAfter(true); iv.startAnimation(anim); if (iv.getTag() != null && iv.getTag() instanceof HideIvRunnable) { iv.removeCallbacks((Runnable) iv.getTag()); } HideIvRunnable r = new HideIvRunnable(iv); iv.setTag(r); iv.postDelayed(r, 300); } } }
Example 2
Source File: RawDataDiceView.java From bither-android with Apache License 2.0 | 6 votes |
public void deleteLast() { int size = data.size(); if (size <= 0) { return; } data.remove(size - 1); final ImageView iv = (ImageView) ((FrameLayout) getChildAt(size - 1)).getChildAt(0); if (iv.getVisibility() == View.VISIBLE) { ScaleAnimation anim = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(300); anim.setFillAfter(true); iv.startAnimation(anim); if (iv.getTag() != null && iv.getTag() instanceof HideIvRunnable) { iv.removeCallbacks((Runnable) iv.getTag()); } HideIvRunnable r = new HideIvRunnable(iv); iv.setTag(r); iv.postDelayed(r, 300); } }
Example 3
Source File: RawDataDiceView.java From bither-android with Apache License 2.0 | 6 votes |
public void addData(Dice d) { if (data.size() < dataLength()) { ImageView iv = (ImageView) ((FrameLayout) getChildAt(data.size())).getChildAt(0); if (iv.getTag() != null && iv.getTag() instanceof HideIvRunnable) { iv.removeCallbacks((Runnable) iv.getTag()); } data.add(d); iv.setVisibility(View.INVISIBLE); iv.setImageResource(getDrawable(d)); ScaleAnimation anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setDuration(300); iv.startAnimation(anim); iv.setVisibility(View.VISIBLE); } }
Example 4
Source File: LocationRunner.java From sketch with Apache License 2.0 | 5 votes |
/** * 定位到预览图上指定的位置 */ void location(int startX, int startY, int endX, int endY) { currentX = startX; currentY = startY; scroller.startScroll(startX, startY, endX - startX, endY - startY, 300); ImageView imageView = imageZoomer.getImageView(); imageView.removeCallbacks(this); imageView.post(this); }
Example 5
Source File: LocationRunner.java From sketch with Apache License 2.0 | 4 votes |
void cancel() { scroller.forceFinished(true); ImageView imageView = imageZoomer.getImageView(); imageView.removeCallbacks(this); }
Example 6
Source File: FlingRunner.java From sketch with Apache License 2.0 | 4 votes |
void fling(int velocityX, int velocityY) { if (!imageZoomer.isWorking()) { SLog.w(ImageZoomer.NAME, "not working. fling"); return; } RectF drawRectF = new RectF(); scaleDragHelper.getDrawRect(drawRectF); if (drawRectF.isEmpty()) { return; } Size viewSize = imageZoomer.getViewSize(); final int imageViewWidth = viewSize.getWidth(); final int imageViewHeight = viewSize.getHeight(); final int startX = Math.round(-drawRectF.left); final int minX, maxX, minY, maxY; if (imageViewWidth < drawRectF.width()) { minX = 0; maxX = Math.round(drawRectF.width() - imageViewWidth); } else { minX = maxX = startX; } final int startY = Math.round(-drawRectF.top); if (imageViewHeight < drawRectF.height()) { minY = 0; maxY = Math.round(drawRectF.height() - imageViewHeight); } else { minY = maxY = startY; } if (SLog.isLoggable(SLog.LEVEL_DEBUG | SLog.TYPE_ZOOM)) { SLog.d(ImageZoomer.NAME, "fling. start=%dx %d, min=%dx%d, max=%dx%d", startX, startY, minX, minY, maxX, maxY); } // If we actually can move, fling the scroller if (startX != maxX || startY != maxY) { currentX = startX; currentY = startY; scroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, 0, 0); } ImageView imageView = imageZoomer.getImageView(); imageView.removeCallbacks(this); imageView.post(this); }