Skip to content

Commit f1c8adc

Browse files
mikejurkaAndroid (Google) Code Review
authored andcommitted
Merge "Bug fixes in Recents"
2 parents bd5c976 + 0e8063a commit f1c8adc

File tree

8 files changed

+43
-32
lines changed

8 files changed

+43
-32
lines changed

packages/SystemUI/res/layout-land/status_bar_recent_item.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<ImageView android:id="@+id/app_thumbnail_image"
4343
android:layout_width="wrap_content"
4444
android:layout_height="wrap_content"
45+
android:visibility="invisible"
4546
/>
4647
</FrameLayout>
4748

@@ -71,6 +72,7 @@
7172
android:singleLine="true"
7273
android:ellipsize="marquee"
7374
android:visibility="invisible"
75+
android:textColor="@color/status_bar_recents_app_label_color"
7476
/>
7577

7678
<TextView android:id="@+id/app_description"

packages/SystemUI/res/layout-port/status_bar_recent_item.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<ImageView android:id="@+id/app_thumbnail_image"
4141
android:layout_width="wrap_content"
4242
android:layout_height="wrap_content"
43+
android:visibility="invisible"
4344
/>
4445
</FrameLayout>
4546

@@ -67,6 +68,7 @@
6768
android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin"
6869
android:singleLine="true"
6970
android:ellipsize="marquee"
71+
android:textColor="@color/status_bar_recents_app_label_color"
7072
/>
7173

7274
<View android:id="@+id/recents_callout_line"

packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<ImageView android:id="@+id/app_thumbnail_image"
3636
android:layout_width="wrap_content"
3737
android:layout_height="wrap_content"
38+
android:visibility="invisible"
3839
/>
3940
</FrameLayout>
4041

@@ -63,6 +64,7 @@
6364
android:layout_marginTop="32dip"
6465
android:singleLine="true"
6566
android:ellipsize="marquee"
67+
android:textColor="@color/status_bar_recents_app_label_color"
6668
/>
6769

6870
<View android:id="@+id/recents_callout_line"

packages/SystemUI/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
<drawable name="status_bar_background">#ff000000</drawable>
2424
<drawable name="status_bar_recents_background">#b3000000</drawable>
2525
<drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable>
26+
<color name="status_bar_recents_app_label_color">#ffffffff</color>
2627
<drawable name="status_bar_notification_row_background_color">#ff000000</drawable>
2728
</resources>

packages/SystemUI/src/com/android/systemui/SwipeHelper.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ public class SwipeHelper {
4141
public static final int Y = 1;
4242

4343
private float SWIPE_ESCAPE_VELOCITY = 100f; // dp/sec
44-
private int MAX_ESCAPE_ANIMATION_DURATION = 500; // ms
45-
private int MAX_DISMISS_VELOCITY = 1000; // dp/sec
46-
private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 250; // ms
44+
private int DEFAULT_ESCAPE_ANIMATION_DURATION = 200; // ms
45+
private int MAX_ESCAPE_ANIMATION_DURATION = 400; // ms
46+
private int MAX_DISMISS_VELOCITY = 2000; // dp/sec
47+
private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 150; // ms
4748

4849
public static float ALPHA_FADE_START = 0f; // fraction of thumbnail width
4950
// where fade starts
@@ -126,7 +127,10 @@ private float getAlphaForOffset(View view) {
126127
} else if (pos < viewSize * (1.0f - ALPHA_FADE_START)) {
127128
result = 1.0f + (viewSize * ALPHA_FADE_START + pos) / fadeSize;
128129
}
129-
return result;
130+
// Make .03 alpha the minimum so you always see the item a bit-- slightly below
131+
// .03, the item disappears entirely (as if alpha = 0) and that discontinuity looks
132+
// a bit jarring
133+
return Math.max(0.03f, result);
130134
}
131135

132136
// invalidate the view's own bounds all the way up the view hierarchy
@@ -213,7 +217,10 @@ public void dismissChild(final View view, float velocity) {
213217
duration = Math.min(duration,
214218
(int) (Math.abs(newPos - getTranslation(animView)) * 1000f / Math
215219
.abs(velocity)));
220+
} else {
221+
duration = DEFAULT_ESCAPE_ANIMATION_DURATION;
216222
}
223+
217224
ObjectAnimator anim = createTranslationAnimation(animView, newPos);
218225
anim.setInterpolator(new LinearInterpolator());
219226
anim.setDuration(duration);

packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
4444
private SwipeHelper mSwipeHelper;
4545
private RecentsScrollViewPerformanceHelper mPerformanceHelper;
4646

