@Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);

    final int width = r - l;
    final int height = b - t;

    /*
     * We can't use onSizeChanged here as this is called before the layout
     * of child View is actually done ... Because we need the size of some
     * child children we need to check for View size change manually
     */
    if (width != mPreviousWidth || height != mPreviousHeight) {

      mPreviousWidth = width;
      mPreviousHeight = height;

      mTouchDelegateGroup.clearTouchDelegates();

      // @formatter:off
      addTouchDelegate(
          new Rect(0, 0, mSelectButton.getWidth() + mTouchAddition, height),
          COLOR_SELECT_AREA,
          mSelectButton);

      addTouchDelegate(
          new Rect(width - mStarButton.getWidth() - mTouchAddition, 0, width, height),
          COLOR_STAR_AREA,
          mStarButton);
      // @formatter:on

      setTouchDelegate(mTouchDelegateGroup);
    }
  }
 private void addTouchDelegate(Rect rect, int color, View delegateView) {
   mTouchDelegateGroup.addTouchDelegate(new TouchDelegate(rect, delegateView));
   mTouchDelegateRecords.add(new TouchDelegateRecord(rect, color));
 }