Making the notification always center horizonally

The notification panel always center horizontal, since
it could lead to an offcenter notification sometimes.
Also applying the gravity correctly.

Change-Id: I2056dae0dfc1e4625e7903511464dc3edd8ac3f5
Fixes: 27566718
Test: rotate, observe HUN location after rotation
This commit is contained in:
Selim Cinek
2017-02-17 13:01:01 -08:00
parent 9f5ce93549
commit 9e87cba5a9
4 changed files with 3 additions and 8 deletions

View File

@@ -19,9 +19,6 @@
<!-- thickness (width) of the navigation bar on phones that require it -->
<dimen name="navigation_bar_size">@*android:dimen/navigation_bar_width</dimen>
<!-- Standard notification gravity -->
<integer name="notification_panel_layout_gravity">@integer/standard_notification_panel_layout_gravity</integer>
<dimen name="docked_divider_handle_width">2dp</dimen>
<dimen name="docked_divider_handle_height">16dp</dimen>

View File

@@ -18,7 +18,6 @@
<resources>
<!-- 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>

View File

@@ -198,8 +198,7 @@
<dimen name="volume_dialog_panel_width">@dimen/standard_notification_panel_width</dimen>
<!-- Gravity for the notification panel -->
<integer name="standard_notification_panel_layout_gravity">0x31</integer><!-- top|center_horizontal -->
<integer name="notification_panel_layout_gravity">0x37</integer><!-- fill_horizontal|top -->
<integer name="notification_panel_layout_gravity">0x31</integer><!-- center_horizontal|top -->
<!-- Height of the carrier/wifi name label -->
<dimen name="carrier_label_height">24dp</dimen>

View File

@@ -292,7 +292,7 @@ public class NotificationPanelView extends PanelView implements
int panelGravity = getResources().getInteger(R.integer.notification_panel_layout_gravity);
FrameLayout.LayoutParams lp =
(FrameLayout.LayoutParams) mQsFrame.getLayoutParams();
if (lp.width != panelWidth) {
if (lp.width != panelWidth || lp.gravity != panelGravity) {
lp.width = panelWidth;
lp.gravity = panelGravity;
mQsFrame.setLayoutParams(lp);
@@ -300,7 +300,7 @@ public class NotificationPanelView extends PanelView implements
}
lp = (FrameLayout.LayoutParams) mNotificationStackScroller.getLayoutParams();
if (lp.width != panelWidth) {
if (lp.width != panelWidth || lp.gravity != panelGravity) {
lp.width = panelWidth;
lp.gravity = panelGravity;
mNotificationStackScroller.setLayoutParams(lp);