Loading packages/SystemUI/customization/src/com/android/systemui/shared/quickaffordance/shared/model/KeyguardQuickAffordancePreviewConstants.kt 0 → 100644 +24 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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. * */ package com.android.systemui.shared.quickaffordance.shared.model object KeyguardQuickAffordancePreviewConstants { const val MESSAGE_ID_SLOT_SELECTED = 1337 const val KEY_SLOT_ID = "slot_id" const val KEY_INITIALLY_SELECTED_SLOT_ID = "initially_selected_slot_id" } packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml +49 −9 Original line number Diff line number Diff line Loading @@ -16,13 +16,53 @@ * limitations under the License. */ --> <shape <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:shape="rectangle"> xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> <item android:state_selected="true"> <layer-list> <item android:left="3dp" android:top="3dp" android:right="3dp" android:bottom="3dp"> <shape android:shape="oval"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> <corners android:radius="@dimen/keyguard_affordance_fixed_radius"/> </shape> </item> <item> <shape android:shape="oval"> <stroke android:color="@color/control_primary_text" android:width="2dp"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> </shape> </item> </layer-list> </item> <item> <layer-list> <item android:left="3dp" android:top="3dp" android:right="3dp" android:bottom="3dp"> <shape android:shape="oval"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> </shape> </item> </layer-list> </item> </selector> packages/SystemUI/res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -758,6 +758,8 @@ <dimen name="keyguard_affordance_fixed_height">48dp</dimen> <dimen name="keyguard_affordance_fixed_width">48dp</dimen> <dimen name="keyguard_affordance_fixed_radius">24dp</dimen> <!-- Amount the button should shake when it's not long-pressed for long enough. --> <dimen name="keyguard_affordance_shake_amplitude">8dp</dimen> <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen> <dimen name="keyguard_affordance_vertical_offset">32dp</dimen> Loading packages/SystemUI/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -2740,6 +2740,12 @@ --> <string name="keyguard_affordance_enablement_dialog_home_instruction_2">• At least one device is available</string> <!-- Error message shown when a button should be pressed and held to activate it, usually shown when the user attempted to tap the button or held it for too short a time. [CHAR LIMIT=32]. --> <string name="keyguard_affordance_press_too_short">Press and hold to activate</string> <!-- Text for education page of cancel button to hide the page. [CHAR_LIMIT=NONE] --> <string name="rear_display_bottom_sheet_cancel">Cancel</string> <!-- Text for the user to confirm they flipped the device around. [CHAR_LIMIT=NONE] --> Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +18 −11 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import android.graphics.Rect; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; Loading Loading @@ -43,6 +44,21 @@ public class KeyguardClockSwitch extends RelativeLayout { public static final int LARGE = 0; public static final int SMALL = 1; /** Returns a region for the large clock to position itself, based on the given parent. */ public static Rect getLargeClockRegion(ViewGroup parent) { int largeClockTopMargin = parent.getResources() .getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin); int targetHeight = parent.getResources() .getDimensionPixelSize(R.dimen.large_clock_text_size) * 2; int top = parent.getHeight() / 2 - targetHeight / 2 + largeClockTopMargin / 2; return new Rect( parent.getLeft(), top, parent.getRight(), top + targetHeight); } /** * Frame for small/large clocks */ Loading Loading @@ -129,17 +145,8 @@ public class KeyguardClockSwitch extends RelativeLayout { } if (mLargeClockFrame.isLaidOut()) { int largeClockTopMargin = getResources() .getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin); int targetHeight = getResources() .getDimensionPixelSize(R.dimen.large_clock_text_size) * 2; int top = mLargeClockFrame.getHeight() / 2 - targetHeight / 2 + largeClockTopMargin / 2; mClock.getLargeClock().getEvents().onTargetRegionChanged(new Rect( mLargeClockFrame.getLeft(), top, mLargeClockFrame.getRight(), top + targetHeight)); mClock.getLargeClock().getEvents().onTargetRegionChanged( getLargeClockRegion(mLargeClockFrame)); } } } Loading Loading
packages/SystemUI/customization/src/com/android/systemui/shared/quickaffordance/shared/model/KeyguardQuickAffordancePreviewConstants.kt 0 → 100644 +24 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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. * */ package com.android.systemui.shared.quickaffordance.shared.model object KeyguardQuickAffordancePreviewConstants { const val MESSAGE_ID_SLOT_SELECTED = 1337 const val KEY_SLOT_ID = "slot_id" const val KEY_INITIALLY_SELECTED_SLOT_ID = "initially_selected_slot_id" }
packages/SystemUI/res/drawable/keyguard_bottom_affordance_bg.xml +49 −9 Original line number Diff line number Diff line Loading @@ -16,13 +16,53 @@ * limitations under the License. */ --> <shape <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" android:shape="rectangle"> xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> <item android:state_selected="true"> <layer-list> <item android:left="3dp" android:top="3dp" android:right="3dp" android:bottom="3dp"> <shape android:shape="oval"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> <corners android:radius="@dimen/keyguard_affordance_fixed_radius"/> </shape> </item> <item> <shape android:shape="oval"> <stroke android:color="@color/control_primary_text" android:width="2dp"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> </shape> </item> </layer-list> </item> <item> <layer-list> <item android:left="3dp" android:top="3dp" android:right="3dp" android:bottom="3dp"> <shape android:shape="oval"> <solid android:color="?androidprv:attr/colorSurface"/> <size android:width="@dimen/keyguard_affordance_width" android:height="@dimen/keyguard_affordance_height"/> </shape> </item> </layer-list> </item> </selector>
packages/SystemUI/res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -758,6 +758,8 @@ <dimen name="keyguard_affordance_fixed_height">48dp</dimen> <dimen name="keyguard_affordance_fixed_width">48dp</dimen> <dimen name="keyguard_affordance_fixed_radius">24dp</dimen> <!-- Amount the button should shake when it's not long-pressed for long enough. --> <dimen name="keyguard_affordance_shake_amplitude">8dp</dimen> <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen> <dimen name="keyguard_affordance_vertical_offset">32dp</dimen> Loading
packages/SystemUI/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -2740,6 +2740,12 @@ --> <string name="keyguard_affordance_enablement_dialog_home_instruction_2">• At least one device is available</string> <!-- Error message shown when a button should be pressed and held to activate it, usually shown when the user attempted to tap the button or held it for too short a time. [CHAR LIMIT=32]. --> <string name="keyguard_affordance_press_too_short">Press and hold to activate</string> <!-- Text for education page of cancel button to hide the page. [CHAR_LIMIT=NONE] --> <string name="rear_display_bottom_sheet_cancel">Cancel</string> <!-- Text for the user to confirm they flipped the device around. [CHAR_LIMIT=NONE] --> Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +18 −11 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import android.graphics.Rect; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; Loading Loading @@ -43,6 +44,21 @@ public class KeyguardClockSwitch extends RelativeLayout { public static final int LARGE = 0; public static final int SMALL = 1; /** Returns a region for the large clock to position itself, based on the given parent. */ public static Rect getLargeClockRegion(ViewGroup parent) { int largeClockTopMargin = parent.getResources() .getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin); int targetHeight = parent.getResources() .getDimensionPixelSize(R.dimen.large_clock_text_size) * 2; int top = parent.getHeight() / 2 - targetHeight / 2 + largeClockTopMargin / 2; return new Rect( parent.getLeft(), top, parent.getRight(), top + targetHeight); } /** * Frame for small/large clocks */ Loading Loading @@ -129,17 +145,8 @@ public class KeyguardClockSwitch extends RelativeLayout { } if (mLargeClockFrame.isLaidOut()) { int largeClockTopMargin = getResources() .getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin); int targetHeight = getResources() .getDimensionPixelSize(R.dimen.large_clock_text_size) * 2; int top = mLargeClockFrame.getHeight() / 2 - targetHeight / 2 + largeClockTopMargin / 2; mClock.getLargeClock().getEvents().onTargetRegionChanged(new Rect( mLargeClockFrame.getLeft(), top, mLargeClockFrame.getRight(), top + targetHeight)); mClock.getLargeClock().getEvents().onTargetRegionChanged( getLargeClockRegion(mLargeClockFrame)); } } } Loading