Merge "Tweak bluetooth name preference" into oc-dr1-dev am: 03c595ce24

am: ef0e290e65

Change-Id: I77ca5052477a9e1efee01c7022378164096669b8
This commit is contained in:
Fan Zhang
2017-07-22 00:32:48 +00:00
committed by android-build-merger
2 changed files with 5 additions and 18 deletions

View File

@@ -24,10 +24,8 @@ import android.content.IntentFilter;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.BidiFormatter;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import com.android.settings.R;
@@ -49,7 +47,6 @@ public class BluetoothDeviceNamePreferenceController extends AbstractPreferenceC
public static final String KEY_DEVICE_NAME = "device_name";
private final int mAccentColor;
@VisibleForTesting
Preference mPreference;
@@ -71,7 +68,6 @@ public class BluetoothDeviceNamePreferenceController extends AbstractPreferenceC
@VisibleForTesting
BluetoothDeviceNamePreferenceController(Context context, LocalBluetoothAdapter localAdapter) {
super(context);
mAccentColor = com.android.settingslib.Utils.getColorAccent(context);
mLocalAdapter = localAdapter;
}
@@ -134,12 +130,10 @@ public class BluetoothDeviceNamePreferenceController extends AbstractPreferenceC
// TODO: show error message in preference subtitle
return;
}
final Spannable spannableName = new SpannableString(deviceName);
spannableName.setSpan(new ForegroundColorSpan(mAccentColor), 0,
spannableName.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
final CharSequence summary = TextUtils.expandTemplate(
mContext.getText(R.string.bluetooth_device_name_summary), spannableName);
mContext.getText(R.string.bluetooth_device_name_summary),
BidiFormatter.getInstance().unicodeWrap(deviceName));
preference.setSelectable(false);
preference.setSummary(summary);
}