From 3512374f6215b7faaae5272f2155d303aaf72261 Mon Sep 17 00:00:00 2001 From: changbetty Date: Wed, 15 Feb 2023 14:19:54 +0000 Subject: [PATCH] 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 --- res/values/strings.xml | 4 +++- .../BluetoothSwitchPreferenceController.java | 14 ++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 5d3202271db..fcf0733d724 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1438,7 +1438,9 @@ When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices. - 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. + 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. + + Change Device details diff --git a/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java b/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java index ca27299279f..5c3af9b5cf5 100644 --- a/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java +++ b/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java @@ -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); } } }