Skip to content

Commit d3724b9

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Don't load views before onResume called." into jb-mr1-dev
2 parents 8da91a6 + ca6da00 commit d3724b9

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public void onStart() {
9494
@Override
9595
public void onResume() {
9696
mForeground = true;
97+
if (mRecentsPanel != null) {
98+
mRecentsPanel.refreshViews();
99+
}
97100
super.onResume();
98101
}
99102

@@ -186,4 +189,7 @@ private void handleIntent(Intent intent) {
186189
}
187190
}
188191

192+
boolean isForeground() {
193+
return mForeground;
194+
}
189195
}

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import android.app.TaskStackBuilder;
2525
import android.content.Context;
2626
import android.content.Intent;
27-
import android.content.res.Configuration;
2827
import android.content.res.Resources;
2928
import android.content.res.TypedArray;
3029
import android.graphics.Bitmap;
@@ -67,7 +66,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
6766
StatusBarPanel, Animator.AnimatorListener {
6867
static final String TAG = "RecentsPanelView";
6968
static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
70-
private Context mContext;
7169
private PopupMenu mPopup;
7270
private View mRecentsScrim;
7371
private View mRecentsNoApps;
@@ -203,7 +201,6 @@ public RecentsPanelView(Context context, AttributeSet attrs) {
203201

204202
public RecentsPanelView(Context context, AttributeSet attrs, int defStyle) {
205203
super(context, attrs, defStyle);
206-
mContext = context;
207204
updateValuesFromResources();
208205

209206
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecentsPanelView,
@@ -374,7 +371,6 @@ public void updateValuesFromResources() {
374371
protected void onFinishInflate() {
375372
super.onFinishInflate();
376373

377-
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
378374
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
379375
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
380376
mListAdapter = new TaskDescriptionAdapter(mContext);
@@ -488,7 +484,7 @@ void onTaskThumbnailLoaded(TaskDescription td) {
488484
}
489485
}
490486
}
491-
}
487+
}
492488
showIfReady();
493489
}
494490

@@ -508,6 +504,12 @@ public void onTaskLoadingCancelled() {
508504
}
509505
}
510506

507+
public void refreshViews() {
508+
mListAdapter.notifyDataSetInvalidated();
509+
updateUiElements();
510+
showIfReady();
511+
}
512+
511513
public void refreshRecentTasksList() {
512514
refreshRecentTasksList(null, false);
513515
}
@@ -530,12 +532,12 @@ public void onTasksLoaded(ArrayList<TaskDescription> tasks, boolean firstScreenf
530532
} else {
531533
mRecentTaskDescriptions.addAll(tasks);
532534
}
533-
mListAdapter.notifyDataSetInvalidated();
534-
updateUiElements(getResources().getConfiguration());
535-
showIfReady();
535+
if (((RecentsActivity)mContext).isForeground()) {
536+
refreshViews();
537+
}
536538
}
537539

538-
private void updateUiElements(Configuration config) {
540+
private void updateUiElements() {
539541
final int items = mRecentTaskDescriptions.size();
540542

541543
mRecentsContainer.setVisibility(items > 0 ? View.VISIBLE : View.GONE);

0 commit comments

Comments
 (0)