use of android.app.AlertDialog.Builder in project AndEngine by nicolasgramlich.
the class BetaUtils method finishWhenExpired.
public static boolean finishWhenExpired(final Activity pActivity, final GregorianCalendar pExpirationDate, final int pTitleResourceID, final int pMessageResourceID, final Intent pOkIntent, final Intent pCancelIntent) {
final SharedPreferences spref = SimplePreferences.getInstance(pActivity);
final long now = System.currentTimeMillis();
final long lastuse = Math.max(now, spref.getLong(PREFERENCES_BETAUTILS_ID, -1));
spref.edit().putLong(PREFERENCES_BETAUTILS_ID, lastuse).commit();
final GregorianCalendar lastuseDate = new GregorianCalendar();
lastuseDate.setTimeInMillis(lastuse);
if (lastuseDate.after(pExpirationDate)) {
final Builder alertDialogBuilder = new AlertDialog.Builder(pActivity).setTitle(pTitleResourceID).setIcon(android.R.drawable.ic_dialog_alert).setMessage(pMessageResourceID);
alertDialogBuilder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface pDialog, final int pWhich) {
if (pOkIntent != null) {
pActivity.startActivity(pOkIntent);
}
pActivity.finish();
}
});
alertDialogBuilder.setNegativeButton(android.R.string.cancel, new OnClickListener() {
@Override
public void onClick(final DialogInterface pDialog, final int pWhich) {
if (pCancelIntent != null) {
pActivity.startActivity(pCancelIntent);
}
pActivity.finish();
}
}).create().show();
return true;
} else {
return false;
}
}
use of android.app.AlertDialog.Builder in project platform_frameworks_base by android.
the class KeyguardSimPinView method getSimRemainingAttemptsDialog.
private Dialog getSimRemainingAttemptsDialog(int remaining) {
String msg = getPinPasswordErrorMessage(remaining);
if (mRemainingAttemptsDialog == null) {
Builder builder = new AlertDialog.Builder(mContext);
builder.setMessage(msg);
builder.setCancelable(false);
builder.setNeutralButton(R.string.ok, null);
mRemainingAttemptsDialog = builder.create();
mRemainingAttemptsDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
} else {
mRemainingAttemptsDialog.setMessage(msg);
}
return mRemainingAttemptsDialog;
}
use of android.app.AlertDialog.Builder in project DroidPlugin by DroidPluginTeam.
the class ApkFragment method doUninstall.
private void doUninstall(final ApkItem item) {
AlertDialog.Builder builder = new Builder(getActivity());
builder.setTitle("警告,你确定要删除么?");
builder.setMessage("警告,你确定要删除" + item.title + "么?");
builder.setNegativeButton("删除", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new File(item.apkfile).delete();
adapter.remove(item);
Toast.makeText(getActivity(), "删除成功", Toast.LENGTH_SHORT).show();
}
});
builder.setNeutralButton("取消", null);
builder.show();
}
use of android.app.AlertDialog.Builder in project DroidPlugin by DroidPluginTeam.
the class InstalledFragment method doUninstall.
private void doUninstall(final ApkItem item) {
AlertDialog.Builder builder = new Builder(getActivity());
builder.setTitle("警告,你确定要删除么?");
builder.setMessage("警告,你确定要删除" + item.title + "么?");
builder.setNegativeButton("删除", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (!PluginManager.getInstance().isConnected()) {
Toast.makeText(getActivity(), "服务未连接", Toast.LENGTH_SHORT).show();
} else {
try {
PluginManager.getInstance().deletePackage(item.packageInfo.packageName, 0);
Toast.makeText(getActivity(), "删除完成", Toast.LENGTH_SHORT).show();
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
});
builder.setNeutralButton("取消", null);
builder.show();
}
use of android.app.AlertDialog.Builder in project openkit-android by OpenKit.
the class Util method showAlert.
/**
* Display a simple alert dialog with the given text and title.
*
* @param context
* Android context in which the dialog should be displayed
* @param title
* Alert dialog title
* @param text
* Alert dialog message
*/
@Deprecated
public static void showAlert(Context context, String title, String text) {
Builder alertBuilder = new Builder(context);
alertBuilder.setTitle(title);
alertBuilder.setMessage(text);
alertBuilder.create().show();
}
Aggregations