This source file includes following definitions.
- onCreateDialog
- onDismiss
- setCurrentDialog
- getCurrentDialog
package org.chromium.chrome.browser;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import org.chromium.chrome.R;
class RepostFormWarningDialog extends DialogFragment {
private static Dialog sCurrentDialog;
private final Runnable mCancelCallback;
private final Runnable mContinueCallback;
public RepostFormWarningDialog(Runnable cancelCallback, Runnable continueCallback) {
mCancelCallback = cancelCallback;
mContinueCallback = continueCallback;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
.setMessage(R.string.http_post_warning)
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
mCancelCallback.run();
}
})
.setPositiveButton(R.string.http_post_warning_resend,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
mContinueCallback.run();
}
});
assert getCurrentDialog() == null;
Dialog dialog = builder.create();
setCurrentDialog(dialog);
return dialog;
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
setCurrentDialog(null);
}
private static void setCurrentDialog(Dialog dialog) {
sCurrentDialog = dialog;
}
public static Dialog getCurrentDialog() {
return sCurrentDialog;
}
}