Fix sentence capitalization of locale names.
It turns out that out previous CL [1] is not sufficient to address all the requests regarding capitalization. With [1], now InputMethodSubtype#getLocaleDisplayName() returns a locale name whose capitalization is basically optimized to be used as a list item. It works well for list UI, but on a UI element that looks like a sentence text, we still need to capitalize the first character. This CL takes care of those UI elements in the Settings app. This CL also addresses a remaining TODO about locale-unaware text formatting by using about android.icu.text.ListFormatter. [1]: If105082ce703db7a86738455db7e9fb37f3c6fe8 e489baf96df2837a3a63b626d9023a4a8b322c28 Bug: 29035638 Change-Id: I59f93f0bc067cdd87c6065c972a7da3cde1128f9
This commit is contained in:
@@ -39,7 +39,6 @@ import com.android.settingslib.RestrictedLockUtils;
|
||||
import com.android.settingslib.RestrictedSwitchPreference;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
@@ -213,17 +212,10 @@ class InputMethodPreference extends RestrictedSwitchPreference implements OnPref
|
||||
}
|
||||
|
||||
private String getSummaryString() {
|
||||
final Context context = getContext();
|
||||
final InputMethodManager imm = getInputMethodManager();
|
||||
final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(mImi, true);
|
||||
final ArrayList<CharSequence> subtypeLabels = new ArrayList<>();
|
||||
for (final InputMethodSubtype subtype : subtypes) {
|
||||
final CharSequence label = subtype.getDisplayName(
|
||||
context, mImi.getPackageName(), mImi.getServiceInfo().applicationInfo);
|
||||
subtypeLabels.add(label);
|
||||
}
|
||||
// TODO: A delimiter of subtype labels should be localized.
|
||||
return TextUtils.join(", ", subtypeLabels);
|
||||
return InputMethodAndSubtypeUtil.getSubtypeLocaleNameListAsSentence(
|
||||
subtypes, getContext(), mImi);
|
||||
}
|
||||
|
||||
private void showSecurityWarnDialog(final InputMethodInfo imi) {
|
||||
|
Reference in New Issue
Block a user