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
This commit is contained in:
changbetty
2023-02-15 14:19:54 +00:00
parent 18eb985e41
commit d31f12eb4e
2 changed files with 10 additions and 9 deletions

View File

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