Skip to content

Commit b0a1f19

Browse files
mikejurkaAndroid (Google) Code Review
authored andcommitted
Merge "Added "No recent apps" message on phones" into ics-factoryrom
2 parents 2f15316 + 6d66708 commit b0a1f19

6 files changed

Lines changed: 84 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969

7070
</FrameLayout>
7171

72+
<include layout="@layout/status_bar_no_recent_apps"
73+
android:id="@+id/recents_no_apps"
74+
android:layout_width="match_parent"
75+
android:layout_height="match_parent"
76+
android:visibility="invisible" />
77+
7278
<View android:id="@+id/recents_dismiss_button"
7379
android:layout_width="80px"
7480
android:layout_height="@*android:dimen/status_bar_height"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767

6868
</FrameLayout>
6969

70+
<include layout="@layout/status_bar_no_recent_apps"
71+
android:id="@+id/recents_no_apps"
72+
android:layout_width="match_parent"
73+
android:layout_height="match_parent"
74+
android:visibility="invisible" />
75+
7076
<View android:id="@+id/recents_dismiss_button"
7177
android:layout_width="80px"
7278
android:layout_height="@*android:dimen/status_bar_height"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/* apps/common/assets/default/default/skins/StatusBar.xml
4+
**
5+
** Copyright 2011, The Android Open Source Project
6+
**
7+
** Licensed under the Apache License, Version 2.0 (the "License");
8+
** you may not use this file except in compliance with the License.
9+
** You may obtain a copy of the License at
10+
**
11+
** http://www.apache.org/licenses/LICENSE-2.0
12+
**
13+
** Unless required by applicable law or agreed to in writing, software
14+
** distributed under the License is distributed on an "AS IS" BASIS,
15+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
** See the License for the specific language governing permissions and
17+
** limitations under the License.
18+
*/
19+
-->
20+
21+
<FrameLayout
22+
xmlns:android="http://schemas.android.com/apk/res/android"
23+
android:layout_height="match_parent"
24+
android:layout_width="match_parent"
25+
>
26+
27+
<TextView
28+
android:layout_width="wrap_content"
29+
android:layout_height="wrap_content"
30+
android:textSize="24dp"
31+
android:textColor="#ffffffff"
32+
android:text="@string/status_bar_no_recent_apps"
33+
android:gravity="center_horizontal"
34+
android:layout_gravity="center"
35+
/>
36+
</FrameLayout>

packages/SystemUI/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
<!-- Title shown in recents popup for inspecting an application's properties -->
4242
<string name="status_bar_recent_inspect_item_title">App info</string>
4343

44+
<!-- Message shown in the middle of the screen after clicking on the recent apps button
45+
when there are no recent apps to show [CHAR LIMIT=45]-->
46+
<string name="status_bar_no_recent_apps">No recent apps</string>
47+
4448
<!-- The label in the bar at the top of the status bar when there are no notifications
4549
showing. [CHAR LIMIT=40]-->
4650
<string name="status_bar_no_notifications_title">No notifications</string>

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,20 @@
3838
View mRootView;
3939
View mScrimView;
4040
View mContentView;
41+
View mNoRecentAppsView;
4142
AnimatorSet mContentAnim;
4243
Animator.AnimatorListener mListener;
4344

4445
// the panel will start to appear this many px from the end
4546
final int HYPERSPACE_OFFRAMP = 200;
4647

47-
public Choreographer(View root, View scrim, View content, Animator.AnimatorListener listener) {
48+
public Choreographer(View root, View scrim, View content,
49+
View noRecentApps, Animator.AnimatorListener listener) {
4850
mRootView = root;
4951
mScrimView = scrim;
5052
mContentView = content;
5153
mListener = listener;
54+
mNoRecentAppsView = noRecentApps;
5255
}
5356

5457
void createAnimation(boolean appearing) {
@@ -81,8 +84,24 @@ void createAnimation(boolean appearing) {
8184
: new android.view.animation.DecelerateInterpolator(1.0f));
8285
glowAnim.setDuration(appearing ? OPEN_DURATION : CLOSE_DURATION);
8386

87+
Animator noRecentAppsFadeAnim = null;
88+
if (mNoRecentAppsView != null && // doesn't exist on large devices
89+
mNoRecentAppsView.getVisibility() == View.VISIBLE) {
90+
noRecentAppsFadeAnim = ObjectAnimator.ofFloat(mNoRecentAppsView, "alpha",
91+
mContentView.getAlpha(), appearing ? 1.0f : 0.0f);
92+
noRecentAppsFadeAnim.setInterpolator(appearing
93+
? new android.view.animation.AccelerateInterpolator(1.0f)
94+
: new android.view.animation.DecelerateInterpolator(1.0f));
95+
noRecentAppsFadeAnim.setDuration(appearing ? OPEN_DURATION : CLOSE_DURATION);
96+
}
97+
8498
mContentAnim = new AnimatorSet();
8599
final Builder builder = mContentAnim.play(glowAnim).with(posAnim);
100+
101+
if (noRecentAppsFadeAnim != null) {
102+
builder.with(noRecentAppsFadeAnim);
103+
}
104+
86105
Drawable background = mScrimView.getBackground();
87106
if (background != null) {
88107
Animator bgAnim = ObjectAnimator.ofInt(background,

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class RecentsPanelView extends RelativeLayout
8383
private int mIconDpi;
8484
private View mRecentsScrim;
8585
private View mRecentsGlowView;
86+
private View mRecentsNoApps;
8687
private ViewGroup mRecentsContainer;
8788
private Bitmap mDefaultThumbnailBackground;
8889

@@ -373,8 +374,9 @@ protected void onFinishInflate() {
373374

374375

375376
mRecentsGlowView = findViewById(R.id.recents_glow);
376-
mRecentsScrim = (View) findViewById(R.id.recents_bg_protect);
377-
mChoreo = new Choreographer(this, mRecentsScrim, mRecentsGlowView, this);
377+
mRecentsScrim = findViewById(R.id.recents_bg_protect);
378+
mRecentsNoApps = findViewById(R.id.recents_no_apps);
379+
mChoreo = new Choreographer(this, mRecentsScrim, mRecentsGlowView, mRecentsNoApps, this);
378380
mRecentsDismissButton = findViewById(R.id.recents_dismiss_button);
379381
mRecentsDismissButton.setOnClickListener(new OnClickListener() {
380382
public void onClick(View v) {
@@ -581,6 +583,9 @@ private void refreshApplicationList() {
581583
mThumbnailLoader.cancel(false);
582584
mThumbnailLoader = null;
583585
}
586+
if (mRecentsNoApps != null) { // doesn't exist on large devices
587+
mRecentsNoApps.setVisibility(View.INVISIBLE);
588+
}
584589
mActivityDescriptions = getRecentTasks();
585590
for (ActivityDescription ad : mActivityDescriptions) {
586591
ad.setThumbnail(mDefaultThumbnailBackground);
@@ -647,7 +652,11 @@ protected Void doInBackground(Void... params) {
647652
} else {
648653
// Immediately hide this panel
649654
if (DEBUG) Log.v(TAG, "Nothing to show");
650-
hide(false);
655+
if (mRecentsNoApps != null) { // doesn't exist on large devices
656+
mRecentsNoApps.setVisibility(View.VISIBLE);
657+
} else {
658+
hide(false);
659+
}
651660
}
652661
}
653662

0 commit comments

Comments
 (0)