Locale list: format the numbers using the UI locale
The digits used for numbering the drag-and-drop locale list should use a locale-aware formatter. We will not see decimal or thousand separators, but the visible difference is in the use of native digits. Example: Arabic. Change-Id: I3f8cd5a3adea1cb88ae63f09711c728f4588020c
This commit is contained in:
@@ -32,6 +32,7 @@ import com.android.settings.R;
|
|||||||
import com.android.internal.app.LocalePicker;
|
import com.android.internal.app.LocalePicker;
|
||||||
import com.android.internal.app.LocaleStore;
|
import com.android.internal.app.LocaleStore;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -45,6 +46,7 @@ class LocaleDragAndDropAdapter
|
|||||||
private final ItemTouchHelper mItemTouchHelper;
|
private final ItemTouchHelper mItemTouchHelper;
|
||||||
private boolean mRemoveMode = false;
|
private boolean mRemoveMode = false;
|
||||||
private boolean mDragEnabled = true;
|
private boolean mDragEnabled = true;
|
||||||
|
private NumberFormat mNumberFormatter = NumberFormat.getNumberInstance();
|
||||||
|
|
||||||
class CustomViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener {
|
class CustomViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener {
|
||||||
private final LocaleDragCell mLocaleDragCell;
|
private final LocaleDragCell mLocaleDragCell;
|
||||||
@@ -113,7 +115,7 @@ class LocaleDragAndDropAdapter
|
|||||||
String label = feedItem.getFullNameNative();
|
String label = feedItem.getFullNameNative();
|
||||||
dragCell.setLabel(label);
|
dragCell.setLabel(label);
|
||||||
dragCell.setLocalized(feedItem.isTranslated());
|
dragCell.setLocalized(feedItem.isTranslated());
|
||||||
dragCell.setMiniLabel(Integer.toString(i + 1));
|
dragCell.setMiniLabel(mNumberFormatter.format(i + 1));
|
||||||
dragCell.setShowCheckbox(mRemoveMode);
|
dragCell.setShowCheckbox(mRemoveMode);
|
||||||
dragCell.setShowMiniLabel(!mRemoveMode);
|
dragCell.setShowMiniLabel(!mRemoveMode);
|
||||||
dragCell.setShowHandle(!mRemoveMode);
|
dragCell.setShowHandle(!mRemoveMode);
|
||||||
@@ -195,6 +197,8 @@ class LocaleDragAndDropAdapter
|
|||||||
|
|
||||||
LocaleList ll = new LocaleList(newList);
|
LocaleList ll = new LocaleList(newList);
|
||||||
LocalePicker.updateLocales(ll);
|
LocalePicker.updateLocales(ll);
|
||||||
|
|
||||||
|
mNumberFormatter = NumberFormat.getNumberInstance(Locale.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDragEnabled(boolean enabled) {
|
private void setDragEnabled(boolean enabled) {
|
||||||
|
Reference in New Issue
Block a user