Migrate NotificationsQuickSettingsContainer to ConstraintLayout
This shouldn't result in any visual changes at this time. Subsequent changes will make use of the ConstraintLayout to rearrange the panels on wide screens. Bug: 171917882 Test: manual Change-Id: I8d0242743c738e6cffb4232b2651bf21dcc840ed
This commit is contained in:
@@ -50,18 +50,22 @@
|
||||
android:layout="@layout/qs_panel"
|
||||
android:layout_width="@dimen/qs_panel_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="@integer/notification_panel_layout_gravity"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
systemui:viewType="com.android.systemui.plugins.qs.QS" />
|
||||
systemui:viewType="com.android.systemui.plugins.qs.QS"
|
||||
systemui:layout_constraintStart_toStartOf="parent"
|
||||
systemui:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<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_height="match_parent"
|
||||
android:layout_gravity="@integer/notification_panel_layout_gravity"
|
||||
android:layout_marginBottom="@dimen/close_handle_underlap" />
|
||||
android:layout_marginBottom="@dimen/close_handle_underlap"
|
||||
systemui:layout_constraintStart_toStartOf="parent"
|
||||
systemui:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<include layout="@layout/ambient_indication"
|
||||
android:id="@+id/ambient_indication_container" />
|
||||
|
||||
@@ -45,7 +45,6 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.colorextraction.ColorExtractor;
|
||||
@@ -847,11 +846,14 @@ public class NotificationStackScrollLayoutController {
|
||||
return mView.getChildAtRawPosition(x, y);
|
||||
}
|
||||
|
||||
public FrameLayout.LayoutParams getLayoutParams() {
|
||||
return (FrameLayout.LayoutParams) mView.getLayoutParams();
|
||||
public ViewGroup.LayoutParams getLayoutParams() {
|
||||
return mView.getLayoutParams();
|
||||
}
|
||||
|
||||
public void setLayoutParams(FrameLayout.LayoutParams lp) {
|
||||
/**
|
||||
* Updates layout parameters on the root view
|
||||
*/
|
||||
public void setLayoutParams(ViewGroup.LayoutParams lp) {
|
||||
mView.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
|
||||
@@ -756,19 +756,16 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
|
||||
public void updateResources() {
|
||||
int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width);
|
||||
int panelGravity = mResources.getInteger(R.integer.notification_panel_layout_gravity);
|
||||
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mQsFrame.getLayoutParams();
|
||||
if (lp.width != qsWidth || lp.gravity != panelGravity) {
|
||||
ViewGroup.LayoutParams lp = mQsFrame.getLayoutParams();
|
||||
if (lp.width != qsWidth) {
|
||||
lp.width = qsWidth;
|
||||
lp.gravity = panelGravity;
|
||||
mQsFrame.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
int panelWidth = mResources.getDimensionPixelSize(R.dimen.notification_panel_width);
|
||||
lp = mNotificationStackScrollLayoutController.getLayoutParams();
|
||||
if (lp.width != panelWidth || lp.gravity != panelGravity) {
|
||||
if (lp.width != panelWidth) {
|
||||
lp.width = panelWidth;
|
||||
lp.gravity = panelGravity;
|
||||
mNotificationStackScrollLayoutController.setLayoutParams(lp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.view.WindowInsets;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.DimenRes;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.fragments.FragmentHostManager;
|
||||
@@ -42,7 +43,7 @@ import java.util.Comparator;
|
||||
/**
|
||||
* The container with notification stack scroller and quick settings inside.
|
||||
*/
|
||||
public class NotificationsQuickSettingsContainer extends FrameLayout
|
||||
public class NotificationsQuickSettingsContainer extends ConstraintLayout
|
||||
implements OnInflateListener, FragmentListener,
|
||||
AboveShelfObserver.HasViewAboveShelfChangedListener {
|
||||
|
||||
@@ -68,11 +69,11 @@ public class NotificationsQuickSettingsContainer extends FrameLayout
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mQsFrame = (FrameLayout) findViewById(R.id.qs_frame);
|
||||
mQsFrame = findViewById(R.id.qs_frame);
|
||||
mStackScroller = findViewById(R.id.notification_stack_scroller);
|
||||
mStackScrollerMargin = ((LayoutParams) mStackScroller.getLayoutParams()).bottomMargin;
|
||||
mKeyguardStatusBar = findViewById(R.id.keyguard_header);
|
||||
ViewStub userSwitcher = (ViewStub) findViewById(R.id.keyguard_user_switcher);
|
||||
ViewStub userSwitcher = findViewById(R.id.keyguard_user_switcher);
|
||||
userSwitcher.setOnInflateListener(this);
|
||||
mUserSwitcher = userSwitcher;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user