See the License for the specific language governing permissions and
limitations under the License.
-->
+<!-- extends FrameLayout -->
<com.android.systemui.statusbar.policy.HeadsUpNotificationView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:background="@drawable/heads_up_scrim">
<FrameLayout
+ android:layout_width="@dimen/notification_panel_width"
android:layout_height="wrap_content"
+ android:layout_gravity="@integer/notification_panel_layout_gravity"
android:paddingStart="@dimen/notification_side_padding"
android:paddingEnd="@dimen/notification_side_padding"
android:elevation="8dp"
- android:id="@+id/content_holder"
- style="@style/NotificationsQuickSettings" />
+ android:id="@+id/content_holder" />
</com.android.systemui.statusbar.policy.HeadsUpNotificationView>
\ No newline at end of file
android:visibility="invisible" />
<com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer
- style="@style/NotificationsQuickSettings"
+ android:layout_width="@dimen/notification_panel_width"
+ android:layout_height="match_parent"
+ android:layout_gravity="@integer/notification_panel_layout_gravity"
android:id="@+id/notification_container_parent"
android:clipToPadding="false"
android:clipChildren="false">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:id="@+id/header"
- style="@style/StatusBarHeader"
+ android:layout_width="@dimen/notification_panel_width"
android:layout_height="@dimen/status_bar_header_height"
+ android:layout_gravity="@integer/notification_panel_layout_gravity"
android:paddingStart="@dimen/notification_side_padding"
android:paddingEnd="@dimen/notification_side_padding"
android:baselineAligned="false"
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="@dimen/volume_panel_width"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginLeft="@dimen/notification_side_padding"
+ android:layout_marginRight="@dimen/notification_side_padding"
android:background="@drawable/qs_background_primary"
android:translationZ="@dimen/volume_panel_z"
android:layout_marginBottom="@dimen/volume_panel_z">
value at runtime for some things) -->
<integer name="status_bar_recents_bg_gradient_degrees">90</integer>
- <!-- The number of columns in the QuickSettings -->
- <integer name="quick_settings_num_columns">4</integer>
-
<!-- The maximum number of rows in the QuickSettings -->
<integer name="quick_settings_max_rows">2</integer>
<!-- The side padding for the task stack as a percentage of the width. -->
<item name="recents_stack_width_padding_percentage" format="float" type="dimen">0.2229</item>
- <!-- Width of the zen mode interstitial dialog. -->
- <dimen name="zen_mode_dialog_width">384dp</dimen>
+ <!-- Standard notification width + gravity -->
+ <dimen name="notification_panel_width">@dimen/standard_notification_panel_width</dimen>
+ <integer name="notification_panel_layout_gravity">@integer/standard_notification_panel_layout_gravity</integer>
</resources>
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources>
- <!-- The number of columns in the QuickSettings -->
- <integer name="quick_settings_num_columns">4</integer>
-
<!-- The maximum number of rows in the QuickSettings -->
<integer name="quick_settings_max_rows">4</integer>
*/
-->
<resources>
- <!-- The width of the notification panel window: 400 + 16 + 16 (padding in the bg drawable) -->
- <dimen name="notification_panel_width">432dp</dimen>
-
- <!-- Gravity for the notification panel -->
- <!-- 0x31 = top|center_horizontal -->
- <integer name="notification_panel_layout_gravity">0x31</integer>
+ <!-- Standard notification width + gravity -->
+ <dimen name="notification_panel_width">@dimen/standard_notification_panel_width</dimen>
+ <integer name="notification_panel_layout_gravity">@integer/standard_notification_panel_layout_gravity</integer>
<!-- Diameter of outer shape drawable shown in navbar search-->
<dimen name="navbar_search_outerring_diameter">430dip</dimen>
<!-- The side padding for the task stack as a percentage of the width. -->
<item name="recents_stack_width_padding_percentage" format="float" type="dimen">0.075</item>
- <!-- Width of the zen mode interstitial dialog. -->
- <dimen name="zen_mode_dialog_width">384dp</dimen>
-
<!-- The fraction of the screen height where the clock on the Keyguard has its center. The
max value is used when no notifications are displaying, and the min value is when the
highest possible number of notifications are showing. -->
<item name="android:layout_width">480dp</item>
</style>
- <style name="NotificationsQuickSettings">
- <item name="android:layout_width">@dimen/notification_panel_width</item>
- <item name="android:layout_height">match_parent</item>
- <item name="android:layout_gravity">top|center_horizontal</item>
- </style>
-
- <style name="StatusBarHeader">
- <item name="android:layout_width">@dimen/notification_panel_width</item>
- <item name="android:layout_gravity">center_horizontal</item>
- </style>
-
<style name="SearchPanelCard">
<item name="android:layout_width">550dp</item>
<item name="android:layout_height">@dimen/search_panel_card_height</item>
be situations where they don't sync up perfectly with PhoneStatusBar. -->
<!-- ======================================== -->
- <!-- The width of the ticker, including the icon -->
- <dimen name="notification_ticker_width">360dp</dimen>
<!-- gap on either side of status bar notification icons -->
<dimen name="status_bar_icon_padding">1dp</dimen>
- <!-- The width of the notification panel window -->
- <dimen name="notification_panel_width">512dp</dimen>
<!-- The minimum height of the notification panel window -->
<dimen name="notification_panel_min_height">770dp</dimen>
<!-- Bottom margin (from display edge) for status bar panels -->
<!-- Height of the status bar header bar when on Keyguard -->
<dimen name="status_bar_header_height_keyguard">40dp</dimen>
+ <!-- Width for the notification panel and related windows -->
+ <dimen name="match_parent">-1px</dimen>
+ <dimen name="standard_notification_panel_width">416dp</dimen><!-- includes notification_side_padding on each side -->
+ <dimen name="notification_panel_width">@dimen/match_parent</dimen>
+
<!-- Gravity for the notification panel -->
- <!-- 0x37 = fill_horizontal|top -->
- <integer name="notification_panel_layout_gravity">0x37</integer>
+ <integer name="standard_notification_panel_layout_gravity">0x31</integer><!-- top|center_horizontal -->
+ <integer name="notification_panel_layout_gravity">0x37</integer><!-- fill_horizontal|top -->
<!-- Height of the carrier/wifi name label -->
<dimen name="carrier_label_height">24dp</dimen>
<!-- The height of the speed bump view. -->
<dimen name="speed_bump_height">16dp</dimen>
- <!-- Width of the zen mode interstitial dialog. -->
- <dimen name="zen_mode_dialog_width">320dp</dimen>
-
<!-- Lockscreen affordance drag distance for camera and phone. -->
<dimen name="affordance_drag_distance">100dp</dimen>
<item name="android:colorControlActivated">@color/system_accent_color</item>
</style>
- <style name="NotificationsQuickSettings">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">match_parent</item>
- </style>
-
- <style name="StatusBarHeader">
- <item name="android:layout_width">match_parent</item>
- </style>
-
- <style name="QSBorderlessButton">
+ <style name="QSBorderlessButton">
<item name="android:padding">12dp</item>
<item name="android:background">@drawable/btn_borderless_rect</item>
<item name="android:gravity">center</item>
RecentsComponent.Callbacks, ExpandableNotificationRow.ExpansionLogger,
NotificationData.Environment {
public static final String TAG = "StatusBar";
- public static final boolean DEBUG = false;
+ public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
public static final boolean MULTIUSER_DEBUG = false;
protected static final int MSG_SHOW_RECENT_APPS = 1019;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
+import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
private View mReserveNotificationSpace;
private MirrorView mSystemIconsCopy;
private View mQsNavbarScrim;
-
+ private View mNotificationContainerParent;
private NotificationStackScrollLayout mNotificationStackScroller;
private int mNotificationTopPadding;
private boolean mAnimateNextTopPaddingChange;
private Interpolator mFastOutSlowInInterpolator;
private Interpolator mFastOutLinearInterpolator;
- private Interpolator mLinearOutSlowInInterpolator;
private ObjectAnimator mClockAnimator;
private int mClockAnimationTarget = -1;
private int mTopPaddingAdjustment;
mScrollView = (ObservableScrollView) findViewById(R.id.scroll_view);
mScrollView.setListener(this);
mReserveNotificationSpace = findViewById(R.id.reserve_notification_space);
+ mNotificationContainerParent = findViewById(R.id.notification_container_parent);
mNotificationStackScroller = (NotificationStackScrollLayout)
findViewById(R.id.notification_stack_scroller);
mNotificationStackScroller.setOnHeightChangedListener(this);
android.R.interpolator.fast_out_slow_in);
mFastOutLinearInterpolator = AnimationUtils.loadInterpolator(getContext(),
android.R.interpolator.fast_out_linear_in);
- mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(),
- android.R.interpolator.linear_out_slow_in);
mKeyguardBottomArea = (KeyguardBottomAreaView) findViewById(R.id.keyguard_bottom_area);
mQsNavbarScrim = findViewById(R.id.qs_navbar_scrim);
mAfforanceHelper = new KeyguardAffordanceHelper(this, getContext());
getResources().getDimensionPixelSize(R.dimen.notification_scrim_wait_distance);
}
+ public void updateResources() {
+ int panelWidth = getResources().getDimensionPixelSize(R.dimen.notification_panel_width);
+ int panelGravity = getResources().getInteger(R.integer.notification_panel_layout_gravity);
+ FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mHeader.getLayoutParams();
+ if (lp.width != panelWidth) {
+ lp.width = panelWidth;
+ lp.gravity = panelGravity;
+ mHeader.setLayoutParams(lp);
+ mHeader.post(mUpdateHeader);
+ }
+
+ lp = (FrameLayout.LayoutParams) mNotificationContainerParent.getLayoutParams();
+ if (lp.width != panelWidth) {
+ lp.width = panelWidth;
+ lp.gravity = panelGravity;
+ mNotificationContainerParent.setLayoutParams(lp);
+ }
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
updateQsState();
}
}
+
+ private final Runnable mUpdateHeader = new Runnable() {
+ @Override
+ public void run() {
+ mHeader.updateEverything();
+ }
+ };
}
*/
void updateResources() {
// Update the quick setting tiles
- if (mQSPanel != null) mQSPanel.updateResources();
+ if (mQSPanel != null) {
+ mQSPanel.updateResources();
+ }
loadDimens();
mLinearOutSlowIn = AnimationUtils.loadInterpolator(
mContext, android.R.interpolator.linear_out_slow_in);
+
+ if (mNotificationPanel != null) {
+ mNotificationPanel.updateResources();
+ }
+ if (mHeadsUpNotificationView != null) {
+ mHeadsUpNotificationView.updateResources();
+ }
}
protected void loadDimens() {
mKeyguardMaxNotificationCount = res.getInteger(R.integer.keyguard_max_notification_count);
- if (false) Log.v(TAG, "updateResources");
+ if (DEBUG) Log.v(TAG, "updateResources");
}
// Visibility reporting
boolean changed = expanded != mExpanded;
mExpanded = expanded;
if (changed) {
- updateHeights();
- updateVisibilities();
- updateSystemIconsLayoutParams();
- updateClickTargets();
- updateMultiUserSwitch();
- if (mQSPanel != null) {
- mQSPanel.setExpanded(expanded);
- }
- updateClockScale();
- updateAvatarScale();
- updateClockLp();
- requestCaptureValues();
+ updateEverything();
}
}
+ public void updateEverything() {
+ updateHeights();
+ updateVisibilities();
+ updateSystemIconsLayoutParams();
+ updateClickTargets();
+ updateMultiUserSwitch();
+ if (mQSPanel != null) {
+ mQSPanel.setExpanded(mExpanded);
+ }
+ updateClockScale();
+ updateAvatarScale();
+ updateClockLp();
+ requestCaptureValues();
+ }
+
private void updateHeights() {
int height = mExpanded ? mExpandedHeight : mCollapsedHeight;
ViewGroup.LayoutParams lp = getLayoutParams();
if (DEBUG) Log.v(TAG, "create() " + mTouchSensitivityDelay);
}
+ public void updateResources() {
+ if (mContentHolder != null) {
+ final LayoutParams lp = (LayoutParams) mContentHolder.getLayoutParams();
+ lp.width = getResources().getDimensionPixelSize(R.dimen.notification_panel_width);
+ lp.gravity = getResources().getInteger(R.integer.notification_panel_layout_gravity);
+ mContentHolder.setLayoutParams(lp);
+ }
+ }
+
public void setBar(PhoneStatusBar bar) {
mBar = bar;
}
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PixelFormat;
import android.provider.Settings.Global;
import android.util.Log;
import android.util.SparseArray;
-import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
}
};
- // Change some window properties
final Window window = mDialog.getWindow();
- final LayoutParams lp = window.getAttributes();
- lp.token = null;
- // Offset from the top
- lp.y = res.getDimensionPixelOffset(com.android.systemui.R.dimen.volume_panel_top);
- lp.type = LayoutParams.TYPE_STATUS_BAR_PANEL;
- lp.format = PixelFormat.TRANSLUCENT;
- lp.windowAnimations = com.android.systemui.R.style.VolumePanelAnimation;
- lp.gravity = Gravity.TOP;
- window.setAttributes(lp);
- window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.requestFeature(Window.FEATURE_NO_TITLE);
- window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE
- | LayoutParams.FLAG_NOT_TOUCH_MODAL
- | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
- | LayoutParams.FLAG_HARDWARE_ACCELERATED);
mDialog.setCanceledOnTouchOutside(true);
mDialog.setContentView(com.android.systemui.R.layout.volume_dialog);
mDialog.setOnDismissListener(new OnDismissListener() {
});
mDialog.create();
- // temporary workaround, until we support window-level shadows
- mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0x00000000));
+ final LayoutParams lp = window.getAttributes();
+ lp.token = null;
+ lp.y = res.getDimensionPixelOffset(com.android.systemui.R.dimen.volume_panel_top);
+ lp.type = LayoutParams.TYPE_STATUS_BAR_PANEL;
+ lp.format = PixelFormat.TRANSLUCENT;
+ lp.windowAnimations = com.android.systemui.R.style.VolumePanelAnimation;
+ lp.setTitle(TAG);
+ window.setAttributes(lp);
+
+ updateWidth();
+
+ window.setBackgroundDrawable(new ColorDrawable(0x00000000));
+ window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
+ window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE
+ | LayoutParams.FLAG_NOT_TOUCH_MODAL
+ | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
+ | LayoutParams.FLAG_HARDWARE_ACCELERATED);
mView = window.findViewById(R.id.content);
mView.setOnTouchListener(new View.OnTouchListener() {
@Override
registerReceiver();
}
+ public void onConfigurationChanged(Configuration newConfig) {
+ updateWidth();
+ }
+
+ private void updateWidth() {
+ final Resources res = mContext.getResources();
+ final LayoutParams lp = mDialog.getWindow().getAttributes();
+ lp.width = res.getDimensionPixelSize(com.android.systemui.R.dimen.notification_panel_width);
+ lp.gravity =
+ res.getInteger(com.android.systemui.R.integer.notification_panel_layout_gravity);
+ mDialog.getWindow().setAttributes(lp);
+ }
+
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("VolumePanel state:");
pw.print(" mTag="); pw.println(mTag);
int stream = (streamType == AudioService.STREAM_REMOTE_MUSIC) ? -1 : streamType;
// when the stream is for remote playback, use -1 to reset the stream type evaluation
mAudioManager.forceVolumeControlStream(stream);
-
mDialog.show();
if (mCallback != null) {
mCallback.onVisible(true);
import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Configuration;
import android.database.ContentObserver;
import android.media.AudioManager;
import android.media.IRemoteVolumeController;
}
@Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ if (mPanel != null) {
+ mPanel.onConfigurationChanged(newConfig);
+ }
+ }
+
+ @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mPanel != null) {
mPanel.dump(fd, pw, args);