From 0e8063a3b447e1aa5cc3171db42f735b3b6ae78e Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Fri, 9 Sep 2011 15:31:55 -0700 Subject: Bug fixes in Recents - Making thumbnails invisible until loaded (fixes regression) - Speed up dismiss animation from menu - Make the max swipe velocity greater - Make only the thumbnail and app title long-clickable - No more click sound when tapping outside the thumbnails to dismiss Recents - Tweaking color of recents app label text Change-Id: If7b6cd59e92feb0472eb3ea266733549cb9f4d4b --- .../src/com/android/systemui/SwipeHelper.java | 15 ++++++++++---- .../recent/RecentsHorizontalScrollView.java | 23 +++++++++++---------- .../android/systemui/recent/RecentsPanelView.java | 6 ------ .../systemui/recent/RecentsVerticalScrollView.java | 24 ++++++++++++---------- 4 files changed, 36 insertions(+), 32 deletions(-) (limited to 'packages/SystemUI/src') 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); } } -- cgit v1.1