初始化 @param context
(Context context)
| 58 | * @param context |
| 59 | */ |
| 60 | private void init(Context context) { |
| 61 | mContext = context; |
| 62 | |
| 63 | mPaint = new Paint(); |
| 64 | mPaint.setColor(0xffFF5317); |
| 65 | mPaint.setStyle(Paint.Style.FILL); |
| 66 | mPaint.setAntiAlias(true); |
| 67 | |
| 68 | okBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.checkres); |
| 69 | |
| 70 | mHandler = new Handler() { |
| 71 | @Override |
| 72 | public void handleMessage(Message msg) { |
| 73 | super.handleMessage(msg); |
| 74 | if (animCurrentPage < animMaxPage && animCurrentPage >= 0) { |
| 75 | invalidate(); |
| 76 | if (animState == ANIM_NULL) |
| 77 | return; |
| 78 | if (animState == ANIM_CHECK) { |
| 79 | |
| 80 | animCurrentPage++; |
| 81 | } else if (animState == ANIM_UNCHECK) { |
| 82 | animCurrentPage--; |
| 83 | } |
| 84 | |
| 85 | this.sendEmptyMessageDelayed(0, animDuration / animMaxPage); |
| 86 | Log.e("AAA", "Count=" + animCurrentPage); |
| 87 | } else { |
| 88 | if (isCheck) { |
| 89 | animCurrentPage = animMaxPage - 1; |
| 90 | } else { |
| 91 | animCurrentPage = -1; |
| 92 | } |
| 93 | invalidate(); |
| 94 | animState = ANIM_NULL; |
| 95 | } |
| 96 | } |
| 97 | }; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | /** |