Search in sources :

Example 86 with DialogInterface

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;
}
Also used : DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) DrawerLayout(android.support.v4.widget.DrawerLayout)

Example 87 with DialogInterface

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");
    }
}
Also used : AlertDialog(android.app.AlertDialog) JSONObject(com.alibaba.fastjson.JSONObject) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) OnClickListener(android.content.DialogInterface.OnClickListener) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 88 with DialogInterface

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");
    }
}
Also used : AlertDialog(android.app.AlertDialog) JSONObject(com.alibaba.fastjson.JSONObject) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) OnClickListener(android.content.DialogInterface.OnClickListener) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 89 with DialogInterface

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();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) WindowManager(android.view.WindowManager)

Example 90 with DialogInterface

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();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) View(android.view.View)

Aggregations

DialogInterface (android.content.DialogInterface)2727 AlertDialog (android.app.AlertDialog)1227 View (android.view.View)877 Intent (android.content.Intent)708 TextView (android.widget.TextView)653 AlertDialog (android.support.v7.app.AlertDialog)644 EditText (android.widget.EditText)426 ImageView (android.widget.ImageView)308 OnClickListener (android.content.DialogInterface.OnClickListener)285 LayoutInflater (android.view.LayoutInflater)242 SuppressLint (android.annotation.SuppressLint)225 AdapterView (android.widget.AdapterView)220 ListView (android.widget.ListView)220 ArrayList (java.util.ArrayList)213 Dialog (android.app.Dialog)179 Context (android.content.Context)179 File (java.io.File)160 OnClickListener (android.view.View.OnClickListener)157 Bundle (android.os.Bundle)146 Activity (android.app.Activity)143