|
|
|
@ -350,8 +350,31 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|
|
|
|
onNothingSelected(adapterView);
|
|
|
|
|
else {
|
|
|
|
|
String tag = languages.get(position - 1).first;
|
|
|
|
|
if (tag.equals(spLanguage.getTag()))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
new AlertDialog.Builder(view.getContext())
|
|
|
|
|
.setTitle(languages.get(position - 1).second)
|
|
|
|
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
prefs.edit().putString("language", tag).commit(); // apply won't work here
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onDismiss(DialogInterface dialog) {
|
|
|
|
|
setOptions();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -865,6 +888,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|
|
|
|
selected = pos + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
spLanguage.setTag(language);
|
|
|
|
|
|
|
|
|
|
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, android.R.id.text1, display);
|
|
|
|
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
|
|
|
spLanguage.setAdapter(adapter);
|
|
|
|
|