Android Open Source - CommonLibs Dialog Utils






From Project

Back to project page CommonLibs.

License

The source code is released under:

Apache License

If you think the Android project CommonLibs listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.alex.common.utils;
// w ww.ja v a2  s  .co  m
import com.alex.common.R;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;

/**
 * ?????Dialog?????
 * @author caisenchuan
 */
public class DialogUtils {
    /*--------------------------
     * ???
     *-------------------------*/

    /*--------------------------
     * ?????
     *-------------------------*/

    /*--------------------------
     * ????????
     *-------------------------*/

    /*--------------------------
     * public??
     *-------------------------*/
    /**
     * ???????????????
     * @param context ???
     * @param title ??????
     */
    public static void showOKButtonDialog(Context context, String title) {
        showOKButtonDialog(context, title, null);
    }
    
    /**
     * ???????????????
     * @param context ???
     * @param title ??????
     * @param ok_listener ????????????
     * @author lenovo
     */
    public static void showOKButtonDialog(Context context, String title, AlertDialog.OnClickListener ok_listener) {
        AlertDialog dlg = new AlertDialog.Builder(context).create();
        dlg.setTitle(title);
        dlg.setButton(Dialog.BUTTON_NEGATIVE, context.getString(R.string.ok), ok_listener);
        dlg.show();
    }
    
    /**
     * ????????????????????
     * @param context ???
     * @param title ??????
     * @param ok_listener ????????????
     * @author lenovo
     */
    public static void showOKCancelButtonDialog(Context context, String title, AlertDialog.OnClickListener ok_listener) {
        AlertDialog dlg = new AlertDialog.Builder(context).create();
        dlg.setTitle(title);
        dlg.setButton(Dialog.BUTTON_NEGATIVE, context.getString(R.string.ok), ok_listener);
        dlg.setButton(Dialog.BUTTON_POSITIVE, context.getString(R.string.cancel), new AlertDialog.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                //...
            }
        });
        dlg.show();
    }
    
    /**
     * ???????????????????
     * @param context
     * @param title
     * @return
     */
    public static Dialog buildSpinnerProgressDialog(Context context, String title) {
        ProgressDialog dialog = new ProgressDialog(context);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setMessage(title);
        dialog.setIndeterminate(false);
        dialog.setCancelable(false);
        return dialog;
    }
    
    /*--------------------------
     * protected??packet??
     *-------------------------*/

    /*--------------------------
     * private??
     *-------------------------*/

}




Java Source Code List

com.alex.common.AppConfig.java
com.alex.common.AppControl.java
com.alex.common.Err.java
com.alex.common.OnHttpRequestReturnListener.java
com.alex.common.activities.BaseActivity.java
com.alex.common.activities.ImageLoadActivity.java
com.alex.common.activities.WebViewActivity.java
com.alex.common.apis.HttpApi.java
com.alex.common.exception.RetErrorException.java
com.alex.common.utils.BackgroundHandler.java
com.alex.common.utils.BaiduMapUtils.java
com.alex.common.utils.DateTimeUtils.java
com.alex.common.utils.DeviceUtils.java
com.alex.common.utils.DialogUtils.java
com.alex.common.utils.FileUtils.java
com.alex.common.utils.ImageUtils.java
com.alex.common.utils.KLog.java
com.alex.common.utils.Misc.java
com.alex.common.utils.NetworkUtils.java
com.alex.common.utils.PrefUtils.java
com.alex.common.utils.ShareUtils.java
com.alex.common.utils.StringUtils.java
com.alex.common.utils.ThreadUtils.java
com.alex.common.utils.ToastUtils.java
com.alex.common.views.ZoomImageView.java