MTK修改sysemUI下拉的宽度为全屏
大体上只需要修改两个部分,下拉的宽度,以及亮度和音量拖动时候显示的dialog
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/brightness_mirror.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/brightness_mirror.xml
@@ -17,7 +17,7 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/brightness_mirror"
- android:layout_width="@dimen/qs_panel_width"
+ android:layout_width="match_parent"
android:layout_height="@dimen/brightness_mirror_height"
android:layout_gravity="@integer/notification_panel_layout_gravity"
android:visibility="invisible">
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/notif_half_shelf.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/notif_half_shelf.xml
@@ -27,7 +27,7 @@
<LinearLayout
android:id="@+id/half_shelf"
- android:layout_width="@dimen/qs_panel_width"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="bottom"
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/status_bar_expanded.xml
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/status_bar_expanded.xml
@@ -48,7 +48,7 @@
<FrameLayout
android:id="@+id/qs_frame"
android:layout="@layout/qs_panel"
- android:layout_width="@dimen/qs_panel_width"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="@integer/notification_panel_layout_gravity"
android:clipToPadding="false"
@@ -58,7 +58,7 @@
<com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
android:id="@+id/notification_stack_scroller"
android:layout_marginTop="@dimen/notification_panel_margin_top"
- android:layout_width="@dimen/notification_panel_width"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="@integer/notification_panel_layout_gravity"
android:layout_marginBottom="@dimen/close_handle_underlap" />
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -552,7 +552,8 @@ class GlobalScreenshot {
// determine the optimal preview size
int panelWidth = 0;
try {
- panelWidth = r.getDimensionPixelSize(R.dimen.notification_panel_width);
+ //panelWidth = r.getDimensionPixelSize(R.dimen.notification_panel_width);
+ panelWidth = mDisplayMetrics.widthPixels;
} catch (Resources.NotFoundException e) {
}
if (panelWidth <= 0) {
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/HeadsUpStatusBarView.java
@@ -24,6 +24,7 @@ import android.graphics.Rect;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
+import android.util.DisplayMetrics;
import android.view.DisplayCutout;
import android.view.View;
import android.widget.TextView;
@@ -90,7 +91,8 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
}
private void updateMaxWidth() {
- int maxWidth = getResources().getDimensionPixelSize(R.dimen.qs_panel_width);
+ //int maxWidth = getResources().getDimensionPixelSize(R.dimen.qs_panel_width);
+ int maxWidth = getResources().getDisplayMetrics().widthPixels;
if (maxWidth != mMaxWidth) {
// maxWidth doesn't work with fill_parent, let's manually make it at most as big as the
// notification panel
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -43,6 +43,7 @@ import android.os.PowerManager;
import android.util.AttributeSet;
import android.util.Log;
import android.util.MathUtils;
+import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
@@ -472,7 +473,9 @@ public class NotificationPanelView extends PanelView implements
public void updateResources() {
Resources res = getResources();
- int qsWidth = res.getDimensionPixelSize(R.dimen.qs_panel_width);
+ DisplayMetrics displayMetrics = res.getDisplayMetrics();
+ //int qsWidth = res.getDimensionPixelSize(R.dimen.qs_panel_width);
+ int qsWidth = displayMetrics.widthPixels;
int panelGravity = getResources().getInteger(R.integer.notification_panel_layout_gravity);
FrameLayout.LayoutParams lp =
(FrameLayout.LayoutParams) mQsFrame.getLayoutParams();
@@ -482,7 +485,8 @@ public class NotificationPanelView extends PanelView implements
mQsFrame.setLayoutParams(lp);
}
- int panelWidth = res.getDimensionPixelSize(R.dimen.notification_panel_width);
+ //int panelWidth = res.getDimensionPixelSize(R.dimen.notification_panel_width);
+ int panelWidth = displayMetrics.widthPixels;
lp = (FrameLayout.LayoutParams) mNotificationStackScroller.getLayoutParams();
if (lp.width != panelWidth || lp.gravity != panelGravity) {
lp.width = panelWidth;
@@ -1792,7 +1796,8 @@ public class NotificationPanelView extends PanelView implements
|| mPulsing) {
maxHeight = calculatePanelHeightQsExpanded();
} else {
- maxHeight = calculatePanelHeightShade();
+ maxHeight = calculatePanelHeightQsExpanded();
+ //maxHeight = calculatePanelHeightShade();
}
maxHeight = Math.max(maxHeight, min);
return maxHeight;
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.util.AttributeSet;
+import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewStub;
import android.view.ViewStub.OnInflateListener;
@@ -95,7 +96,8 @@ public class NotificationsQuickSettingsContainer extends FrameLayout
*/
private void reloadWidth(View view, @DimenRes int width) {
LayoutParams params = (LayoutParams) view.getLayoutParams();
- params.width = getResources().getDimensionPixelSize(width);
+ //params.width = getResources().getDimensionPixelSize(width);
+ params.width = getResources().getDisplayMetrics().widthPixels;
view.setLayoutParams(params);
}
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.util.AttributeSet;
+import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewStub;
import android.view.ViewStub.OnInflateListener;
@@ -95,7 +96,8 @@ public class NotificationsQuickSettingsContainer extends FrameLayout
*/
private void reloadWidth(View view, @DimenRes int width) {
LayoutParams params = (LayoutParams) view.getLayoutParams();
- params.width = getResources().getDimensionPixelSize(width);
+ //params.width = getResources().getDimensionPixelSize(width);
+ params.width = getResources().getDisplayMetrics().widthPixels;
view.setLayoutParams(params);
}
diff --git a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
index b1986782e9..934b1eaeff 100644
--- a/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
+++ b/alps/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.policy;
import android.annotation.NonNull;
import android.content.res.Resources;
import android.util.ArraySet;
+import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
@@ -89,7 +90,8 @@ public class BrightnessMirrorController
FrameLayout.LayoutParams lp =
(FrameLayout.LayoutParams) mBrightnessMirror.getLayoutParams();
Resources r = mBrightnessMirror.getResources();
- lp.width = r.getDimensionPixelSize(R.dimen.qs_panel_width);
+ //lp.width = r.getDimensionPixelSize(R.dimen.qs_panel_width);
+ lp.width = r.getDisplayMetrics().widthPixels;
lp.height = r.getDimensionPixelSize(R.dimen.brightness_mirror_height);
lp.gravity = r.getInteger(R.integer.notification_panel_layout_gravity);
mBrightnessMirror.setLayoutParams(lp);