version:1.0.5
fix: update:资源替换,跳转优化
This commit is contained in:
@@ -653,7 +653,7 @@ public class OpenApkUtils {
|
||||
*
|
||||
* @param paramStr 参数字符串(格式:包名,类名,extra参数,第四项,第五项)
|
||||
*/
|
||||
public void openJxwApp(Activity context, String paramStr) {
|
||||
public void openJxwApp(Activity activity, String paramStr) {
|
||||
if (TextUtils.isEmpty(paramStr)) {
|
||||
Log.e(TAG, "context为空或参数字符串为空");
|
||||
return;
|
||||
@@ -677,7 +677,7 @@ public class OpenApkUtils {
|
||||
+ "\n第四项:" + fourthParam + "\n应用名:" + appName);
|
||||
|
||||
if (!ApkUtils.isAvailable(mContext, packageName)) {
|
||||
showDownloadDialog(context, packageName, appName);
|
||||
showDownloadDialog(activity, packageName, appName);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -711,10 +711,11 @@ public class OpenApkUtils {
|
||||
|
||||
// 4. 启动Activity(处理异常)
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof android.content.ActivityNotFoundException) {
|
||||
Log.e(TAG, "未找到目标Activity:" + packageName + "/" + className);
|
||||
Toaster.show("打开失败,请升级应用到最新版本");
|
||||
} else if (e instanceof SecurityException) {
|
||||
Log.e(TAG, "启动Activity权限不足");
|
||||
} else {
|
||||
@@ -773,7 +774,7 @@ public class OpenApkUtils {
|
||||
public void showDownloadDialog(Activity context, String pkg, String appName) {
|
||||
Dialog dialog = new Dialog(context, R.style.ActionSheet);
|
||||
Window window = dialog.getWindow();
|
||||
View inflate = ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.download_dialog, (ViewGroup) null);
|
||||
View inflate = ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.download_dialog, null);
|
||||
TextView textView = inflate.findViewById(R.id.download_cancel);
|
||||
TextView textView2 = inflate.findViewById(R.id.tag_title);
|
||||
if (!TextUtils.isEmpty(appName)) {
|
||||
|
||||
Reference in New Issue
Block a user