diff --git a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java index 4f77a9e285..9db9a02747 100644 --- a/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettingsFragment.java @@ -1,5 +1,6 @@ package net.osmand.plus.settings; +import android.content.Context; import android.content.DialogInterface; import android.content.pm.ActivityInfo; import android.graphics.drawable.Drawable; @@ -26,6 +27,7 @@ import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet; @@ -276,7 +278,8 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme } private void showDrivingRegionDialog() { - final AlertDialog.Builder b = new AlertDialog.Builder(getActivity()); + Context themedContext = UiUtilities.getThemedContext(getActivity(), isNightMode()); + AlertDialog.Builder b = new AlertDialog.Builder(themedContext); b.setTitle(getString(R.string.driving_region)); @@ -297,14 +300,13 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme final int selected = sel; final ArrayAdapter singleChoiceAdapter = - new ArrayAdapter(getActivity(), R.layout.single_choice_description_item, R.id.text1, drs) { + new ArrayAdapter(themedContext, R.layout.single_choice_description_item, R.id.text1, drs) { @NonNull @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { View v = convertView; if (v == null) { - LayoutInflater inflater = getActivity().getLayoutInflater(); - v = inflater.inflate(R.layout.single_choice_description_item, parent, false); + v = LayoutInflater.from(parent.getContext()).inflate(R.layout.single_choice_description_item, parent, false); } OsmandSettings.DrivingRegion item = getItem(position); AppCompatCheckedTextView title = (AppCompatCheckedTextView) v.findViewById(R.id.text1);