diff options
4 files changed, 31 insertions, 20 deletions
diff --git a/core/java/android/app/Presentation.java b/core/java/android/app/Presentation.java index eb5a652..b5e5244 100644 --- a/core/java/android/app/Presentation.java +++ b/core/java/android/app/Presentation.java @@ -32,24 +32,26 @@ import android.util.TypedValue; /** * Base class for presentations. - * + * <p> * A presentation is a special kind of dialog whose purpose is to present * content on a secondary display. A {@link Presentation} is associated with * the target {@link Display} at creation time and configures its context and * resource configuration according to the display's metrics. - * + * </p><p> * Notably, the {@link Context} of a presentation is different from the context * of its containing {@link Activity}. It is important to inflate the layout * of a presentation and load other resources using the presentation's own context * to ensure that assets of the correct size and density for the target display * are loaded. - * + * </p><p> * A presentation is automatically canceled (see {@link Dialog#cancel()}) when * the display to which it is attached is removed. An activity should take * care of pausing and resuming whatever content is playing within the presentation - * whenever the activity itself is paused or resume. + * whenever the activity itself is paused or resumed. + * </p> * - * @see {@link DisplayManager} for information on how to enumerate displays. + * @see DisplayManager for information on how to enumerate displays and receive + * notifications when displays are added or removed. */ public class Presentation extends Dialog { private static final String TAG = "Presentation"; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 87221e0..13de538 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2773,14 +2773,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * {@hide} */ @ViewDebug.ExportedProperty(category = "padding") - protected int mPaddingLeft; + protected int mPaddingLeft = UNDEFINED_PADDING; /** * The right padding in pixels, that is the distance in pixels between the * right edge of this view and the right edge of its content. * {@hide} */ @ViewDebug.ExportedProperty(category = "padding") - protected int mPaddingRight; + protected int mPaddingRight = UNDEFINED_PADDING; /** * The top padding in pixels, that is the distance in pixels between the * top edge of this view and the top edge of its content. @@ -3620,9 +3620,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // (stored at this point in mPadding*) mUserPaddingLeftInitial = leftPadding >= 0 ? leftPadding : mPaddingLeft; mUserPaddingRightInitial = rightPadding >= 0 ? rightPadding : mPaddingRight; - internalSetPadding(mUserPaddingLeftInitial, + internalSetPadding( + mUserPaddingLeftInitial != UNDEFINED_PADDING ? mUserPaddingLeftInitial : 0, topPadding >= 0 ? topPadding : mPaddingTop, - mUserPaddingRightInitial, + mUserPaddingRightInitial != UNDEFINED_PADDING ? mUserPaddingRightInitial : 0, bottomPadding >= 0 ? bottomPadding : mPaddingBottom); if (viewFlagMasks != 0) { @@ -11597,8 +11598,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mUserPaddingStart != UNDEFINED_PADDING) { mUserPaddingLeft = mUserPaddingStart; } - if (mUserPaddingRightInitial == UNDEFINED_PADDING - && mUserPaddingEnd != UNDEFINED_PADDING) { + if (mUserPaddingRightInitial == UNDEFINED_PADDING && + mUserPaddingEnd != UNDEFINED_PADDING) { mUserPaddingRight = mUserPaddingEnd; } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java index 9c3756c..291f38c 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java @@ -94,6 +94,9 @@ public class RecentsActivity extends Activity { @Override public void onResume() { mForeground = true; + if (mRecentsPanel != null) { + mRecentsPanel.refreshViews(); + } super.onResume(); } @@ -186,4 +189,7 @@ public class RecentsActivity extends Activity { } } + boolean isForeground() { + return mForeground; + } } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index 04e38a4..0caa671 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -24,7 +24,6 @@ import android.app.ActivityOptions; import android.app.TaskStackBuilder; import android.content.Context; import android.content.Intent; -import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; @@ -67,7 +66,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener StatusBarPanel, Animator.AnimatorListener { static final String TAG = "RecentsPanelView"; static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false; - private Context mContext; private PopupMenu mPopup; private View mRecentsScrim; private View mRecentsNoApps; @@ -203,7 +201,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener public RecentsPanelView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - mContext = context; updateValuesFromResources(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecentsPanelView, @@ -374,7 +371,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener protected void onFinishInflate() { super.onFinishInflate(); - mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container); mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy); mListAdapter = new TaskDescriptionAdapter(mContext); @@ -488,7 +484,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener } } } - } + } showIfReady(); } @@ -508,6 +504,12 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener } } + public void refreshViews() { + mListAdapter.notifyDataSetInvalidated(); + updateUiElements(); + showIfReady(); + } + public void refreshRecentTasksList() { refreshRecentTasksList(null, false); } @@ -530,12 +532,12 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener } else { mRecentTaskDescriptions.addAll(tasks); } - mListAdapter.notifyDataSetInvalidated(); - updateUiElements(getResources().getConfiguration()); - showIfReady(); + if (((RecentsActivity)mContext).isForeground()) { + refreshViews(); + } } - private void updateUiElements(Configuration config) { + private void updateUiElements() { final int items = mRecentTaskDescriptions.size(); mRecentsContainer.setVisibility(items > 0 ? View.VISIBLE : View.GONE); |