SystemUI的在下拉状态栏第二次展开的QSPanel的界面时,原生下拉状态栏界面会有亮度条SeekBar,
当拖动的时候,亮度会改变但是同时整个QSPanel下拉状态栏也隐藏掉了 。客户要求去掉这个拖动亮度条时隐藏下拉状态栏的功能
相关布局和代码
```
/SystemUI/res/layout/quick_settings_brightness_dialog.xml 亮度条核心布局
/SystemUI/res/layout/brightness_mirror.xml 包含亮度条布局
/SystemUI/res/layout/qs_panel.xml 下拉状态栏第二次展开的QSPanel的界面
/SystemUI/src/com/android/systemui/qs/QSPanel.java
--- a/ac8257_0302/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/ac8257_0302/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -104,9 +104,10 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
setOrientation(VERTICAL);
+ //
mBrightnessView = LayoutInflater.from(mContext).inflate(
R.layout.quick_settings_brightness_dialog, this, false);
- addView(mBrightnessView);
+ //addView(mBrightnessView); //addView 加载控件,垂直线性布局,先add的上面
// M: @ {
mQuickSettingsExt = OpSystemUICustomizationFactoryBase
@@ -128,7 +129,8 @@ public class QSPanel extends LinearLayout implements Tunable, Callback, Brightne
((PagedTileLayout) mTileLayout).setPageIndicator(mPanelPageIndicator);
mQsTileRevealController = new QSTileRevealController(mContext, this,
(PagedTileLayout) mTileLayout);
-
+
+ addView(mBrightnessView);//改变亮度条位置
addDivider();
mFooter = new QSSecurityFooter(this, context);
/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessMirrorController.java
//去掉这个拖动亮度条时隐藏下拉状态栏的功能
@@ -56,9 +56,12 @@ public class BrightnessMirrorController
}
public void showMirror() {
- mBrightnessMirror.setVisibility(View.VISIBLE);
- mVisibilityCallback.accept(true);
- mNotificationPanel.setPanelAlpha(0, true /* animate */);
+ mBrightnessMirror.setVisibility(View.INVISIBLE);
+ mVisibilityCallback.accept(false);
+ mNotificationPanel.setPanelAlpha(255, true /* animate */);
}
```
/**
* Add brightness view above the tile layout.
*
* Used to add the brightness slider after construction.
*/
public void setBrightnessView(@NonNull View view) {
if (mBrightnessView != null) {
removeView(mBrightnessView);
mMovableContentStartIndex--;
}
addView(view, 0);
mBrightnessView = view;
setBrightnessViewMargin();
mMovableContentStartIndex++;
}
private void setBrightnessViewMargin() {
if (mBrightnessView != null) {
MarginLayoutParams lp = (MarginLayoutParams) mBrightnessView.getLayoutParams();
lp.topMargin = mContext.getResources()
.getDimensionPixelSize(R.dimen.qs_brightness_margin_top)+30;
lp.bottomMargin = mContext.getResources()
.getDimensionPixelSize(R.dimen.qs_brightness_margin_bottom);
mBrightnessView.setLayoutParams(lp);
}
}
src/com/android/systemui/qs/QSPanelController.java调用"setBrightnessView"方法添加亮度进度条
@Inject
QSPanelController(QSPanel view, QSSecurityFooter qsSecurityFooter, TunerService tunerService,
QSTileHost qstileHost, QSCustomizerController qsCustomizerController,
@Named(QS_USING_MEDIA_PLAYER) boolean usingMediaPlayer,
@Named(QS_PANEL) MediaHost mediaHost,
QSTileRevealController.Factory qsTileRevealControllerFactory,
DumpManager dumpManager, MetricsLogger metricsLogger, UiEventLogger uiEventLogger,
QSLogger qsLogger, BrightnessController.Factory brightnessControllerFactory,
BrightnessSliderController.Factory brightnessSliderFactory,
FalsingManager falsingManager, CommandQueue commandQueue) {
super(view, qstileHost, qsCustomizerController, usingMediaPlayer, mediaHost,
metricsLogger, uiEventLogger, qsLogger, dumpManager);
mQsSecurityFooter = qsSecurityFooter;
mTunerService = tunerService;
mQsCustomizerController = qsCustomizerController;
mQsTileRevealControllerFactory = qsTileRevealControllerFactory;
mFalsingManager = falsingManager;
mCommandQueue = commandQueue;
mQsSecurityFooter.setHostEnvironment(qstileHost);
mBrightnessSliderController = brightnessSliderFactory.create(getContext(), mView);
mView.setBrightnessView(mBrightnessSliderController.getRootView());
mBrightnessController = brightnessControllerFactory.create(mBrightnessSliderController);
mBrightnessMirrorHandler = new BrightnessMirrorHandler(mBrightnessController);
}