コード例 #1
0
  /*
   * Add one static mask to screen
   *
   * @return true success false if fail
   */
  public boolean addStaticMask(StaticMask mask) {

    if (mask == null) {
      Utils.log(TAG, "mask is null,return");
      return false;
    }

    if (mStaticMaskQueue.size() == MAX_STATIC_MASKS) {
      StaticMask removeMask = mStaticMaskQueue.remove();
      mScreenView.removeView(removeMask);
    }
    // TODO add a mask
    Utils.log(TAG, "add a static mask");
    mStaticMaskQueue.add(mask);
    mScreenView.addView(mask);
    Rect rect = mask.getRect();
    mask.layout(rect.left, rect.top, rect.right, rect.bottom);
    return true;
  }