Merge "Don't load views before onResume called." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d3724b951e
@@ -94,6 +94,9 @@ public class RecentsActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
mForeground = true;
|
mForeground = true;
|
||||||
|
if (mRecentsPanel != null) {
|
||||||
|
mRecentsPanel.refreshViews();
|
||||||
|
}
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,4 +189,7 @@ public class RecentsActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isForeground() {
|
||||||
|
return mForeground;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.app.ActivityOptions;
|
|||||||
import android.app.TaskStackBuilder;
|
import android.app.TaskStackBuilder;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@@ -67,7 +66,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
|
|||||||
StatusBarPanel, Animator.AnimatorListener {
|
StatusBarPanel, Animator.AnimatorListener {
|
||||||
static final String TAG = "RecentsPanelView";
|
static final String TAG = "RecentsPanelView";
|
||||||
static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
|
static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false;
|
||||||
private Context mContext;
|
|
||||||
private PopupMenu mPopup;
|
private PopupMenu mPopup;
|
||||||
private View mRecentsScrim;
|
private View mRecentsScrim;
|
||||||
private View mRecentsNoApps;
|
private View mRecentsNoApps;
|
||||||
@@ -203,7 +201,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
|
|||||||
|
|
||||||
public RecentsPanelView(Context context, AttributeSet attrs, int defStyle) {
|
public RecentsPanelView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
mContext = context;
|
|
||||||
updateValuesFromResources();
|
updateValuesFromResources();
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecentsPanelView,
|
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecentsPanelView,
|
||||||
@@ -374,7 +371,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
|
|||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
|
|
||||||
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
|
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
|
||||||
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
|
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
|
||||||
mListAdapter = new TaskDescriptionAdapter(mContext);
|
mListAdapter = new TaskDescriptionAdapter(mContext);
|
||||||
@@ -488,7 +484,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showIfReady();
|
showIfReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,6 +504,12 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void refreshViews() {
|
||||||
|
mListAdapter.notifyDataSetInvalidated();
|
||||||
|
updateUiElements();
|
||||||
|
showIfReady();
|
||||||
|
}
|
||||||
|
|
||||||
public void refreshRecentTasksList() {
|
public void refreshRecentTasksList() {
|
||||||
refreshRecentTasksList(null, false);
|
refreshRecentTasksList(null, false);
|
||||||
}
|
}
|
||||||
@@ -530,12 +532,12 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
|
|||||||
} else {
|
} else {
|
||||||
mRecentTaskDescriptions.addAll(tasks);
|
mRecentTaskDescriptions.addAll(tasks);
|
||||||
}
|
}
|
||||||
mListAdapter.notifyDataSetInvalidated();
|
if (((RecentsActivity)mContext).isForeground()) {
|
||||||
updateUiElements(getResources().getConfiguration());
|
refreshViews();
|
||||||
showIfReady();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUiElements(Configuration config) {
|
private void updateUiElements() {
|
||||||
final int items = mRecentTaskDescriptions.size();
|
final int items = mRecentTaskDescriptions.size();
|
||||||
|
|
||||||
mRecentsContainer.setVisibility(items > 0 ? View.VISIBLE : View.GONE);
|
mRecentsContainer.setVisibility(items > 0 ? View.VISIBLE : View.GONE);
|
||||||
|
|||||||
Reference in New Issue
Block a user