and11

private void drawCanUseSpace(Canvas canvas) {
try {
if (cellPosition != null && cellPosition.length >= 2 && workspace.isScrollerFinished()) {
CellLayout current = (CellLayout) workspace.getCurrentCellLayout();
if (current != null && !current.isOpenFolder()) {
Drawable canUseSpace = getResources().getDrawable(R.drawable.can_use_space);
current.cellToPoint(cellPosition[0], cellPosition[1], position);
int x = position[0];
int y = position[1] + GREEN_RECT_TOP_OFFSET;
int w = x + current.getCellWidth() * dragObjectInfo.spanX
+ (current.getLongAxisCells() - dragObjectInfo.cellX) * current.getWidthGap();
int h = position[1] + (current.getCellHeight()) * dragObjectInfo.spanY
+ (current.getShortAxisCells() - dragObjectInfo.cellY) * current.getHeightGap();
matrix.setScale(CellLayout.REDUCE_FINAL_VALUE, CellLayout.REDUCE_FINAL_VALUE,
getWidth() / 2, getHeight() / 2);
canvas.save();
canvas.concat(matrix);
canUseSpace.setBounds(x, y, w, h);
canUseSpace.draw(canvas);
canvas.restore();
}
}
} catch (Exception e) {
e.printStackTrace();

}
}

private void startWingsAnimation(float start, float end, float increment, long sleepTime) {
if (transferAt != null) {
transferAt.stopAnimation();
}

transferAt = new AnimationThread(this, start, end, increment, sleepTime);
transferAt.setOnListener(transferAtListener);
transferAt.start();
}

private class DragLayerAnimationThread implements AnimationThread.AnimationListener {
public static final int MOVE_IN = 0;
public static final int MOVE_OUT = 1;
public static final int MOVE_FINISH = 2;
private int animationState = MOVE_IN;

public void onEnd() {
animationState++;
if (!mDragging || animationState == MOVE_FINISH) {
changeWingsAnimationState = false;
clearAnimationState();
}

if (!changeWingsAnimationState) {
doNotWingsAnimation();
}
}

public void onError() {
}

public void onStart() {
}

public void clearAnimationState() {
animationState = MOVE_IN;
}

public int getAnimationState() {
return animationState;
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值