Commit 9dbc275a authored by chenyuling's avatar chenyuling

修改弹窗

parent a9b5d040
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 安装APK权限,需要在程序中动态申请,并且不同于外部存储读写权限申请 -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:name=".uis.MyApplication"
android:allowBackup="true"
......@@ -29,7 +30,7 @@
<meta-data
android:name="design_height_in_dp"
android:value="540" /> <!-- fileprovider名称在安装时传递给系统安装程序 -->
<provider
<!--<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
......@@ -37,8 +38,18 @@
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/autoupdate" />
</provider>-->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<activity
android:name=".uis.MainActivity"
android:configChanges="keyboardHidden|orientation"
......
......@@ -18,6 +18,7 @@ public class OkhttpInterruptDownImpl extends BaseDownloadImpl{
private FileOutputStream fos;
private InputStream inputStream;
private Call call;
private String TAG = "OkhttpInterruptDownImpl";
public static OkhttpInterruptDownImpl getInstance(){
if (down == null) {
......
......@@ -97,6 +97,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
private HashMap<Integer, Integer> groupEnterHashMap=null;
private HashMap<Integer, Integer> groupLeaveHashMap=null;
private HashMap<Integer,Integer> groupPresentHashMap=null;
private boolean isPermission;
@Override
......@@ -139,7 +140,8 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
updateTime();
initGroup();
initPeopleList();
mLoadDialog = LoadDialog.getInstance(this);
//mLoadDialog = LoadDialog.getInstance(this);
mLoadDialog = new LoadDialog(this);
//Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this));
mBinding.tvDeviceDesc.setText(DEVICE_TYPE+" "+deviceSn+" V"+ Utils.getVersionName(this));
//getResp();
......@@ -202,7 +204,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
}
private void checkAllPermission() {
boolean isPermission = PermissionUtil.checkMultiPermission(this, new String[]{
isPermission = PermissionUtil.checkMultiPermission(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET
......@@ -301,7 +303,9 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
runOnUiThread(()->{
//Log.i(TAG, "onProgress: progress="+progress);
String desc = "下载更新中..."+progress;
mLoadDialog.setContent(desc);
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
}
});
}
......@@ -310,16 +314,26 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
if (downStatus == DOWN_START){
runOnUiThread(()->{
String desc = "准备下载更新";
mLoadDialog.setContent(desc);
mLoadDialog.show();
if (mLoadDialog != null) {
mLoadDialog.setContent(desc);
mLoadDialog.show();
}
});
} else if (downStatus== DOWN_FINISH){
//安装更新
//Log.i(TAG, "onResult:进来多少次");
runOnUiThread(()->{
mLoadDialog.dismiss();
showTips("更新版本,请进行安装");
Utils.installApp(getApplicationContext(),new File(installPath));
if (mLoadDialog != null) {
mLoadDialog.dismiss();
}
showTips("更新版本,将进行安装");
boolean restricted = Utils.isRootPermissionRestricted();
if (!restricted){
Utils.clientInstall(installPath,MainActivity.this);
}else{
Utils.installApp(getApplicationContext(),new File(installPath));
}
});
......@@ -489,7 +503,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
@Override
public void onQueryStatus(String desc, boolean status) {
runOnUiThread(()->{
if (status==false){
if (!status){
showTips(desc);
}
});
......
......@@ -27,14 +27,14 @@ public class LoadDialog extends Dialog {
initWindow();
}
public static LoadDialog getInstance(Context context){
/*public static LoadDialog getInstance(Context context){
if (loadDialog == null) {
synchronized (LoadDialog.class){
loadDialog = new LoadDialog(context);
}
}
return loadDialog;
}
}*/
private void initWindow() {
Window window = getWindow();
......@@ -47,15 +47,10 @@ public class LoadDialog extends Dialog {
setCanceledOnTouchOutside(false);
}
/*public void showDialog(){
show();
}
public void closeDialog(){
dismiss();
}*/
public void setContent(String content){
binding.tvLoadInfo.setText(content);
}
}
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="." />
</paths>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment