Open zzm123456 opened 5 years ago
库版本:2.2.0 调用代码如下
private void doUpdate() { DownloadBuilder builder = AllenVersionChecker .getInstance() .downloadOnly(crateUIData()); //更新界面选择 builder.setCustomVersionDialogListener(createCustomDialog()); //自定义下载路径 builder.setDownloadAPKPath(Environment.getExternalStorageDirectory() + Constants.CACHE_FILE_NAME); //强制重新下载无论本地是否缓存 builder.setForceRedownload(true); //显示下载通知栏 builder.setShowNotification(true); //显示下载中对话框 builder.setShowDownloadingDialog(false); builder.executeMission(mRootView.getActivity()); } /** * @param * @return com.allenliu.versionchecklib.v2.callback.CustomVersionDialogListener * @Description: 更新对话框 * @Date: 2019/7/4 16:49 */ private CustomVersionDialogListener createCustomDialog() { return new CustomVersionDialogListener() { @Override public Dialog getCustomVersionDialog(Context context, UIData versionBundle) { UpdateDialog baseDialog = new UpdateDialog(context, R.style.customDialog, R.layout.dialog_update_layout); TextView textView = baseDialog.findViewById(R.id.tv_msg); textView.setText(versionBundle.getContent()); return baseDialog; } }; } /** * @return * @important 使用请求版本功能,可以在这里设置downloadUrl * 这里可以构造UI需要显示的数据 * UIData 内部是一个Bundle */ private UIData crateUIData() { UIData uiData = UIData.create(); uiData.setTitle("新版本震撼来袭"); uiData.setDownloadUrl("http://test-1251233192.coscd.myqcloud.com/1_1.apk"); uiData.setContent("1.XXXXX\n2.XXXXXX\n3.XXXXX"); return uiData; }
有没有大佬帮忙看下
库版本:2.2.0 调用代码如下