From eeedbc44f9a8c5e3c08795b4f5b877e8fb05b38b Mon Sep 17 00:00:00 2001 From: Peter Kalauskas Date: Tue, 23 Mar 2021 15:23:01 -0700 Subject: [PATCH] Allow QS detail panels to change text of "Done" button User detail panel settings button will now say "Close" instead of "Done" Bug: 169783558 Test: atest SystemUITests Change-Id: Ibafe212dce8a8b8654e877418200e1dc2c5dec8b --- .../com/android/systemui/plugins/qs/DetailAdapter.java | 9 +++++++++ packages/SystemUI/res/values/strings.xml | 2 ++ .../SystemUI/src/com/android/systemui/qs/QSDetail.java | 7 ++++--- .../statusbar/policy/KeyguardQsUserSwitchController.java | 5 +++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/DetailAdapter.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/DetailAdapter.java index caa9b4f4ec180..95c2d2efcd89b 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/DetailAdapter.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/DetailAdapter.java @@ -51,6 +51,15 @@ public interface DetailAdapter { return Resources.ID_NULL; } + /** + * @return resource id of the string to use for closing the detail panel. If + * {@code Resources.ID_NULL}, then use the default string: + * {@code com.android.systemui.R.string.quick_settings_done} + */ + default int getDoneText() { + return Resources.ID_NULL; + } + void setToggleState(boolean state); int getMetricsCategory(); diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 935f0259fe862..c6f39dc8034e8 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -893,6 +893,8 @@ User settings Done + + Close Connected diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java index 05bc6e2a5e1e9..d54d3f21f0b68 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java @@ -140,9 +140,10 @@ public class QSDetail extends LinearLayout { } private void updateDetailText() { - mDetailDoneButton.setText(R.string.quick_settings_done); - final int resId = - mDetailAdapter != null ? mDetailAdapter.getSettingsText() : Resources.ID_NULL; + int resId = mDetailAdapter != null ? mDetailAdapter.getDoneText() : Resources.ID_NULL; + mDetailDoneButton.setText( + (resId != Resources.ID_NULL) ? resId : R.string.quick_settings_done); + resId = mDetailAdapter != null ? mDetailAdapter.getSettingsText() : Resources.ID_NULL; mDetailSettingsButton.setText( (resId != Resources.ID_NULL) ? resId : R.string.quick_settings_more_settings); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java index 461587760f568..fd37d89a24ece 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardQsUserSwitchController.java @@ -320,6 +320,11 @@ public class KeyguardQsUserSwitchController extends ViewController