use of android.content.DialogInterface in project AdMoney by ErnestoGonAr.
the class MainActivity method onNavigationItemSelected.
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_ingresos) {
Intent i = new Intent(MainActivity.this, Reporte_Ingresos.class);
startActivity(i);
} else if (id == R.id.nav_egresos) {
Intent i = new Intent(MainActivity.this, Reporte_Egresos.class);
startActivity(i);
} else if (id == R.id.nav_prestamos) {
Intent i = new Intent(MainActivity.this, Reporte_Prestamos.class);
startActivity(i);
} else if (id == R.id.nav_adeudos) {
Intent i = new Intent(MainActivity.this, Reporte_Adeudos.class);
startActivity(i);
} else if (id == R.id.nav_pagoR) {
Intent i = new Intent(MainActivity.this, PagoRecurrenteActivity.class);
startActivity(i);
} else if (id == R.id.nav_reiniciar) {
new AlertDialog.Builder(this).setMessage("Estás seguro que deseas reiniciar los registros de la aplicacion?\n" + "Se eliminaran todos los registros. Esta accion no puede ser revertida.").setCancelable(false).setPositiveButton("Si", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
bd.eliminarRegistros();
Thread.sleep(500);
recreate();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).setNegativeButton("No", null).show();
} else if (id == R.id.nav_seguridad) {
Login log = bd.obtenerLogin();
if (log == null) {
Intent i = new Intent(MainActivity.this, EstablecerActivity.class);
startActivity(i);
} else {
Intent i = new Intent(MainActivity.this, ConfirmarActivity.class);
startActivity(i);
}
} else if (id == R.id.nav_singresos) {
Intent i = new Intent(MainActivity.this, CategoriasIngreso.class);
startActivity(i);
} else if (id == R.id.nav_segresos) {
Intent i = new Intent(MainActivity.this, CategoriasEgresos.class);
startActivity(i);
} else if (id == R.id.nav_share) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "AdMoney");
intent.putExtra(Intent.EXTRA_TEXT, "¿Quieres administrar mejor tu dinero?\n Descarga AdMoney https://play.google.com/store/apps/details?id=com.ernesto.admoney");
startActivity(Intent.createChooser(intent, "Compartir con"));
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
use of android.content.DialogInterface in project weex-example by KalicyZhou.
the class WXModalUIModule method alert.
@JSMethod(uiThread = true)
public void alert(String param, final JSCallback callback) {
if (mWXSDKInstance.getContext() instanceof Activity) {
String message = "";
String okTitle = OK;
if (!TextUtils.isEmpty(param)) {
try {
param = URLDecoder.decode(param, "utf-8");
JSONObject jsObj = JSON.parseObject(param);
message = jsObj.getString(MESSAGE);
okTitle = jsObj.getString(OK_TITLE);
} catch (Exception e) {
WXLogUtils.e("[WXModalUIModule] alert param parse error ", e);
}
}
if (TextUtils.isEmpty(message)) {
message = "";
}
AlertDialog.Builder builder = new AlertDialog.Builder(mWXSDKInstance.getContext());
builder.setMessage(message);
final String okTitle_f = TextUtils.isEmpty(okTitle) ? OK : okTitle;
builder.setPositiveButton(okTitle_f, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.invoke(okTitle_f);
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
tracking(alertDialog);
} else {
WXLogUtils.e("[WXModalUIModule] when call alert mWXSDKInstance.getContext() must instanceof Activity");
}
}
use of android.content.DialogInterface in project weex-example by KalicyZhou.
the class WXModalUIModule method confirm.
@JSMethod(uiThread = true)
public void confirm(String param, final JSCallback callback) {
if (mWXSDKInstance.getContext() instanceof Activity) {
String message = "";
String okTitle = OK;
String cancelTitle = CANCEL;
if (!TextUtils.isEmpty(param)) {
try {
param = URLDecoder.decode(param, "utf-8");
JSONObject jsObj = JSON.parseObject(param);
message = jsObj.getString(MESSAGE);
okTitle = jsObj.getString(OK_TITLE);
cancelTitle = jsObj.getString(CANCEL_TITLE);
} catch (Exception e) {
WXLogUtils.e("[WXModalUIModule] confirm param parse error ", e);
}
}
if (TextUtils.isEmpty(message)) {
message = "";
}
AlertDialog.Builder builder = new AlertDialog.Builder(mWXSDKInstance.getContext());
builder.setMessage(message);
final String okTitleFinal = TextUtils.isEmpty(okTitle) ? OK : okTitle;
final String cancelTitleFinal = TextUtils.isEmpty(cancelTitle) ? CANCEL : cancelTitle;
builder.setPositiveButton(okTitleFinal, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.invoke(okTitleFinal);
}
}
});
builder.setNegativeButton(cancelTitleFinal, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.invoke(cancelTitleFinal);
}
}
});
AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
tracking(alertDialog);
} else {
WXLogUtils.e("[WXModalUIModule] when call confirm mWXSDKInstance.getContext() must instanceof Activity");
}
}
use of android.content.DialogInterface in project UltimateAndroid by cymcsg.
the class DownloadDialogShower method showNoticeDialog.
public void showNoticeDialog(String alertInfo, final Thread thread) {
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(noticeTitle);
builder.setMessage(alertInfo);
builder.setPositiveButton(positiveButtonString, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
showDownloadDialog();
thread.start();
}
});
builder.setNegativeButton(negativeButtonString, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog noticeDialog = builder.create();
// noticeDialog.setContentView(v);
WindowManager.LayoutParams lp = noticeDialog.getWindow().getAttributes();
lp.height = 200;
noticeDialog.getWindow().setAttributes(lp);
noticeDialog.setCancelable(false);
noticeDialog.show();
}
use of android.content.DialogInterface in project UltimateAndroid by cymcsg.
the class DownloadDialogShower method showDownloadDialog.
private void showDownloadDialog() {
builder = new AlertDialog.Builder(mContext);
final LayoutInflater inflater = LayoutInflater.from(mContext);
View v = inflater.inflate(R.layout.progress_update, null);
mProgress = (ProgressBar) v.findViewById(R.id.progress);
updatePercentTextView = (TextView) v.findViewById(R.id.updatePercentTextView);
updateCurrentTextView = (TextView) v.findViewById(R.id.updateCurrentTextView);
updateCurrentTextView.setText(prepareDownloadingTextViewString);
updateTotalTextView = (TextView) v.findViewById(R.id.updateTotalTextView);
// builder.setCustomTitle(inflater.inflate(R.layout.progress_update_title, null));
builder.setTitle(downloadTitle);
builder.setView(v);
builder.setNegativeButton(downloadCancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
interceptFlag = true;
}
});
progressDialog = builder.create();
progressDialog.show();
}
Aggregations