Merge pull request #7785 from osmandapp/Fix_7776

Fix #7776
This commit is contained in:
max-klaus 2019-10-30 11:33:37 +03:00 committed by GitHub
commit 221406da90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<OsmandSettings.DrivingRegion> singleChoiceAdapter =
new ArrayAdapter<OsmandSettings.DrivingRegion>(getActivity(), R.layout.single_choice_description_item, R.id.text1, drs) {
new ArrayAdapter<OsmandSettings.DrivingRegion>(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);