Merge "Fix position of QSSecurityFooter" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bf37dd716d
@@ -29,12 +29,12 @@
|
|||||||
android:paddingTop="@dimen/status_bar_padding_top"
|
android:paddingTop="@dimen/status_bar_padding_top"
|
||||||
android:minHeight="48dp">
|
android:minHeight="48dp">
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
|
android:id="@+id/date_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:minHeight="48dp"
|
android:minHeight="48dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical|start" >
|
android:gravity="center_vertical|start" >
|
||||||
|
|
||||||
<com.android.systemui.statusbar.policy.DateView
|
<com.android.systemui.statusbar.policy.DateView
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.QS.Status"
|
android:textAppearance="@style/TextAppearance.QS.Status"
|
||||||
systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" />
|
systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" />
|
||||||
</LinearLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<android.widget.Space
|
<android.widget.Space
|
||||||
android:id="@+id/space"
|
android:id="@+id/space"
|
||||||
@@ -59,21 +59,22 @@
|
|||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/header_text_container"
|
android:id="@+id/header_text_container"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:paddingStart="16dp"
|
android:paddingStart="16dp"
|
||||||
android:paddingEnd="16dp"
|
android:paddingEnd="16dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
|
android:id="@+id/privacy_container"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:minHeight="48dp"
|
android:minHeight="48dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical|end" >
|
android:gravity="center_vertical|end" >
|
||||||
|
|
||||||
<include layout="@layout/ongoing_privacy_chip" />
|
<include layout="@layout/ongoing_privacy_chip" />
|
||||||
|
|
||||||
</LinearLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
19
packages/SystemUI/res/values-land/integers.xml
Normal file
19
packages/SystemUI/res/values-land/integers.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2021 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<integer name="qs_security_footer_maxLines">1</integer>
|
||||||
|
</resources>
|
||||||
@@ -42,6 +42,7 @@ import com.android.systemui.settings.brightness.BrightnessSlider;
|
|||||||
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
|
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
|
||||||
import com.android.systemui.tuner.TunerService;
|
import com.android.systemui.tuner.TunerService;
|
||||||
import com.android.systemui.tuner.TunerService.Tunable;
|
import com.android.systemui.tuner.TunerService.Tunable;
|
||||||
|
import com.android.systemui.util.animation.UniqueObjectHostView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -384,12 +385,17 @@ public class QSPanel extends LinearLayout implements Tunable {
|
|||||||
private void switchSecurityFooter() {
|
private void switchSecurityFooter() {
|
||||||
if (mSecurityFooter != null) {
|
if (mSecurityFooter != null) {
|
||||||
if (mContext.getResources().getConfiguration().orientation
|
if (mContext.getResources().getConfiguration().orientation
|
||||||
== Configuration.ORIENTATION_LANDSCAPE && mHeaderContainer != null
|
== Configuration.ORIENTATION_LANDSCAPE && mHeaderContainer != null) {
|
||||||
&& !mSecurityFooter.getParent().equals(mHeaderContainer)) {
|
|
||||||
// Adding the security view to the header, that enables us to avoid scrolling
|
// Adding the security view to the header, that enables us to avoid scrolling
|
||||||
switchToParent(mSecurityFooter, mHeaderContainer, 0);
|
switchToParent(mSecurityFooter, mHeaderContainer, 0);
|
||||||
} else {
|
} else {
|
||||||
switchToParent(mSecurityFooter, this, -1);
|
// Where should this go? If there's media, right before it. Otherwise, at the end.
|
||||||
|
View mediaView = findViewByPredicate(v -> v instanceof UniqueObjectHostView);
|
||||||
|
int index = -1;
|
||||||
|
if (mediaView != null) {
|
||||||
|
index = indexOfChild(mediaView);
|
||||||
|
}
|
||||||
|
switchToParent(mSecurityFooter, this, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ public class QuickStatusBarHeader extends FrameLayout {
|
|||||||
private Space mDatePrivacySeparator;
|
private Space mDatePrivacySeparator;
|
||||||
private View mClockIconsSeparator;
|
private View mClockIconsSeparator;
|
||||||
private boolean mShowClockIconsSeparator;
|
private boolean mShowClockIconsSeparator;
|
||||||
private ViewGroup mRightLayout;
|
private View mRightLayout;
|
||||||
|
private View mDateContainer;
|
||||||
|
private View mPrivacyContainer;
|
||||||
|
|
||||||
private BatteryMeterView mBatteryRemainingIcon;
|
private BatteryMeterView mBatteryRemainingIcon;
|
||||||
private StatusIconContainer mIconContainer;
|
private StatusIconContainer mIconContainer;
|
||||||
@@ -129,6 +131,8 @@ public class QuickStatusBarHeader extends FrameLayout {
|
|||||||
mSecurityHeaderView = findViewById(R.id.header_text_container);
|
mSecurityHeaderView = findViewById(R.id.header_text_container);
|
||||||
mClockIconsSeparator = findViewById(R.id.separator);
|
mClockIconsSeparator = findViewById(R.id.separator);
|
||||||
mRightLayout = findViewById(R.id.rightLayout);
|
mRightLayout = findViewById(R.id.rightLayout);
|
||||||
|
mDateContainer = findViewById(R.id.date_container);
|
||||||
|
mPrivacyContainer = findViewById(R.id.privacy_container);
|
||||||
|
|
||||||
mClockView = findViewById(R.id.clock);
|
mClockView = findViewById(R.id.clock);
|
||||||
mDatePrivacySeparator = findViewById(R.id.space);
|
mDatePrivacySeparator = findViewById(R.id.space);
|
||||||
@@ -179,6 +183,7 @@ public class QuickStatusBarHeader extends FrameLayout {
|
|||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
updateResources();
|
updateResources();
|
||||||
|
setDatePrivacyContainersWidth(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -187,6 +192,18 @@ public class QuickStatusBarHeader extends FrameLayout {
|
|||||||
updateResources();
|
updateResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDatePrivacyContainersWidth(boolean landscape) {
|
||||||
|
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mDateContainer.getLayoutParams();
|
||||||
|
lp.width = landscape ? WRAP_CONTENT : 0;
|
||||||
|
lp.weight = landscape ? 0f : 1f;
|
||||||
|
mDateContainer.setLayoutParams(lp);
|
||||||
|
|
||||||
|
lp = (LinearLayout.LayoutParams) mPrivacyContainer.getLayoutParams();
|
||||||
|
lp.width = landscape ? WRAP_CONTENT : 0;
|
||||||
|
lp.weight = landscape ? 0f : 1f;
|
||||||
|
mPrivacyContainer.setLayoutParams(lp);
|
||||||
|
}
|
||||||
|
|
||||||
void updateResources() {
|
void updateResources() {
|
||||||
Resources resources = mContext.getResources();
|
Resources resources = mContext.getResources();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user