app更新优化,添加立即安装按钮
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user