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"/> + + + +