Skip to content

Commit

Permalink
发布2.0.6版本
Browse files Browse the repository at this point in the history
  • Loading branch information
xuexiangjys committed Dec 23, 2020
1 parent 86c8f29 commit 10ed791
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ The following is the version description. Choose one.
dependencies {
...
// androidx project
implementation 'com.github.xuexiangjys:XUpdate:2.0.5'
implementation 'com.github.xuexiangjys:XUpdate:2.0.6'
}
```

Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ allprojects {
dependencies {
...
// androidx版本
implementation 'com.github.xuexiangjys:XUpdate:2.0.5'
implementation 'com.github.xuexiangjys:XUpdate:2.0.6'
}
```

Expand Down
5 changes: 3 additions & 2 deletions xupdate-lib/src/main/java/com/xuexiang/xupdate/_XUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.xuexiang.xupdate;

import android.content.Context;

import androidx.annotation.NonNull;

import com.xuexiang.xupdate.entity.DownloadEntity;
Expand Down Expand Up @@ -204,8 +205,8 @@ public static void onUpdateError(int errorCode) {
/**
* 更新出现错误
*
* @param errorCode
* @param message
* @param errorCode 错误码
* @param message 错误信息
*/
public static void onUpdateError(int errorCode, String message) {
onUpdateError(new UpdateError(errorCode, message));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public boolean onInstallApk(@NonNull Context context, @NonNull File apkFile, @No
if (checkApkFile(downloadEntity, apkFile)) {
return installApkFile(context, apkFile);
} else {
_XUpdate.onUpdateError(INSTALL_FAILED, "apk文件校验不通过!");
_XUpdate.onUpdateError(INSTALL_FAILED, "Apk file verify failed, please check whether the MD5 value you set is correct!");
return false;
}
}
Expand All @@ -53,7 +53,7 @@ public boolean onInstallApk(@NonNull Context context, @NonNull File apkFile, @No
*
* @param downloadEntity 下载信息实体
* @param apkFile apk文件
* @return
* @return apk文件是否有效
*/
protected boolean checkApkFile(DownloadEntity downloadEntity, @NonNull File apkFile) {
return downloadEntity != null && downloadEntity.isApkFileValid(apkFile);
Expand All @@ -62,15 +62,15 @@ protected boolean checkApkFile(DownloadEntity downloadEntity, @NonNull File apkF
/**
* 安装apk文件【此处可自定义apk的安装方法,可重写该方法】
*
* @param context
* @param apkFile
* @return
* @param context 上下文
* @param apkFile apk文件
* @return 是否安装成功
*/
protected boolean installApkFile(Context context, File apkFile) {
try {
return ApkInstallUtils.install(context, apkFile);
} catch (IOException e) {
_XUpdate.onUpdateError(INSTALL_FAILED, "获取apk的路径出错!");
_XUpdate.onUpdateError(INSTALL_FAILED, "An error occurred while install apk:" + e.getMessage());
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ private static boolean installNormal(Context context, String filePath) {
/**
* 使用系统的意图进行apk安装
*
* @param context
* @param appFile
* @return
* @param context 上下文
* @param appFile 应用文件
* @return 安装是否成功
*/
private static boolean installNormal(Context context, File appFile) {
try {
Expand All @@ -247,7 +247,7 @@ private static boolean installNormal(Context context, File appFile) {
return true;
}
} catch (Exception e) {
_XUpdate.onUpdateError(INSTALL_FAILED, "使用系统的意图进行apk安装失败!");
_XUpdate.onUpdateError(INSTALL_FAILED, "Apk installation failed using the intent of the system!");
}
return false;
}
Expand All @@ -270,7 +270,7 @@ public static Intent getInstallAppIntent(File appFile) {
intent.setDataAndType(fileUri, "application/vnd.android.package-archive");
return intent;
} catch (Exception e) {
_XUpdate.onUpdateError(INSTALL_FAILED, "获取安装的意图失败!");
_XUpdate.onUpdateError(INSTALL_FAILED, "Failed to get intent for installation!");
}
return null;
}
Expand Down

0 comments on commit 10ed791

Please sign in to comment.