47-
private OnLongClickListener mOnLongClick = new OnLongClickListener() {
48-
public boolean onLongClick(View v) {
49-
final View anchorView = v.findViewById(R.id.app_description);
50-
final View thumbnailView = v.findViewById(R.id.app_thumbnail);
51-
mCallback.handleLongPress(v, anchorView, thumbnailView);
52-
return true;
53-
}
54-
};
55-
5647
public RecentsHorizontalScrollView(Context context, AttributeSet attrs) {
5748
super(context, attrs, 0);
5849
float densityScale = getResources().getDisplayMetrics().density;
@@ -69,8 +60,6 @@ private void update() {
6960
mLinearLayout.removeAllViews();
7061
for (int i = 0; i < mAdapter.getCount(); i++) {
7162
final View view = mAdapter.getView(i, null, mLinearLayout);
72-
view.setLongClickable(true);
73-
view.setOnLongClickListener(mOnLongClick);
7463

7564
if (mPerformanceHelper != null) {
7665
mPerformanceHelper.addViewCallback(view);
@@ -81,18 +70,30 @@ public void onClick(View v) {
8170
mCallback.dismiss();
8271
}
8372
});
73+
// We don't want a click sound when we dimiss recents
74+
view.setSoundEffectsEnabled(false);
8475

8576
OnClickListener launchAppListener = new OnClickListener() {
8677
public void onClick(View v) {
8778
mCallback.handleOnClick(view);
8879
}
8980
};
81+
OnLongClickListener longClickListener = new OnLongClickListener() {
82+
public boolean onLongClick(View v) {
83+
final View anchorView = view.findViewById(R.id.app_description);
84+
final View thumbnailView = view.findViewById(R.id.app_thumbnail);
85+
mCallback.handleLongPress(view, anchorView, thumbnailView);
86+
return true;
87+
}
88+
};
9089
final View thumbnail = view.findViewById(R.id.app_thumbnail);
9190
thumbnail.setClickable(true);
9291
thumbnail.setOnClickListener(launchAppListener);
92+
thumbnail.setOnLongClickListener(longClickListener);
9393
final View appTitle = view.findViewById(R.id.app_label);
9494
appTitle.setClickable(true);
9595
appTitle.setOnClickListener(launchAppListener);
96+
appTitle.setOnLongClickListener(longClickListener);
9697
mLinearLayout.addView(view);
9798
}
9899
// Scroll to end after layout.

packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
186186
holder.labelView = (TextView) convertView.findViewById(R.id.app_label);
187187
holder.descriptionView = (TextView) convertView.findViewById(R.id.app_description);
188188

189-
/* StateListDrawable thumbnailForegroundDrawable = new StateListDrawable();
190-
thumbnailForegroundDrawable.addState(new int[] { android.R.attr.state_pressed },
191-
mPressedDrawable);
192-
thumbnailForegroundDrawable.addState(new int[] { android.R.attr.state_selected },
193-
mPressedDrawable);
194-
((FrameLayout)holder.thumbnailView).setForeground(thumbnailForegroundDrawable);*/
195189
convertView.setTag(holder);
196190
} else {
197191
holder = (ViewHolder) convertView.getTag();

packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
4343
private SwipeHelper mSwipeHelper;
4444
private RecentsScrollViewPerformanceHelper mPerformanceHelper;
4545

46-
private OnLongClickListener mOnLongClick = new OnLongClickListener() {
47-
public boolean onLongClick(View v) {
48-
final View anchorView = v.findViewById(R.id.app_description);
49-
final View thumbnailView = v.findViewById(R.id.app_thumbnail);
50-
mCallback.handleLongPress(v, anchorView, thumbnailView);
51-
return true;
52-
}
53-
};
54-
5546
public RecentsVerticalScrollView(Context context, AttributeSet attrs) {
5647
super(context, attrs, 0);
5748
float densityScale = getResources().getDisplayMetrics().density;
@@ -83,28 +74,39 @@ private void update() {
8374
}
8475

8576
if (old == null) {
86-
view.setClickable(true);
87-
view.setOnLongClickListener(mOnLongClick);
8877
view.setOnClickListener(new OnClickListener() {
8978
public void onClick(View v) {
9079
mCallback.dismiss();
9180
}
9281
});
82+
// We don't want a click sound when we dimiss recents
83+
view.setSoundEffectsEnabled(false);
9384

9485
OnClickListener launchAppListener = new OnClickListener() {
9586
public void onClick(View v) {
9687
mCallback.handleOnClick(view);
9788
}
9889
};
90+
OnLongClickListener longClickListener = new OnLongClickListener() {
91+
public boolean onLongClick(View v) {
92+
final View anchorView = view.findViewById(R.id.app_description);
93+
final View thumbnailView = view.findViewById(R.id.app_thumbnail);
94+
mCallback.handleLongPress(view, anchorView, thumbnailView);
95+
return true;
96+
}
97+
};
9998
final View thumbnail = view.findViewById(R.id.app_thumbnail);
10099
thumbnail.setClickable(true);
101100
thumbnail.setOnClickListener(launchAppListener);
101+
thumbnail.setOnLongClickListener(longClickListener);
102102
final View appTitle = view.findViewById(R.id.app_label);
103103
appTitle.setClickable(true);
104104
appTitle.setOnClickListener(launchAppListener);
105+
appTitle.setOnLongClickListener(longClickListener);
105106
final View calloutLine = view.findViewById(R.id.recents_callout_line);
106107
calloutLine.setClickable(true);
107108
calloutLine.setOnClickListener(launchAppListener);
109+
calloutLine.setOnLongClickListener(longClickListener);
108110
mLinearLayout.addView(view);
109111
}
110112
}

0 commit comments

Comments
 (0)