@Override public void handleMessage(Message msg) { switch (msg.what) { case mMESSAGEID_SET_IMAGET_BITMAP: if (!mIsCanceled) { mImageView.setGestureImageView(mNeedAutoDrawGesture); } synchronized (mLock) { mLock.notifyAll(); } break; // 点击单个手势动画 case mMESSAGEID_AUTO_DRAW_PREVIEW_ONE_ITEM: int position = msg.arg1; // View view = (View) msg.obj; // 必须要用这样的方法。如果用适配器刷新了。获取的传递过来的View会有问题 View view = mGestureListView.getChildAt(position - mFirstVisiablePos); if (view != null) { mNeedAutoDrawGesture = mGestureList.get(position).getmGesture(); mImageView = (DiyGestureItemView) view.findViewById(R.id.my_gesture_item_icon); mImageView.setGestureImageView(mNeedAutoDrawGesture); autoDrawPreviewOneItem(); } break; default: break; } };
/** 取消单个手势动画 */ private void cancelTaskOneItem() { if (mAsyncTaskOneItem != null && mAsyncTaskOneItem.getStatus() != DrawBitmapTaskOneItem.Status.FINISHED) { mIsCanceledOneItem = true; mAsyncTaskOneItem.cancel(true); mAsyncTaskOneItem = null; if (mGestureList != null) { mImageView.setGestureImageView(mNeedAutoDrawGesture); } } }
/** 取消手势动画线程 */ private void cancelTask() { if (mAsyncTask != null && mAsyncTask.getStatus() != DrawBitmapTask.Status.FINISHED) { mIsCanceled = true; mAsyncTask.cancel(true); mAsyncTask = null; if (mDrawPosition >= mFirstVisiablePos && mDrawPosition <= mLastVisiablePos) { if (mGestureList != null) { mImageView.setGestureImageView(mNeedAutoDrawGesture); } } } }