• 对话框—系统升级


    public class DialogUtil {
        
        private Context context;
        
        private Handler handler;
        
        public DialogUtil(Context context,Handler handler) {
            this.context = context;
            this.handler = handler;
        }
        
        /**
         * 升级的对话框,提示是否需要升级
         * @param context
         * @param desc
         * @param handler
         */
        public void alertUpdateInfos(String desc){
            
            AlertDialog.Builder dialogBuilder = new Builder(context);
            
            dialogBuilder.setTitle("系统升级");
            
            dialogBuilder.setMessage(desc);
            
            final Message msg = Message.obtain();
            
            msg.what = StaticDatas.IS_DOWNLOAD_NEW_VERSION;
            
            // 添加确定按钮的 监听器
            dialogBuilder.setPositiveButton("立刻升级", new OnClickListener(){
    
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    
                    dialog.dismiss();
                    
                    msg.obj = true;
                    
                    handler.sendMessage(msg);
                }});
            
            // 添加取消按钮的 监听器
            dialogBuilder.setNegativeButton("下次再说", new OnClickListener(){
    
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    
                    msg.obj = false;
                    
                    handler.sendMessage(msg);
                }});
            
            // 添加取消按钮的监听
            dialogBuilder.setOnCancelListener(new OnCancelListener(){
                @Override
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                    
                    msg.what = StaticDatas.DIALOG_DISMISS;
                    
                    handler.sendMessage(msg);
                }});
            
            dialogBuilder.show();
        }
    }
  • 相关阅读:
    pandas笔记
    MongoDB分片集群技术
    MongoDB基本操作
    linux MongoDB安装配置
    MongoDB入门
    introJs用法及在webkit内核浏览器的一个报错
    日常ie兼容问题(持续整理)
    浅谈connect,withRouter,history,useState,useEffect
    node环境配置
    小程序之签到
  • 原文地址:https://www.cnblogs.com/cbooy/p/4740095.html
Copyright © 2020-2023  润新知