AlexLiuSheng / CheckVersionLib

版本检测升级(更新)库。an auto check version library(app update) on Android
https://github.com/AlexLiuSheng/CheckVersionLib
2.68k stars 486 forks source link

内存泄漏问题 #262

Open zzm123456 opened 5 years ago

zzm123456 commented 5 years ago

库版本:2.2.0 调用代码如下 df44ec9dfa09adfa77b768e89ceb5cd

    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;
}
zzm123456 commented 5 years ago

有没有大佬帮忙看下