/** ** View.OnClickListener Implementation *** */
 @Override
 public void onClick(final View v) {
   final TaskView tv = this;
   final boolean delayViewClick = (v != this) && (v != mActionButtonView);
   if (delayViewClick) {
     // We purposely post the handler delayed to allow for the touch feedback to draw
     postDelayed(
         new Runnable() {
           @Override
           public void run() {
             if (Constants.DebugFlags.App.EnableTaskFiltering
                 && v == mHeaderView.mApplicationIcon) {
               if (mCb != null) {
                 mCb.onTaskViewAppIconClicked(tv);
               }
             } else if (v == mHeaderView.mDismissButton) {
               dismissTask();
             }
           }
         },
         125);
   } else {
     if (v == mActionButtonView) {
       // Reset the translation of the action button before we animate it out
       mActionButtonView.setTranslationZ(0f);
     }
     if (mCb != null) {
       mCb.onTaskViewClicked(tv, tv.getTask(), (v == mActionButtonView));
     }
   }
 }
 /** Sets whether this view should be clipped, or clipped against. */
 void setClipViewInStack(boolean clip) {
   if (clip != mClipViewInStack) {
     mClipViewInStack = clip;
     if (mCb != null) {
       mCb.onTaskViewClipStateChanged(this);
     }
   }
 }
 /** ** View.OnLongClickListener Implementation *** */
 @Override
 public boolean onLongClick(View v) {
   if (v == mHeaderView.mApplicationIcon) {
     if (mCb != null) {
       boolean showDevShortcuts =
           Settings.Secure.getInt(
                   v.getContext().getContentResolver(), Settings.Secure.DEVELOPMENT_SHORTCUT, 0)
               != 0;
       if (showDevShortcuts) {
         mCb.onTaskViewLongClicked(this);
       } else {
         mCb.onTaskViewAppInfoClicked(this);
       }
       return true;
     }
   }
   return false;
 }
  /** Unsets the focused task explicitly. */
  void unsetFocusedTask() {
    mIsFocused = false;
    if (mFocusAnimationsEnabled) {
      // Un-focus the header bar
      mHeaderView.onTaskViewFocusChanged(false, true);
    }

    // Update the thumbnail alpha with the focus
    mThumbnailView.onFocusChanged(false);
    // Call the callback
    if (mCb != null) {
      mCb.onTaskViewFocusChanged(this, false);
    }
    invalidate();
  }
 /**
  * Sets the focused task explicitly. We need a separate flag because requestFocus() won't happen
  * if the view is not currently visible, or we are in touch state (where we still want to keep
  * track of focus).
  */
 public void setFocusedTask(boolean animateFocusedState) {
   mIsFocused = true;
   if (mFocusAnimationsEnabled) {
     // Focus the header bar
     mHeaderView.onTaskViewFocusChanged(true, animateFocusedState);
   }
   // Update the thumbnail alpha with the focus
   mThumbnailView.onFocusChanged(true);
   // Call the callback
   if (mCb != null) {
     mCb.onTaskViewFocusChanged(this, true);
   }
   // Workaround, we don't always want it focusable in touch mode, but we want the first task
   // to be focused after the enter-recents animation, which can be triggered from either touch
   // or keyboard
   setFocusableInTouchMode(true);
   requestFocus();
   setFocusableInTouchMode(false);
   invalidate();
 }