summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michael Jurka <mikejurka@google.com> 2011-09-12 17:04:53 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-09-12 17:04:53 -0700
commitf1c8adc9ae4a3f8619da2f9942d026c2bc411882 (patch)
tree2622fc000db2eca3810e0b6f55ecc6cd05071897
parentbd5c9768c4432c6cb2bfa5f521d49ff03c087ff8 (diff)
parent0e8063a3b447e1aa5cc3171db42f735b3b6ae78e (diff)
Merge "Bug fixes in Recents"
-rw-r--r--packages/SystemUI/res/layout-land/status_bar_recent_item.xml2
-rw-r--r--packages/SystemUI/res/layout-port/status_bar_recent_item.xml2
-rw-r--r--packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml2
-rw-r--r--packages/SystemUI/res/values/colors.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/SwipeHelper.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java24
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 eae3e527fe35..167d362f3840 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 b14ef595515f..de80a51adb52 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 f4be6510657a..07088d54546a 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 4c222f9e19bc..670ee54b0470 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 ec36de76d3d3..07281d46a7be 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
@@ -213,7 +217,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 fc03a27a54c4..1c9d80d4adee 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 f7afe3ad77a7..0621b2203a80 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 b12387ad2d53..213803cedc64 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);
}
}