Merge "Add a dimmed dismiss icon below task card view" into nyc-dev
diff --git a/packages/SystemUI/res/drawable-hdpi/ic_dismiss_outline.png b/packages/SystemUI/res/drawable-hdpi/ic_dismiss_outline.png
new file mode 100755
index 0000000..9afd8fa
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/ic_dismiss_outline.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_dismiss_outline.png b/packages/SystemUI/res/drawable-mdpi/ic_dismiss_outline.png
new file mode 100755
index 0000000..35737aa
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/ic_dismiss_outline.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_dismiss_outline.png b/packages/SystemUI/res/drawable-xhdpi/ic_dismiss_outline.png
new file mode 100755
index 0000000..f1bfa89
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/ic_dismiss_outline.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/recents_tv_dismiss_icon.xml b/packages/SystemUI/res/drawable/recents_tv_dismiss_icon.xml
new file mode 100644
index 0000000..7fb67a2
--- /dev/null
+++ b/packages/SystemUI/res/drawable/recents_tv_dismiss_icon.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<transition xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:drawable="@drawable/ic_dismiss_outline" />
+ <item android:drawable="@drawable/ic_cancel_white_24dp" />
+</transition>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout-television/recents_tv_card_dismiss.xml b/packages/SystemUI/res/layout-television/recents_tv_card_dismiss.xml
deleted file mode 100644
index 186a058..0000000
--- a/packages/SystemUI/res/layout-television/recents_tv_card_dismiss.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/card_dismiss"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_gravity="center_horizontal"
- android:alpha="0.0"
- tools:showIn="@layout/recents_tv_task_card_view">
- <ImageView
- android:id="@+id/card_dismiss_icon"
- android:layout_width="@dimen/recents_tv_dismiss_icon_size"
- android:layout_height="@dimen/recents_tv_dismiss_icon_size"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="@dimen/recents_tv_dismiss_icon_top_margin"
- android:layout_marginBottom="@dimen/recents_tv_dismiss_icon_bottom_margin"
- android:src="@drawable/ic_cancel_white_24dp"/>
- <TextView
- android:id="@+id/card_dismiss_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="@dimen/recents_tv_dismiss_text_size"
- android:fontFamily="@string/font_roboto_light"
- android:textColor="@color/recents_tv_dismiss_text_color"
- android:text="@string/recents_tv_dismiss"
- android:layout_gravity="center_horizontal"/>
-</LinearLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml b/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
index 9b89aa0..d2ec52d 100644
--- a/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
+++ b/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
@@ -42,5 +42,23 @@
android:gravity="center" />
</LinearLayout>
- <include layout="@layout/recents_tv_card_dismiss"/>
+ <ImageView
+ android:id="@+id/dismiss_icon"
+ android:layout_width="@dimen/recents_tv_dismiss_icon_size"
+ android:layout_height="@dimen/recents_tv_dismiss_icon_size"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="@dimen/recents_tv_dismiss_icon_top_margin"
+ android:layout_marginBottom="@dimen/recents_tv_dismiss_icon_bottom_margin"
+ android:alpha="@integer/dismiss_unselected_alpha"
+ android:src="@drawable/recents_tv_dismiss_icon" />
+ <TextView
+ android:id="@+id/card_dismiss_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="@dimen/recents_tv_dismiss_text_size"
+ android:fontFamily="@string/font_roboto_light"
+ android:textColor="@color/recents_tv_dismiss_text_color"
+ android:text="@string/recents_tv_dismiss"
+ android:alpha="0.0"
+ android:layout_gravity="center_horizontal" />
</com.android.systemui.recents.tv.views.TaskCardView>
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/dimens_tv.xml b/packages/SystemUI/res/values/dimens_tv.xml
index 367dd1d..c2de150 100644
--- a/packages/SystemUI/res/values/dimens_tv.xml
+++ b/packages/SystemUI/res/values/dimens_tv.xml
@@ -46,7 +46,7 @@
<!-- Values for card dismiss state -->
<dimen name="recents_tv_dismiss_shift_down">48dip</dimen>
<dimen name="recents_tv_dismiss_top_margin">356dip</dimen>
- <dimen name="recents_tv_dismiss_icon_size">24dip</dimen>
+ <dimen name="recents_tv_dismiss_icon_size">19dip</dimen>
<dimen name="recents_tv_dismiss_icon_top_margin">38dip</dimen>
<dimen name="recents_tv_dismiss_icon_bottom_margin">1dip</dimen>
<dimen name="recents_tv_dismiss_text_size">12sp</dimen>
diff --git a/packages/SystemUI/res/values/values_tv.xml b/packages/SystemUI/res/values/values_tv.xml
index bd72c51..dc0483f 100644
--- a/packages/SystemUI/res/values/values_tv.xml
+++ b/packages/SystemUI/res/values/values_tv.xml
@@ -16,4 +16,5 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<item format="float" type="integer" name="unselected_scale">1.0</item>
<item format="float" type="integer" name="selected_scale">1.259</item>
+ <item format="float" type="integer" name="dismiss_unselected_alpha">0.1</item>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java
index 66d8576..084fc87 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/DismissAnimationsHolder.java
@@ -15,38 +15,64 @@
*/
package com.android.systemui.recents.tv.animations;
-
-import android.animation.Animator;
+import android.animation.Animator.AnimatorListener;
import android.content.res.Resources;
+import android.graphics.drawable.TransitionDrawable;
+import android.util.TypedValue;
import android.view.View;
+import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.TextView;
import com.android.systemui.Interpolators;
import com.android.systemui.recents.tv.views.TaskCardView;
import com.android.systemui.R;
public class DismissAnimationsHolder {
- private LinearLayout mDismissArea;
private LinearLayout mInfoField;
private View mThumbnailView;
+
private int mDismissEnterYDelta;
private int mDismissStartYDelta;
+
+ private ImageView mCardDismissIcon;
+ private TransitionDrawable mDismissDrawable;
+ private TextView mDismissText;
+
+ private float mDismissUnselectedAlpha;
private long mShortDuration;
private long mLongDuration;
public DismissAnimationsHolder(TaskCardView taskCardView) {
+
mInfoField = (LinearLayout) taskCardView.findViewById(R.id.card_info_field);
- mDismissArea = (LinearLayout) taskCardView.findViewById(R.id.card_dismiss);
mThumbnailView = taskCardView.findViewById(R.id.card_view_thumbnail);
+ mCardDismissIcon = (ImageView) taskCardView.findViewById(R.id.dismiss_icon);
+ mDismissDrawable = (TransitionDrawable) mCardDismissIcon.getDrawable();
+ mDismissDrawable.setCrossFadeEnabled(true);
+ mDismissText = (TextView) taskCardView.findViewById(R.id.card_dismiss_text);
+
Resources res = taskCardView.getResources();
mDismissEnterYDelta = res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
mDismissStartYDelta = mDismissEnterYDelta * 2;
mShortDuration = res.getInteger(R.integer.dismiss_short_duration);
mLongDuration = res.getInteger(R.integer.dismiss_long_duration);
+ mDismissUnselectedAlpha = res.getFloat(R.integer.dismiss_unselected_alpha);
}
public void startEnterAnimation() {
- mDismissArea.animate()
+ mCardDismissIcon.animate()
+ .setDuration(mShortDuration)
+ .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
+ .alpha(1.0f)
+ .withStartAction(new Runnable() {
+ @Override
+ public void run() {
+ mDismissDrawable.startTransition(0);
+ }
+ });
+
+ mDismissText.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.alpha(1.0f);
@@ -65,7 +91,18 @@
}
public void startExitAnimation() {
- mDismissArea.animate()
+ mCardDismissIcon.animate()
+ .setDuration(mShortDuration)
+ .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
+ .alpha(mDismissUnselectedAlpha)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ mDismissDrawable.reverseTransition(0);
+ }
+ });
+
+ mDismissText.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.alpha(0.0f);
@@ -83,8 +120,19 @@
.alpha(1.0f);
}
- public void startDismissAnimation(Animator.AnimatorListener listener) {
- mDismissArea.animate()
+ public void startDismissAnimation(AnimatorListener listener) {
+ mCardDismissIcon.animate()
+ .setDuration(mShortDuration)
+ .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
+ .alpha(0.0f)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ mDismissDrawable.reverseTransition(0);
+ }
+ });
+
+ mDismissText.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.alpha(0.0f);
@@ -109,5 +157,7 @@
mInfoField.animate().setListener(null);
mThumbnailView.setAlpha(1.0f);
mThumbnailView.setTranslationY(0);
+ mCardDismissIcon.setAlpha(mDismissUnselectedAlpha);
+ mDismissText.setAlpha(0.0f);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java
index 9edd5af..be69552 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/animations/ViewFocusAnimator.java
@@ -39,12 +39,12 @@
private final int mAnimDuration;
private final Interpolator mFocusInterpolator;
- protected View mTargetView;
+ protected TaskCardView mTargetView;
private float mFocusProgress;
ObjectAnimator mFocusAnimation;
- public ViewFocusAnimator(View view) {
+ public ViewFocusAnimator(TaskCardView view) {
mTargetView = view;
final Resources res = view.getResources();
@@ -99,9 +99,8 @@
mTargetView.setPadding((int) spacing, mTargetView.getPaddingTop(),
(int) spacing, mTargetView.getPaddingBottom());
- if (mTargetView instanceof TaskCardView) {
- ((TaskCardView) mTargetView).getThumbnailView().setZ(z);
- }
+
+ mTargetView.getThumbnailView().setZ(z);
}
public float getFocusProgress() {