mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
avoid android.view.WindowManager$BadTokenException in maybeShowConfigurationError
This commit is contained in:
@@ -403,7 +403,7 @@ public class InstantOnboardingActivity extends BaseActionBarActivity implements
|
||||
|
||||
private void progressError(String data2) {
|
||||
progressDialog.dismiss();
|
||||
maybeShowConfigurationError(this, data2);
|
||||
WelcomeActivity.maybeShowConfigurationError(this, data2);
|
||||
}
|
||||
|
||||
private void progressSuccess() {
|
||||
@@ -416,22 +416,6 @@ public class InstantOnboardingActivity extends BaseActionBarActivity implements
|
||||
finishAffinity();
|
||||
}
|
||||
|
||||
public static void maybeShowConfigurationError(Activity activity, String data2) {
|
||||
if (data2 != null && !data2.isEmpty()) {
|
||||
AlertDialog d = new AlertDialog.Builder(activity)
|
||||
.setMessage(data2)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.create();
|
||||
d.show();
|
||||
try {
|
||||
//noinspection ConstantConditions
|
||||
Linkify.addLinks((TextView) d.findViewById(android.R.id.message), Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
|
||||
} catch(NullPointerException e) {
|
||||
Log.e(TAG, "Linkify failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private void createProfile() {
|
||||
if (TextUtils.isEmpty(this.name.getText())) {
|
||||
|
||||
@@ -283,6 +283,8 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen
|
||||
}
|
||||
|
||||
public static void maybeShowConfigurationError(Activity activity, String data2) {
|
||||
if (activity.isFinishing()) return; // avoid android.view.WindowManager$BadTokenException
|
||||
|
||||
if (data2 != null && !data2.isEmpty()) {
|
||||
AlertDialog d = new AlertDialog.Builder(activity)
|
||||
.setMessage(data2)
|
||||
|
||||
Reference in New Issue
Block a user