summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hawkwood Glazier <jglazier@google.com> 2023-05-17 21:23:26 +0000
committer Hawkwood Glazier <jglazier@google.com> 2023-05-23 21:52:21 +0000
commitc5874671fcd939c892f9440f6922813835e55c1b (patch)
treef2d8a5fae14a12c5ee4d065d20e72af2435dc757
parent99c051e307fa36b18d228f9f1ca172491865356e (diff)
Set WeatherDate view to gone on tablets to better align smartspace
Bug: 282065874 Test: Manually checked smartspace positioning on several devices Test: atest KeyguardClockSwitchControllerTest Change-Id: Ib4b6f32db32583c02687f1432464106120ebeddd
-rw-r--r--packages/SystemUI/res-keyguard/values-sw600dp-land/integers.xml20
-rw-r--r--packages/SystemUI/res-keyguard/values/integers.xml3
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java11
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java2
4 files changed, 34 insertions, 2 deletions
diff --git a/packages/SystemUI/res-keyguard/values-sw600dp-land/integers.xml b/packages/SystemUI/res-keyguard/values-sw600dp-land/integers.xml
new file mode 100644
index 000000000000..2a8092010a37
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/values-sw600dp-land/integers.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2023 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>
+ <!-- Invisibility to use for the date & weather view when it is disabled by a clock -->
+ <integer name="keyguard_date_weather_view_invisibility">8</integer>
+</resources>
diff --git a/packages/SystemUI/res-keyguard/values/integers.xml b/packages/SystemUI/res-keyguard/values/integers.xml
index c6e90c0fcdec..b08fde339d65 100644
--- a/packages/SystemUI/res-keyguard/values/integers.xml
+++ b/packages/SystemUI/res-keyguard/values/integers.xml
@@ -27,4 +27,7 @@
0x50 = bottom, 0x01 = center_horizontal -->
<integer name="keyguard_host_view_one_handed_gravity">0x51</integer>
+
+ <!-- Invisibility to use for the date & weather view when it is disabled by a clock -->
+ <integer name="keyguard_date_weather_view_invisibility">4</integer>
</resources>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
index d8bf570954df..99e25745dda7 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java
@@ -86,6 +86,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
private int mKeyguardSmallClockTopMargin = 0;
private int mKeyguardLargeClockTopMargin = 0;
+ private int mKeyguardDateWeatherViewInvisibility = View.INVISIBLE;
private final ClockRegistry.ClockChangeListener mClockChangedListener;
private ViewGroup mStatusArea;
@@ -201,6 +202,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mView.getResources().getDimensionPixelSize(R.dimen.keyguard_clock_top_margin);
mKeyguardLargeClockTopMargin =
mView.getResources().getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin);
+ mKeyguardDateWeatherViewInvisibility =
+ mView.getResources().getInteger(R.integer.keyguard_date_weather_view_invisibility);
if (mOnlyClock) {
View ksv = mView.findViewById(R.id.keyguard_slice_view);
@@ -335,7 +338,10 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mView.getResources().getDimensionPixelSize(R.dimen.keyguard_clock_top_margin);
mKeyguardLargeClockTopMargin =
mView.getResources().getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin);
+ mKeyguardDateWeatherViewInvisibility =
+ mView.getResources().getInteger(R.integer.keyguard_date_weather_view_invisibility);
mView.updateClockTargetRegions();
+ setDateWeatherVisibility();
}
@@ -497,8 +503,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
private void setDateWeatherVisibility() {
if (mDateWeatherView != null) {
mUiExecutor.execute(() -> {
- mDateWeatherView.setVisibility(
- clockHasCustomWeatherDataDisplay() ? View.INVISIBLE : View.VISIBLE);
+ mDateWeatherView.setVisibility(clockHasCustomWeatherDataDisplay()
+ ? mKeyguardDateWeatherViewInvisibility
+ : View.VISIBLE);
});
}
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java
index fb738454fc71..b21cc6dde815 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java
@@ -150,6 +150,8 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
.thenReturn(100);
when(mResources.getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin))
.thenReturn(-200);
+ when(mResources.getInteger(R.integer.keyguard_date_weather_view_invisibility))
+ .thenReturn(View.INVISIBLE);
when(mView.findViewById(R.id.lockscreen_clock_view_large)).thenReturn(mLargeClockFrame);
when(mView.findViewById(R.id.lockscreen_clock_view)).thenReturn(mSmallClockFrame);