mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-04 22:27:47 +00:00
Create our own dialog when GooglePlayServicesUtil can't.
Fixes #2505 Closes #3005 // FREEBIE
This commit is contained in:
parent
bcd9aa84d6
commit
95a94eeebf
@ -279,6 +279,9 @@
|
|||||||
<string name="PassphrasePromptActivity_ok_button_content_description">Submit passphrase</string>
|
<string name="PassphrasePromptActivity_ok_button_content_description">Submit passphrase</string>
|
||||||
<string name="PassphrasePromptActivity_invalid_passphrase_exclamation">Invalid passphrase!</string>
|
<string name="PassphrasePromptActivity_invalid_passphrase_exclamation">Invalid passphrase!</string>
|
||||||
|
|
||||||
|
<!-- PlayServicesProblemFragment -->
|
||||||
|
<string name="PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning">The version of Google Play Services you have installed is not functioning correctly. Please reinstall Google Play Services and try again.</string>
|
||||||
|
|
||||||
<!-- RatingManager -->
|
<!-- RatingManager -->
|
||||||
<string name="RatingManager_rate_this_app">Rate this app</string>
|
<string name="RatingManager_rate_this_app">Rate this app</string>
|
||||||
<string name="RatingManager_if_you_enjoy_using_this_app_please_take_a_moment">If you enjoy using this app, please take a moment to help us by rating it.</string>
|
<string name="RatingManager_if_you_enjoy_using_this_app_please_take_a_moment">If you enjoy using this app, please take a moment to help us by rating it.</string>
|
||||||
|
@ -17,19 +17,47 @@
|
|||||||
|
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||||
|
|
||||||
public class PlayServicesProblemFragment extends DialogFragment {
|
public class PlayServicesProblemFragment extends DialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(@NonNull Bundle bundle) {
|
public @NonNull Dialog onCreateDialog(@NonNull Bundle bundle) {
|
||||||
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
|
int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
|
||||||
return GooglePlayServicesUtil.getErrorDialog(code, getActivity(), 9111);
|
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(code, getActivity(), 9111);
|
||||||
|
|
||||||
|
if (dialog == null) {
|
||||||
|
return new MaterialDialog.Builder(getActivity()).negativeText(android.R.string.ok)
|
||||||
|
.content(getActivity().getString(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning))
|
||||||
|
.build();
|
||||||
|
} else {
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(DialogInterface dialog) {
|
||||||
|
super.onCancel(dialog);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finish() {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null) activity.finish();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user