升级优化
This commit is contained in:
parent
c3a3a5cfe6
commit
35c37fdf51
@ -1,6 +1,9 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.ui.alert;
|
package com.arpa.hndahesudintocctmsdriver.ui.alert;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@ -30,11 +33,11 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
public class UpAppAlert extends CenterPopupView {
|
public class UpAppAlert extends CenterPopupView {
|
||||||
|
|
||||||
private TextView content,vs,tvContent;
|
private TextView content, vs, tvContent;
|
||||||
private Button tv_cancel,tv_confirm,tvOk;
|
private Button tv_cancel, tv_confirm, tvOk;
|
||||||
private LinearLayout up_div;
|
private LinearLayout up_div;
|
||||||
private String url="";
|
private String url = "";
|
||||||
private String body="";
|
private String body = "";
|
||||||
private Context con;
|
private Context con;
|
||||||
private ProgressBar progress_view;
|
private ProgressBar progress_view;
|
||||||
private String version;
|
private String version;
|
||||||
@ -42,19 +45,20 @@ public class UpAppAlert extends CenterPopupView {
|
|||||||
private LinearLayout force_box;
|
private LinearLayout force_box;
|
||||||
private ImageButton force_btn;
|
private ImageButton force_btn;
|
||||||
|
|
||||||
public UpAppAlert(@NonNull @NotNull Context context, String url, String body,String version,String force) {
|
public UpAppAlert(@NonNull @NotNull Context context, String url, String body, String version, String force) {
|
||||||
super(context);
|
super(context);
|
||||||
con=context;
|
con = context;
|
||||||
this.url=url;
|
this.url = url;
|
||||||
this.body=body;
|
this.body = body;
|
||||||
this.version=version;
|
this.version = version;
|
||||||
this.force=force;
|
this.force = force;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getImplLayoutId() {
|
protected int getImplLayoutId() {
|
||||||
return R.layout.alert_up_app;
|
return R.layout.alert_up_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpAppAlert(@NonNull @NotNull Context context) {
|
public UpAppAlert(@NonNull @NotNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
@ -63,17 +67,17 @@ public class UpAppAlert extends CenterPopupView {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate() {
|
protected void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
content=findViewById(R.id.tv_content);
|
content = findViewById(R.id.tv_content);
|
||||||
tv_cancel=findViewById(R.id.tv_cancel);
|
tv_cancel = findViewById(R.id.tv_cancel);
|
||||||
tv_confirm=findViewById(R.id.tv_confirm);
|
tv_confirm = findViewById(R.id.tv_confirm);
|
||||||
tvContent=findViewById(R.id.tvContent);
|
tvContent = findViewById(R.id.tvContent);
|
||||||
tvOk=findViewById(R.id.tvOk);
|
tvOk = findViewById(R.id.tvOk);
|
||||||
up_div=findViewById(R.id.up_div);
|
up_div = findViewById(R.id.up_div);
|
||||||
progress_view=findViewById(R.id.progress);
|
progress_view = findViewById(R.id.progress);
|
||||||
content=findViewById(R.id.tv_content);
|
content = findViewById(R.id.tv_content);
|
||||||
force_box=findViewById(R.id.force_box);
|
force_box = findViewById(R.id.force_box);
|
||||||
force_btn=findViewById(R.id.force_btn);
|
force_btn = findViewById(R.id.force_btn);
|
||||||
if(force.equals("1")){
|
if (force.equals("1")) {
|
||||||
force_box.setVisibility(GONE);
|
force_box.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
force_btn.setOnClickListener(v -> {
|
force_btn.setOnClickListener(v -> {
|
||||||
@ -81,16 +85,16 @@ public class UpAppAlert extends CenterPopupView {
|
|||||||
dismiss();
|
dismiss();
|
||||||
//detachFromHost();
|
//detachFromHost();
|
||||||
});
|
});
|
||||||
vs=findViewById(R.id.vs);
|
vs = findViewById(R.id.vs);
|
||||||
content.setText(body);
|
content.setText(body);
|
||||||
vs.setText(version);
|
vs.setText(version);
|
||||||
tv_cancel.setOnClickListener(v -> {
|
tv_cancel.setOnClickListener(v -> {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
});
|
});
|
||||||
tv_confirm.setOnClickListener(v -> {
|
tv_confirm.setOnClickListener(v -> {
|
||||||
new AppUpdater.Builder()
|
new AppUpdater.Builder(con)
|
||||||
.setUrl(url)
|
.setUrl(url)
|
||||||
.build(con)
|
.build()
|
||||||
.setUpdateCallback(new AppUpdateCallback() {
|
.setUpdateCallback(new AppUpdateCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onStart(String url) {
|
public void onStart(String url) {
|
||||||
@ -98,17 +102,18 @@ public class UpAppAlert extends CenterPopupView {
|
|||||||
tv_confirm.setVisibility(GONE);
|
tv_confirm.setVisibility(GONE);
|
||||||
up_div.setVisibility(VISIBLE);
|
up_div.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(long progress, long total, boolean isChange) {
|
public void onProgress(long progress, long total, boolean isChange) {
|
||||||
// Log.e("progress",progress+"");
|
// Log.e("progress",progress+"");
|
||||||
// Log.e("total",total+"");
|
// Log.e("total",total+"");
|
||||||
// Log.e("isChange",isChange+"");
|
// Log.e("isChange",isChange+"");
|
||||||
float sum=progress;
|
float sum = progress;
|
||||||
float max=total;
|
float max = total;
|
||||||
if(progress>0){
|
if (progress > 0) {
|
||||||
float b=sum/max;
|
float b = sum / max;
|
||||||
Log.e("百分比",(100*b)+"");
|
Log.e("百分比", (100 * b) + "");
|
||||||
progress_view.setProgress((int) (100*b));
|
progress_view.setProgress((int) (100 * b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +122,7 @@ public class UpAppAlert extends CenterPopupView {
|
|||||||
tvContent.setText("下载完成,请及时安装!");
|
tvContent.setText("下载完成,请及时安装!");
|
||||||
tvOk.setVisibility(VISIBLE);
|
tvOk.setVisibility(VISIBLE);
|
||||||
tvOk.setOnClickListener(v1 -> {
|
tvOk.setOnClickListener(v1 -> {
|
||||||
AppUtils.installApk(getContext(),file,getContext().getPackageName() + Constants.DEFAULT_FILE_PROVIDER);
|
AppUtils.installApk(getContext(), file, getContext().getPackageName() + Constants.DEFAULT_FILE_PROVIDER);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -7,7 +7,6 @@ import android.graphics.Outline;
|
|||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -146,10 +145,10 @@ public class HomeFragment extends BaseFragment {
|
|||||||
MsgUtil.addHdMsgWat(hd, 33);
|
MsgUtil.addHdMsgWat(hd, 33);
|
||||||
|
|
||||||
//新用户注册,需弹窗提示注册
|
//新用户注册,需弹窗提示注册
|
||||||
if ("0".equals(ub.getData().getRealAuthentication())){
|
if ("0".equals(ub.getData().getRealAuthentication())) {
|
||||||
new MessageUtils().showSimCenPop(con, "该司机还未认证,未认证无法接单。是否去注册!", () -> {
|
new MessageUtils().showSimCenPop(con, "该司机还未认证,未认证无法接单。是否去注册!", () -> {
|
||||||
Intent in=new Intent(con, CertificatesActivity.class);
|
Intent in = new Intent(con, CertificatesActivity.class);
|
||||||
in.putExtra("index",0);
|
in.putExtra("index", 0);
|
||||||
startActivity(in);
|
startActivity(in);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -545,7 +544,6 @@ public class HomeFragment extends BaseFragment {
|
|||||||
ur.getImage(1);
|
ur.getImage(1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (UiAuxiliary.isLogin(con)) {
|
if (UiAuxiliary.isLogin(con)) {
|
||||||
ur.User();
|
ur.User();
|
||||||
ur.getDriverExpire();
|
ur.getDriverExpire();
|
||||||
|
Loading…
Reference in New Issue
Block a user