61 lines
2.1 KiB
Java
61 lines
2.1 KiB
Java
package org.greenrobot.eventbus.util;
|
|
|
|
import android.R;
|
|
import android.annotation.TargetApi;
|
|
import android.app.Activity;
|
|
import android.app.AlertDialog;
|
|
import android.app.Dialog;
|
|
import android.app.DialogFragment;
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.os.Bundle;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ErrorDialogFragments {
|
|
public static int a;
|
|
public static Class<?> b;
|
|
|
|
@TargetApi(11)
|
|
public static class Honeycomb extends DialogFragment implements DialogInterface.OnClickListener {
|
|
@Override // android.content.DialogInterface.OnClickListener
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
ErrorDialogFragments.a(dialogInterface, i, getActivity(), getArguments());
|
|
}
|
|
|
|
@Override // android.app.DialogFragment
|
|
public Dialog onCreateDialog(Bundle bundle) {
|
|
return ErrorDialogFragments.a(getActivity(), getArguments(), this);
|
|
}
|
|
}
|
|
|
|
public static Dialog a(Context context, Bundle bundle, DialogInterface.OnClickListener onClickListener) {
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
|
builder.setTitle(bundle.getString("de.greenrobot.eventbus.errordialog.title"));
|
|
builder.setMessage(bundle.getString("de.greenrobot.eventbus.errordialog.message"));
|
|
int i = a;
|
|
if (i != 0) {
|
|
builder.setIcon(i);
|
|
}
|
|
builder.setPositiveButton(R.string.ok, onClickListener);
|
|
return builder.create();
|
|
}
|
|
|
|
public static void a(DialogInterface dialogInterface, int i, Activity activity, Bundle bundle) {
|
|
Class<?> cls = b;
|
|
if (cls == null) {
|
|
if (!bundle.getBoolean("de.greenrobot.eventbus.errordialog.finish_after_dialog", false) || activity == null) {
|
|
return;
|
|
}
|
|
activity.finish();
|
|
return;
|
|
}
|
|
try {
|
|
cls.newInstance();
|
|
ErrorDialogManager.a.a.a();
|
|
throw null;
|
|
} catch (Exception e) {
|
|
throw new RuntimeException("Event cannot be constructed", e);
|
|
}
|
|
}
|
|
}
|