diff options
author | 2023-05-26 16:55:43 +0000 | |
---|---|---|
committer | 2023-05-26 16:55:43 +0000 | |
commit | 8b57e558099e305f8e851ec31d56e5c3061545ab (patch) | |
tree | 0cba18fdc6eafdf84f69cb0e8530b89f1620406d | |
parent | eb94bd4922f3602f79e944f6dcce5f999ab9958a (diff) | |
parent | 47e4f278bd2c23b1e063ac9569083ece9bc749c8 (diff) |
Merge "Use small-screen behavior for issue cards in QS on large screens." into udc-mainline-prod am: 47e4f278bd
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Permission/+/23430519
Change-Id: I5f9c978c6523e43730e024ad9ceb8217eed95d53
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
14 files changed, 68 insertions, 64 deletions
diff --git a/PermissionController/res/layout-w764dp-v33/action_button_list.xml b/PermissionController/res/layout-v33/action_button_list_large_screen.xml index 4db6df47c..141290fa2 100644 --- a/PermissionController/res/layout-w764dp-v33/action_button_list.xml +++ b/PermissionController/res/layout-v33/action_button_list_large_screen.xml @@ -16,6 +16,4 @@ <com.android.permissioncontroller.safetycenter.ui.EqualWidthContainer - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/action_button_list" style="@style/SafetyCenterIssueActionButtonList" /> diff --git a/PermissionController/res/layout-v33/action_button_list.xml b/PermissionController/res/layout-v33/action_button_list_small_screen.xml index 3217f4c78..048ac4595 100644 --- a/PermissionController/res/layout-v33/action_button_list.xml +++ b/PermissionController/res/layout-v33/action_button_list_small_screen.xml @@ -15,6 +15,4 @@ --> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/action_button_list" style="@style/SafetyCenterIssueActionButtonList" /> diff --git a/PermissionController/res/layout-v33/preference_issue_card.xml b/PermissionController/res/layout-v33/preference_issue_card.xml index 571efae3b..2de2670c2 100644 --- a/PermissionController/res/layout-v33/preference_issue_card.xml +++ b/PermissionController/res/layout-v33/preference_issue_card.xml @@ -54,7 +54,7 @@ <include android:id="@+id/issue_card_action_button_list" - layout="@layout/action_button_list"/> + layout="?attr/scActionButtonListLayout"/> <com.android.permissioncontroller.permission.ui.v33.widget.SafetyProtectionSectionView android:id="@+id/issue_card_protected_by_android" diff --git a/PermissionController/res/values-night-v33/themes.xml b/PermissionController/res/values-night-v33/themes.xml index 6374ee088..162ae4d9b 100644 --- a/PermissionController/res/values-night-v33/themes.xml +++ b/PermissionController/res/values-night-v33/themes.xml @@ -49,8 +49,11 @@ <item name="scStatusButtonStyle">@style/SafetyCenterStatusButton.Responsive</item> <!-- Buttons --> - <item name="scActionButtonStyle">@style/SafetyCenterActionButton</item> - <item name="scSecondaryActionButtonStyle">@style/SafetyCenterActionButton.Secondary</item> + <item name="scActionButtonListLayout">@layout/action_button_list_responsive</item> + <item name="scActionButtonStyle">@style/SafetyCenterActionButton.Responsive</item> + <item name="scSecondaryActionButtonStyle"> + @style/SecondarySafetyCenterActionButton.Responsive + </item> <item name="textColorScActionButton">@color/sc_primary_action_button_text</item> <item name="textColorScSecondaryActionButton">?android:attr/textColorPrimary</item> diff --git a/PermissionController/res/values-v33/attrs.xml b/PermissionController/res/values-v33/attrs.xml index b59716f6d..2c62b253e 100644 --- a/PermissionController/res/values-v33/attrs.xml +++ b/PermissionController/res/values-v33/attrs.xml @@ -37,7 +37,10 @@ <attr name="scStatusTitleAndSummaryContainerStyle" format="reference" /> <attr name="scStatusButtonStyle" format="reference" /> + + <attr name="scActionButtonListLayout" format="reference" /> <attr name="scActionButtonStyle" format="reference"/> <attr name="scSecondaryActionButtonStyle" format="reference"/> + <attr name="colorScShieldAccent" format="color" /> </resources>
\ No newline at end of file diff --git a/PermissionController/res/values-v33/dimens.xml b/PermissionController/res/values-v33/dimens.xml index ef70d2711..e6925bc54 100644 --- a/PermissionController/res/values-v33/dimens.xml +++ b/PermissionController/res/values-v33/dimens.xml @@ -24,20 +24,25 @@ <dimen name="sc_spacing_xlarge">18dp</dimen> <dimen name="sc_spacing_xxlarge">20dp</dimen> <dimen name="sc_spacing_xxxlarge">24dp</dimen> - <dimen name="sc_large_screen_button_padding">56dp</dimen> <dimen name="sc_card_margin">@dimen/sc_spacing_xxxsmall</dimen> <dimen name="sc_list_margin">@dimen/sc_spacing_large</dimen> <dimen name="sc_list_margin_top">@dimen/sc_spacing_small</dimen> + + <!-- Only used for small screen views, but doesn't have _small_screen suffix since it's fixed in + the overlayable. --> <dimen name="sc_action_button_list_margin">@dimen/sc_spacing_large</dimen> + <dimen name="sc_action_button_list_margin_large_screen">@dimen/sc_spacing_large</dimen> <dimen name="sc_top_action_button_margin">@dimen/sc_spacing_xxxlarge</dimen> + <dimen name="sc_button_horizontal_padding_small_screen">@dimen/sc_spacing_xxxlarge</dimen> + <dimen name="sc_button_horizontal_padding_large_screen">56dp</dimen> + <dimen name="sc_entry_padding_end">@dimen/sc_spacing_xxxlarge</dimen> <dimen name="sc_entry_group_expanded_padding_top">@dimen/sc_spacing_xxxlarge</dimen> <dimen name="sc_entry_group_expanded_padding_bottom">@dimen/sc_spacing_xsmall</dimen> <dimen name="sc_entry_group_collapsed_padding_top">@dimen/sc_spacing_large</dimen> <dimen name="sc_entry_group_collapsed_padding_bottom">@dimen/sc_spacing_large</dimen> <dimen name="sc_card_margin_bottom">@dimen/sc_spacing_xxxlarge</dimen> - <dimen name="sc_button_horizontal_padding">@dimen/sc_spacing_xxxlarge</dimen> <dimen name="sc_icon_button_touch_target_size">48dp</dimen> <dimen name="sc_button_corner_radius">12dp</dimen> diff --git a/PermissionController/res/values-v33/layout.xml b/PermissionController/res/values-v33/layout.xml new file mode 100644 index 000000000..a963dae0d --- /dev/null +++ b/PermissionController/res/values-v33/layout.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <item name="action_button_list_fixed" type="layout"> + @layout/action_button_list_small_screen + </item> + <item name="action_button_list_responsive" type="layout"> + @layout/action_button_list_small_screen + </item> +</resources>
\ No newline at end of file diff --git a/PermissionController/res/values-v33/styles.xml b/PermissionController/res/values-v33/styles.xml index a0938665f..e53cbc250 100644 --- a/PermissionController/res/values-v33/styles.xml +++ b/PermissionController/res/values-v33/styles.xml @@ -326,8 +326,8 @@ parent="@style/Widget.MaterialComponents.Button.UnelevatedButton"> <item name="android:theme">@style/Theme.MaterialComponents</item> <item name="android:minHeight">56dp</item> - <item name="android:paddingStart">@dimen/sc_button_horizontal_padding</item> - <item name="android:paddingEnd">@dimen/sc_button_horizontal_padding</item> + <item name="android:paddingStart">@dimen/sc_button_horizontal_padding_small_screen</item> + <item name="android:paddingEnd">@dimen/sc_button_horizontal_padding_small_screen</item> <item name="android:paddingTop">@dimen/sc_spacing_xlarge</item> <item name="android:paddingBottom">@dimen/sc_spacing_xlarge</item> <item name="android:insetTop">0dp</item> @@ -340,13 +340,15 @@ <item name="cornerRadius">@dimen/sc_button_corner_radius</item> <item name="rippleColor">?android:colorControlHighlight</item> </style> + <style name="SafetyCenterActionButton.Fixed" /> + <style name="SafetyCenterActionButton.Responsive" /> - <style name="SafetyCenterActionButton.Secondary" + <style name="SecondarySafetyCenterActionButton" parent="@style/Widget.MaterialComponents.Button.OutlinedButton"> <item name="android:theme">@style/Theme.MaterialComponents</item> <item name="android:minHeight">56dp</item> - <item name="android:paddingStart">@dimen/sc_button_horizontal_padding</item> - <item name="android:paddingEnd">@dimen/sc_button_horizontal_padding</item> + <item name="android:paddingStart">@dimen/sc_button_horizontal_padding_small_screen</item> + <item name="android:paddingEnd">@dimen/sc_button_horizontal_padding_small_screen</item> <item name="android:paddingTop">@dimen/sc_spacing_xlarge</item> <item name="android:paddingBottom">@dimen/sc_spacing_xlarge</item> <item name="android:insetTop">0dp</item> @@ -361,6 +363,8 @@ <item name="cornerRadius">@dimen/sc_button_corner_radius</item> <item name="rippleColor">?android:colorControlHighlight</item> </style> + <style name="SecondarySafetyCenterActionButton.Fixed" /> + <style name="SecondarySafetyCenterActionButton.Responsive" /> <!-- START SAFETY STATUS CARD --> <style name="SafetyCenterCard.Status"> diff --git a/PermissionController/res/values-v33/themes.xml b/PermissionController/res/values-v33/themes.xml index 338cbaa01..a328ca911 100644 --- a/PermissionController/res/values-v33/themes.xml +++ b/PermissionController/res/values-v33/themes.xml @@ -47,8 +47,11 @@ <item name="scStatusButtonStyle">@style/SafetyCenterStatusButton.Fixed</item> <!-- Buttons --> - <item name="scActionButtonStyle">@style/SafetyCenterActionButton</item> - <item name="scSecondaryActionButtonStyle">@style/SafetyCenterActionButton.Secondary</item> + <item name="scActionButtonListLayout">@layout/action_button_list_fixed</item> + <item name="scActionButtonStyle">@style/SafetyCenterActionButton.Fixed</item> + <item name="scSecondaryActionButtonStyle"> + @style/SecondarySafetyCenterActionButton.Fixed + </item> <item name="textColorScActionButton">@color/sc_primary_action_button_text</item> <!-- While the rest of the text colors automatically appear correct in quick settings, @@ -93,8 +96,11 @@ <item name="scStatusButtonStyle">@style/SafetyCenterStatusButton.Responsive</item> <!-- Buttons --> - <item name="scActionButtonStyle">@style/SafetyCenterActionButton</item> - <item name="scSecondaryActionButtonStyle">@style/SafetyCenterActionButton.Secondary</item> + <item name="scActionButtonListLayout">@layout/action_button_list_responsive</item> + <item name="scActionButtonStyle">@style/SafetyCenterActionButton.Responsive</item> + <item name="scSecondaryActionButtonStyle"> + @style/SecondarySafetyCenterActionButton.Responsive + </item> <item name="textColorScActionButton">@color/sc_primary_action_button_text</item> <item name="textColorScSecondaryActionButton">?android:attr/textColorPrimary</item> diff --git a/PermissionController/res/values-w764dp-v33/dimens.xml b/PermissionController/res/values-w764dp-v33/dimens.xml deleted file mode 100644 index 78b4675f2..000000000 --- a/PermissionController/res/values-w764dp-v33/dimens.xml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- - ~ 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. - --> - -<resources> - <dimen name="sc_button_horizontal_padding">@dimen/sc_large_screen_button_padding</dimen> -</resources> diff --git a/PermissionController/res/values-w764dp-v33/layout.xml b/PermissionController/res/values-w764dp-v33/layout.xml new file mode 100644 index 000000000..9035c8868 --- /dev/null +++ b/PermissionController/res/values-w764dp-v33/layout.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <item name="action_button_list_responsive" type="layout"> + @layout/action_button_list_large_screen + </item> +</resources>
\ No newline at end of file diff --git a/PermissionController/res/values-w764dp-v33/styles.xml b/PermissionController/res/values-w764dp-v33/styles.xml index a836e4aa5..78f1bb42e 100644 --- a/PermissionController/res/values-w764dp-v33/styles.xml +++ b/PermissionController/res/values-w764dp-v33/styles.xml @@ -16,6 +16,16 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> + <style name="SafetyCenterActionButton.Responsive"> + <item name="android:paddingStart">@dimen/sc_button_horizontal_padding_large_screen</item> + <item name="android:paddingEnd">@dimen/sc_button_horizontal_padding_large_screen</item> + </style> + + <style name="SecondarySafetyCenterActionButton.Responsive"> + <item name="android:paddingStart">@dimen/sc_button_horizontal_padding_large_screen</item> + <item name="android:paddingEnd">@dimen/sc_button_horizontal_padding_large_screen</item> + </style> + <!-- START SAFETY STATUS CARD --> <style name="SafetyCenterStatusTitleAndSummaryContainer.Responsive"> <item name="layout_constraintEnd_toStartOf">@id/sc_status_buttons_start_barrier</item> @@ -30,8 +40,8 @@ <item name="layout_constraintStart_toEndOf">@id/status_title_and_summary</item> <item name="layout_constraintEnd_toEndOf">parent</item> <item name="android:layout_marginTop">@dimen/sc_spacing_xxsmall</item> - <item name="android:paddingStart">@dimen/sc_large_screen_button_padding</item> - <item name="android:paddingEnd">@dimen/sc_large_screen_button_padding</item> + <item name="android:paddingStart">@dimen/sc_button_horizontal_padding_large_screen</item> + <item name="android:paddingEnd">@dimen/sc_button_horizontal_padding_large_screen</item> <!-- Clear the base style constraints so they don't conflict with this style's constraints on the same sides. --> <item name="layout_constraintTop_toBottomOf">@null</item> diff --git a/PermissionController/res/values-w764dp-v34/dimens.xml b/PermissionController/res/values-w764dp-v34/dimens.xml deleted file mode 100644 index cb336fc3e..000000000 --- a/PermissionController/res/values-w764dp-v34/dimens.xml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- - ~ 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. - --> - -<resources> - <dimen name="sc_action_button_list_margin">@dimen/sc_spacing_large</dimen> -</resources> diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java index c56cce0a5..e561bac85 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/IssueCardPreference.java @@ -134,9 +134,7 @@ public class IssueCardPreference extends Preference implements ComparablePrefere configureSafetyProtectionView(holder); maybeStartResolutionAnimation(holder); - mSafetyCenterViewModel - .getInteractionLogger() - .recordIssueViewed(mIssue, mIsDismissed); + mSafetyCenterViewModel.getInteractionLogger().recordIssueViewed(mIssue, mIsDismissed); } private void maybeDisplayText(@Nullable CharSequence maybeText, TextView textView) { @@ -540,9 +538,11 @@ public class IssueCardPreference extends Preference implements ComparablePrefere return; } - int margin = - mContext.getResources() - .getDimensionPixelSize(R.dimen.sc_action_button_list_margin); + int marginRes = + mIsLargeScreen + ? R.dimen.sc_action_button_list_margin_large_screen + : R.dimen.sc_action_button_list_margin; + int margin = mContext.getResources().getDimensionPixelSize(marginRes); Space space = new Space(mContext); space.setLayoutParams(new ViewGroup.LayoutParams(margin, margin)); buttonList.addView(space); |