Use listChoiceIndicatorSingle for locale dialog

pull/935/head
Alex Baker 5 years ago
parent f21a741278
commit c468b16db7

@ -83,7 +83,7 @@ public class AlertDialogBuilder {
return this; return this;
} }
AlertDialogBuilder setSingleChoiceItems( public AlertDialogBuilder setSingleChoiceItems(
List<String> strings, int selectedIndex, DialogInterface.OnClickListener onClickListener) { List<String> strings, int selectedIndex, DialogInterface.OnClickListener onClickListener) {
builder.setSingleChoiceItems( builder.setSingleChoiceItems(
addDirectionality(strings.toArray(new String[0])), addDirectionality(strings.toArray(new String[0])),

@ -16,7 +16,6 @@ import org.tasks.injection.DialogFragmentComponent;
import org.tasks.injection.ForActivity; import org.tasks.injection.ForActivity;
import org.tasks.injection.InjectingDialogFragment; import org.tasks.injection.InjectingDialogFragment;
import org.tasks.themes.ThemeAccent; import org.tasks.themes.ThemeAccent;
import org.tasks.ui.SingleCheckedArrayAdapter;
public class LocalePickerDialog extends InjectingDialogFragment { public class LocalePickerDialog extends InjectingDialogFragment {
@ -38,13 +37,11 @@ public class LocalePickerDialog extends InjectingDialogFragment {
for (String override : getResources().getStringArray(R.array.localization)) { for (String override : getResources().getStringArray(R.array.localization)) {
locales.add(locale.withLanguage(override)); locales.add(locale.withLanguage(override));
} }
final List<String> display = transform(locales, Locale::getDisplayName); List<String> display = transform(locales, Locale::getDisplayName);
SingleCheckedArrayAdapter adapter =
new SingleCheckedArrayAdapter(context, display, themeAccent);
return dialogBuilder return dialogBuilder
.newDialog() .newDialog()
.setSingleChoiceItems( .setSingleChoiceItems(
adapter, display,
display.indexOf(locale.getDisplayName()), display.indexOf(locale.getDisplayName()),
(dialogInterface, i) -> { (dialogInterface, i) -> {
Locale locale = locales.get(i); Locale locale = locales.get(i);
@ -52,6 +49,7 @@ public class LocalePickerDialog extends InjectingDialogFragment {
getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_OK, data); getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_OK, data);
dialogInterface.dismiss(); dialogInterface.dismiss();
}) })
.setNegativeButton(android.R.string.cancel, null)
.show(); .show();
} }

@ -29,4 +29,5 @@
android:checked="false" android:checked="false"
android:drawablePadding="@dimen/keyline_second" android:drawablePadding="@dimen/keyline_second"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textAppearance="?attr/textAppearanceListItemSmall"/> android:textSize="18sp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"/>

Loading…
Cancel
Save