GuidedStepFragment: fix the unfocus alpha being overriden.

A regression of fixing b/20759626: if onAnimateItemFocused()
changes item alpha,  it will be overriden by animator created by
onAnimateItemPressed(false).

Introduce onAnimateItemPressedCancelled() which sets alpha without animation.
Let onAnimateItemFocused() be executed after onAnimateItemPressedCancelled().

Bug 20759626

Change-Id: I61d100d93c47afa1ad9dc6c070dc9477eb092dc9
diff --git a/v17/leanback/api/current.txt b/v17/leanback/api/current.txt
index 37f1ed4..551dde0 100644
--- a/v17/leanback/api/current.txt
+++ b/v17/leanback/api/current.txt
@@ -1066,6 +1066,7 @@
     method public void onAnimateItemChecked(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, boolean);
     method public void onAnimateItemFocused(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, boolean);
     method public void onAnimateItemPressed(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, boolean);
+    method public void onAnimateItemPressedCancelled(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder);
     method public void onBindViewHolder(android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder, android.support.v17.leanback.widget.GuidedAction);
     method public android.view.View onCreateView(android.view.LayoutInflater, android.view.ViewGroup);
     method public android.support.v17.leanback.widget.GuidedActionsStylist.ViewHolder onCreateViewHolder(android.view.ViewGroup);
diff --git a/v17/leanback/src/android/support/v17/leanback/app/GuidedActionAdapter.java b/v17/leanback/src/android/support/v17/leanback/app/GuidedActionAdapter.java
index 719ff9f..b70c50d 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/GuidedActionAdapter.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/GuidedActionAdapter.java
@@ -358,7 +358,6 @@
         @Override
         public void onFocusChange(View v, boolean hasFocus) {
             ActionViewHolder avh = (ActionViewHolder)mRecyclerView.getChildViewHolder(v);
-            mStylist.onAnimateItemFocused(avh.mStylistViewHolder, hasFocus);
             if (hasFocus) {
                 mSelectedView = v;
                 if (mFocusListener != null) {
@@ -368,10 +367,11 @@
                 }
             } else {
                 if (mSelectedView == v) {
-                    mStylist.onAnimateItemPressed(avh.mStylistViewHolder, false);
+                    mStylist.onAnimateItemPressedCancelled(avh.mStylistViewHolder);
                     mSelectedView = null;
                 }
             }
+            mStylist.onAnimateItemFocused(avh.mStylistViewHolder, hasFocus);
         }
     }
 
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
index fc43d53..d80d474 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
@@ -591,6 +591,14 @@
     }
 
     /**
+     * Resets the view holder's view to unpressed state.
+     * @param vh The view holder associated with the relevant action.
+     */
+    public void onAnimateItemPressedCancelled(ViewHolder vh) {
+        createAnimator(vh.view, R.attr.guidedActionUnpressedAnimation).end();
+    }
+
+    /**
      * Animates the view holder's view (or subviews thereof) when the action has had its check
      * state changed.
      * @param vh The view holder associated with the relevant action.