From a44df1ee8c48e36c9884857bac16f455ff2efb17 Mon Sep 17 00:00:00 2001 From: lijia Date: Fri, 22 Sep 2023 10:41:00 +0800 Subject: [PATCH] =?UTF-8?q?app=E6=9B=B4=E6=96=B0=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=AB=8B=E5=8D=B3=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/alert/UpAppAlert.java | 15 ++++++++++++--- app/src/main/res/layout/alert_up_app.xml | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/alert/UpAppAlert.java b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/alert/UpAppAlert.java index 583ea67..646e1e0 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/alert/UpAppAlert.java +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/alert/UpAppAlert.java @@ -2,6 +2,7 @@ package com.arpa.hndahesudintocctmsdriver.ui.alert; import android.content.Context; import android.util.Log; +import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.LinearLayout; @@ -12,6 +13,8 @@ import androidx.annotation.NonNull; import com.king.app.updater.AppUpdater; import com.king.app.updater.callback.AppUpdateCallback; +import com.king.app.updater.constant.Constants; +import com.king.app.updater.util.AppUtils; import com.lxj.xpopup.core.CenterPopupView; import com.arpa.hndahesudintocctmsdriver.R; @@ -27,8 +30,8 @@ import java.io.File; */ public class UpAppAlert extends CenterPopupView { - private TextView content,vs; - private Button tv_cancel,tv_confirm; + private TextView content,vs,tvContent; + private Button tv_cancel,tv_confirm,tvOk; private LinearLayout up_div; private String url=""; private String body=""; @@ -63,6 +66,8 @@ public class UpAppAlert extends CenterPopupView { content=findViewById(R.id.tv_content); tv_cancel=findViewById(R.id.tv_cancel); tv_confirm=findViewById(R.id.tv_confirm); + tvContent=findViewById(R.id.tvContent); + tvOk=findViewById(R.id.tvOk); up_div=findViewById(R.id.up_div); progress_view=findViewById(R.id.progress); content=findViewById(R.id.tv_content); @@ -109,7 +114,11 @@ public class UpAppAlert extends CenterPopupView { @Override public void onFinish(File file) { - + tvContent.setText("下载完成,请及时安装!"); + tvOk.setVisibility(VISIBLE); + tvOk.setOnClickListener(v1 -> { + AppUtils.installApk(getContext(),file,getContext().getPackageName() + Constants.DEFAULT_FILE_PROVIDER); + }); } }) .start(); diff --git a/app/src/main/res/layout/alert_up_app.xml b/app/src/main/res/layout/alert_up_app.xml index afbb208..fe18de5 100644 --- a/app/src/main/res/layout/alert_up_app.xml +++ b/app/src/main/res/layout/alert_up_app.xml @@ -99,6 +99,8 @@ android:textSize="@dimen/sp_17" android:background="@null" android:layout_marginBottom="@dimen/dp_3"/> + + + +