public void renderScreen() { if (mMovableMaskQueue.size() == 0) { if (mMaskType == MOVABLE_MASK) { mScreenView.removeAllViews(); } return; } mScreenView.removeAllViews(); Iterator<MovableMask> it = mMovableMaskQueue.iterator(); while (it.hasNext()) { MovableMask mask = it.next(); Rect rect = mask.getRect(); mScreenView.addView(mask); mask.layout(rect.left, rect.top, rect.right, rect.bottom); } }
public boolean addMovableMask(MovableMask mask) { if (mask == null) { Utils.log(TAG, "mask is null,return"); return false; } if (mMovableMaskQueue.size() == MAX_MOVABLE_MASKS) { mMovableMaskQueue.remove(); } Utils.log(TAG, "add a movable mask"); mMovableMaskQueue.add(mask); mScreenView.addView(mask); // TODO Message msg = new Message(); msg.what = MSG_KILL_MASK; msg.obj = mask; mHandler.sendMessageDelayed(msg, mask.getLife()); Rect rect = mask.getRect(); mask.layout(rect.left, rect.top, rect.right, rect.bottom); return true; }