Avoid Cast initialization UI - prompt users to restart upon settings changed.
This commit is contained in:
parent
0b5f4e9dc0
commit
2fe70c3b41
|
@ -1,8 +1,13 @@
|
|||
package de.danoeh.antennapod.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GoogleApiAvailability;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.fragment.preferences.PlaybackPreferencesFragment;
|
||||
|
||||
|
@ -18,6 +23,7 @@ public class PreferenceControllerFlavorHelper {
|
|||
final int googlePlayServicesCheck = GoogleApiAvailability.getInstance()
|
||||
.isGooglePlayServicesAvailable(ui.getActivity());
|
||||
if (googlePlayServicesCheck == ConnectionResult.SUCCESS) {
|
||||
displayRestartRequiredDialog(ui.requireContext());
|
||||
return true;
|
||||
} else {
|
||||
GoogleApiAvailability.getInstance()
|
||||
|
@ -26,7 +32,16 @@ public class PreferenceControllerFlavorHelper {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
displayRestartRequiredDialog(ui.requireContext());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private static void displayRestartRequiredDialog(@NonNull Context context) {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
|
||||
dialog.setTitle(android.R.string.dialog_alert_title);
|
||||
dialog.setMessage(R.string.pref_restart_required);
|
||||
dialog.setPositiveButton(android.R.string.ok, null);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue