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

Commit d31f12eb authored by changbetty's avatar changbetty
Browse files

To fix the footer link is not clickable in the Bluetooth Settings

 - Links are not allowed in footer preference title now. So follow the
   Wi-Fi UX design to add the string "Change". Let the user to click and
   go to the Bluetooth scanninng settings

Bug: 265167737
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=BluetoothSwitchPreferenceControllerTest

Change-Id: If9e666df7b987e0dbe3d550ac0af03b9d79230de
Merged-In: If9e666df7b987e0dbe3d550ac0af03b9d79230de
parent 18eb985e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2031,7 +2031,9 @@
    <!-- Bluetooth settings. Text displayed when Bluetooth is off and device list is empty [CHAR LIMIT=50]-->
    <string name="bluetooth_empty_list_bluetooth_off">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.</string>
    <!-- Bluetooth settings. Text displayed when Bluetooth is off and bluetooth scanning is turned on [CHAR LIMIT=NONE] -->
    <string name="bluetooth_scanning_on_info_message">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.\n\nTo improve device experience, apps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. You can change this in <annotation id="link">Bluetooth scanning settings</annotation>.</string>
    <string name="bluetooth_scanning_on_info_message">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.\n\nTo improve device experience, apps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. You can change this in Bluetooth scanning settings.</string>
    <!-- Bluetooth settings. Link text to bring the user to "scanning settings" screen. [CHAR LIMIT=NONE]-->
    <string name="bluetooth_scan_change">Change</string>
    <!-- Message to describe "BLE scan always available feature" when Bluetooth is off. The
      place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring
      the user to "scanning settings" screen. -->
@@ -2042,6 +2044,7 @@
    <!-- Bluetooth connecting error message [CHAR LIMIT=NONE] -->
    <string name="bluetooth_connect_failed">Couldn\'t connect. Try again.</string>
    <!-- Title of device details screen [CHAR LIMIT=28]-->
    <string name="device_details_title">Device details</string>
    <!-- Title of the item to show device MAC address -->
+6 −8
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import com.android.settings.R;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.location.BluetoothScanningFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.utils.AnnotationSpan;
import com.android.settings.widget.SwitchWidgetController;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
@@ -121,15 +120,14 @@ public class BluetoothSwitchPreferenceController
    }

    @VisibleForTesting void updateText(boolean isChecked) {
        if (!isChecked
                && Utils.isBluetoothScanningEnabled(mContext)) {
            AnnotationSpan.LinkInfo info = new AnnotationSpan.LinkInfo(
                    AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION, this);
            CharSequence text = AnnotationSpan.linkify(
                    mContext.getText(R.string.bluetooth_scanning_on_info_message), info);
            mFooterPreference.setTitle(text);
        if (!isChecked && Utils.isBluetoothScanningEnabled(mContext)) {
            mFooterPreference.setTitle(R.string.bluetooth_scanning_on_info_message);
            mFooterPreference.setLearnMoreText(mContext.getString(R.string.bluetooth_scan_change));
            mFooterPreference.setLearnMoreAction(v -> onClick(v));
        } else {
            mFooterPreference.setTitle(R.string.bluetooth_empty_list_bluetooth_off);
            mFooterPreference.setLearnMoreText("");
            mFooterPreference.setLearnMoreAction(null);
        }
    }
}