[QS] Update hotspot secondary label transient text
Adds "turning on..." as a secondary label option when the hotspot is
being enabled.
Test: Visually
Bug: 70799372
Change-Id: If00bbab4e8c0101e4af7ed95acd95d1b5ee4926d
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 7dc4587..9eaca17 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -764,8 +764,10 @@
<string name="quick_settings_tethering_label">Tethering</string>
<!-- QuickSettings: Hotspot. [CHAR LIMIT=NONE] -->
<string name="quick_settings_hotspot_label">Hotspot</string>
+ <!-- QuickSettings: Hotspot. Secondary label shown when the hotspot is being enabled [CHAR LIMIT=NONE] -->
+ <string name="quick_settings_hotspot_secondary_label_transient">Turning on...</string>
<!-- QuickSettings: Hotspot: Secondary label for how many devices are connected to the hotspot [CHAR LIMIT=NONE] -->
- <plurals name="quick_settings_hotspot_num_devices">
+ <plurals name="quick_settings_hotspot_secondary_label_num_devices">
<item quantity="one">%d device</item>
<item quantity="other">%d devices</item>
</plurals>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
index e1b58fe..080e320 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
@@ -113,11 +113,11 @@
if (state.slash == null) {
state.slash = new SlashState();
}
- state.label = mContext.getString(R.string.quick_settings_hotspot_label);
-
- checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_CONFIG_TETHERING);
final int numConnectedDevices;
+ final boolean isTransient = mController.isHotspotTransient();
+
+ checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_CONFIG_TETHERING);
if (arg instanceof CallbackInfo) {
CallbackInfo info = (CallbackInfo) arg;
state.value = info.enabled;
@@ -127,11 +127,11 @@
numConnectedDevices = mController.getNumConnectedDevices();
}
- state.secondaryLabel = getSecondaryLabel(state.value, numConnectedDevices);
-
state.icon = mEnabledStatic;
+ state.label = mContext.getString(R.string.quick_settings_hotspot_label);
+ state.secondaryLabel = getSecondaryLabel(state.value, isTransient, numConnectedDevices);
state.isAirplaneMode = mAirplaneMode.getValue() != 0;
- state.isTransient = mController.isHotspotTransient();
+ state.isTransient = isTransient;
state.slash.isSlashed = !state.value && !state.isTransient;
if (state.isTransient) {
state.icon = ResourceIcon.get(R.drawable.ic_hotspot_transient_animation);
@@ -143,10 +143,13 @@
}
@Nullable
- private String getSecondaryLabel(boolean enabled, int numConnectedDevices) {
- if (numConnectedDevices > 0 && enabled) {
+ private String getSecondaryLabel(
+ boolean enabled, boolean isTransient, int numConnectedDevices) {
+ if (isTransient) {
+ return mContext.getString(R.string.quick_settings_hotspot_secondary_label_transient);
+ } else if (numConnectedDevices > 0 && enabled) {
return mContext.getResources().getQuantityString(
- R.plurals.quick_settings_hotspot_num_devices,
+ R.plurals.quick_settings_hotspot_secondary_label_num_devices,
numConnectedDevices,
numConnectedDevices);
}