diff options
8 files changed, 43 insertions, 32 deletions
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml index eae3e52..167d362 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml @@ -42,6 +42,7 @@ <ImageView android:id="@+id/app_thumbnail_image" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:visibility="invisible" /> </FrameLayout> @@ -71,6 +72,7 @@ android:singleLine="true" android:ellipsize="marquee" android:visibility="invisible" + android:textColor="@color/status_bar_recents_app_label_color" /> <TextView android:id="@+id/app_description" diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml index b14ef59..de80a51 100644 --- a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml @@ -40,6 +40,7 @@ <ImageView android:id="@+id/app_thumbnail_image" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:visibility="invisible" /> </FrameLayout> @@ -67,6 +68,7 @@ android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin" android:singleLine="true" android:ellipsize="marquee" + android:textColor="@color/status_bar_recents_app_label_color" /> <View android:id="@+id/recents_callout_line" diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml index f4be651..07088d5 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml @@ -35,6 +35,7 @@ <ImageView android:id="@+id/app_thumbnail_image" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:visibility="invisible" /> </FrameLayout> @@ -63,6 +64,7 @@ android:layout_marginTop="32dip" android:singleLine="true" android:ellipsize="marquee" + android:textColor="@color/status_bar_recents_app_label_color" /> <View android:id="@+id/recents_callout_line" diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 4c222f9..670ee54 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -23,5 +23,6 @@ <drawable name="status_bar_background">#ff000000</drawable> <drawable name="status_bar_recents_background">#b3000000</drawable> <drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable> + <color name="status_bar_recents_app_label_color">#ffffffff</color> <drawable name="status_bar_notification_row_background_color">#ff000000</drawable> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 0354fd7..4d58148 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -41,9 +41,10 @@ public class SwipeHelper { public static final int Y = 1; private float SWIPE_ESCAPE_VELOCITY = 100f; // dp/sec - private int MAX_ESCAPE_ANIMATION_DURATION = 500; // ms - private int MAX_DISMISS_VELOCITY = 1000; // dp/sec - private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 250; // ms + private int DEFAULT_ESCAPE_ANIMATION_DURATION = 200; // ms + private int MAX_ESCAPE_ANIMATION_DURATION = 400; // ms + private int MAX_DISMISS_VELOCITY = 2000; // dp/sec + private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 150; // ms public static float ALPHA_FADE_START = 0f; // fraction of thumbnail width // where fade starts @@ -126,7 +127,10 @@ public class SwipeHelper { } else if (pos < viewSize * (1.0f - ALPHA_FADE_START)) { result = 1.0f + (viewSize * ALPHA_FADE_START + pos) / fadeSize; } - return result; + // Make .03 alpha the minimum so you always see the item a bit-- slightly below + // .03, the item disappears entirely (as if alpha = 0) and that discontinuity looks + // a bit jarring + return Math.max(0.03f, result); } // invalidate the view's own bounds all the way up the view hierarchy @@ -212,7 +216,10 @@ public class SwipeHelper { duration = Math.min(duration, (int) (Math.abs(newPos - getTranslation(animView)) * 1000f / Math .abs(velocity))); + } else { + duration = DEFAULT_ESCAPE_ANIMATION_DURATION; } + ObjectAnimator anim = createTranslationAnimation(animView, newPos); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(duration); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index fc03a27..1c9d80d 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -44,15 +44,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView private SwipeHelper mSwipeHelper; private RecentsScrollViewPerformanceHelper mPerformanceHelper; - private OnLongClickListener mOnLongClick = new OnLongClickListener() { - public boolean onLongClick(View v) { - final View anchorView = v.findViewById(R.id.app_description); - final View thumbnailView = v.findViewById(R.id.app_thumbnail); - mCallback.handleLongPress(v, anchorView, thumbnailView); - return true; - } - }; - public RecentsHorizontalScrollView(Context context, AttributeSet attrs) { super(context, attrs, 0); float densityScale = getResources().getDisplayMetrics().density; @@ -69,8 +60,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView mLinearLayout.removeAllViews(); for (int i = 0; i < mAdapter.getCount(); i++) { final View view = mAdapter.getView(i, null, mLinearLayout); - view.setLongClickable(true); - view.setOnLongClickListener(mOnLongClick); if (mPerformanceHelper != null) { mPerformanceHelper.addViewCallback(view); @@ -81,18 +70,30 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView mCallback.dismiss(); } }); + // We don't want a click sound when we dimiss recents + view.setSoundEffectsEnabled(false); OnClickListener launchAppListener = new OnClickListener() { public void onClick(View v) { mCallback.handleOnClick(view); } }; + OnLongClickListener longClickListener = new OnLongClickListener() { + public boolean onLongClick(View v) { + final View anchorView = view.findViewById(R.id.app_description); + final View thumbnailView = view.findViewById(R.id.app_thumbnail); + mCallback.handleLongPress(view, anchorView, thumbnailView); + return true; + } + }; final View thumbnail = view.findViewById(R.id.app_thumbnail); thumbnail.setClickable(true); thumbnail.setOnClickListener(launchAppListener); + thumbnail.setOnLongClickListener(longClickListener); final View appTitle = view.findViewById(R.id.app_label); appTitle.setClickable(true); appTitle.setOnClickListener(launchAppListener); + appTitle.setOnLongClickListener(longClickListener); mLinearLayout.addView(view); } // Scroll to end after layout. diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index f7afe3a..0621b22 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -186,12 +186,6 @@ public class RecentsPanelView extends RelativeLayout holder.labelView = (TextView) convertView.findViewById(R.id.app_label); holder.descriptionView = (TextView) convertView.findViewById(R.id.app_description); - /* StateListDrawable thumbnailForegroundDrawable = new StateListDrawable(); - thumbnailForegroundDrawable.addState(new int[] { android.R.attr.state_pressed }, - mPressedDrawable); - thumbnailForegroundDrawable.addState(new int[] { android.R.attr.state_selected }, - mPressedDrawable); - ((FrameLayout)holder.thumbnailView).setForeground(thumbnailForegroundDrawable);*/ convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index b12387a..213803c 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -43,15 +43,6 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper private SwipeHelper mSwipeHelper; private RecentsScrollViewPerformanceHelper mPerformanceHelper; - private OnLongClickListener mOnLongClick = new OnLongClickListener() { - public boolean onLongClick(View v) { - final View anchorView = v.findViewById(R.id.app_description); - final View thumbnailView = v.findViewById(R.id.app_thumbnail); - mCallback.handleLongPress(v, anchorView, thumbnailView); - return true; - } - }; - public RecentsVerticalScrollView(Context context, AttributeSet attrs) { super(context, attrs, 0); float densityScale = getResources().getDisplayMetrics().density; @@ -83,28 +74,39 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper } if (old == null) { - view.setClickable(true); - view.setOnLongClickListener(mOnLongClick); view.setOnClickListener(new OnClickListener() { public void onClick(View v) { mCallback.dismiss(); } }); + // We don't want a click sound when we dimiss recents + view.setSoundEffectsEnabled(false); OnClickListener launchAppListener = new OnClickListener() { public void onClick(View v) { mCallback.handleOnClick(view); } }; + OnLongClickListener longClickListener = new OnLongClickListener() { + public boolean onLongClick(View v) { + final View anchorView = view.findViewById(R.id.app_description); + final View thumbnailView = view.findViewById(R.id.app_thumbnail); + mCallback.handleLongPress(view, anchorView, thumbnailView); + return true; + } + }; final View thumbnail = view.findViewById(R.id.app_thumbnail); thumbnail.setClickable(true); thumbnail.setOnClickListener(launchAppListener); + thumbnail.setOnLongClickListener(longClickListener); final View appTitle = view.findViewById(R.id.app_label); appTitle.setClickable(true); appTitle.setOnClickListener(launchAppListener); + appTitle.setOnLongClickListener(longClickListener); final View calloutLine = view.findViewById(R.id.recents_callout_line); calloutLine.setClickable(true); calloutLine.setOnClickListener(launchAppListener); + calloutLine.setOnLongClickListener(longClickListener); mLinearLayout.addView(view); } } |