Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b497b08 authored by Rohan Shah's avatar Rohan Shah
Browse files

[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
parent 3f9a1a54
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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>
+12 −9
Original line number Diff line number Diff line
@@ -113,11 +113,11 @@ public class HotspotTile extends QSTileImpl<AirplaneBooleanState> {
        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 @@ public class HotspotTile extends QSTileImpl<AirplaneBooleanState> {
            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 @@ public class HotspotTile extends QSTileImpl<AirplaneBooleanState> {
    }

    @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);
        }