android.widget.ImageView#removeCallbacks ( )源码实例Demo

下面列出了android.widget.ImageView#removeCallbacks ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bither-android   文件: RawDataDiceView.java
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);
        }
    }
}
 
源代码2 项目: bither-android   文件: RawDataDiceView.java
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);
    }
}
 
源代码3 项目: bither-android   文件: RawDataDiceView.java
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);
    }
}
 
源代码4 项目: sketch   文件: LocationRunner.java
/**
 * 定位到预览图上指定的位置
 */
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);
}
 
源代码5 项目: sketch   文件: LocationRunner.java
void cancel() {
    scroller.forceFinished(true);
    ImageView imageView = imageZoomer.getImageView();
    imageView.removeCallbacks(this);
}
 
源代码6 项目: sketch   文件: FlingRunner.java
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);
}