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 @@ ...@@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 安装APK权限,需要在程序中动态申请,并且不同于外部存储读写权限申请 --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 安装APK权限,需要在程序中动态申请,并且不同于外部存储读写权限申请 -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application <application
android:name=".uis.MyApplication" android:name=".uis.MyApplication"
android:allowBackup="true" android:allowBackup="true"
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
<meta-data <meta-data
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="540" /> <!-- fileprovider名称在安装时传递给系统安装程序 --> android:value="540" /> <!-- fileprovider名称在安装时传递给系统安装程序 -->
<provider <!--<provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider" android:authorities="${applicationId}.fileProvider"
android:exported="false" android:exported="false"
...@@ -37,8 +38,18 @@ ...@@ -37,8 +38,18 @@
<meta-data <meta-data
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/autoupdate" /> 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> </provider>
<activity <activity
android:name=".uis.MainActivity" android:name=".uis.MainActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
......
...@@ -18,6 +18,7 @@ public class OkhttpInterruptDownImpl extends BaseDownloadImpl{ ...@@ -18,6 +18,7 @@ public class OkhttpInterruptDownImpl extends BaseDownloadImpl{
private FileOutputStream fos; private FileOutputStream fos;
private InputStream inputStream; private InputStream inputStream;
private Call call; private Call call;
private String TAG = "OkhttpInterruptDownImpl";
public static OkhttpInterruptDownImpl getInstance(){ public static OkhttpInterruptDownImpl getInstance(){
if (down == null) { if (down == null) {
......
...@@ -97,6 +97,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener, ...@@ -97,6 +97,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
private HashMap<Integer, Integer> groupEnterHashMap=null; private HashMap<Integer, Integer> groupEnterHashMap=null;
private HashMap<Integer, Integer> groupLeaveHashMap=null; private HashMap<Integer, Integer> groupLeaveHashMap=null;
private HashMap<Integer,Integer> groupPresentHashMap=null; private HashMap<Integer,Integer> groupPresentHashMap=null;
private boolean isPermission;
@Override @Override
...@@ -139,7 +140,8 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener, ...@@ -139,7 +140,8 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
updateTime(); updateTime();
initGroup(); initGroup();
initPeopleList(); initPeopleList();
mLoadDialog = LoadDialog.getInstance(this); //mLoadDialog = LoadDialog.getInstance(this);
mLoadDialog = new LoadDialog(this);
//Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this)); //Log.i(TAG, "initView: deviceSn="+deviceSn+"V"+ Utils.getVersionName(this));
mBinding.tvDeviceDesc.setText(DEVICE_TYPE+" "+deviceSn+" V"+ Utils.getVersionName(this)); mBinding.tvDeviceDesc.setText(DEVICE_TYPE+" "+deviceSn+" V"+ Utils.getVersionName(this));
//getResp(); //getResp();
...@@ -202,7 +204,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener, ...@@ -202,7 +204,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
} }
private void checkAllPermission() { private void checkAllPermission() {
boolean isPermission = PermissionUtil.checkMultiPermission(this, new String[]{ isPermission = PermissionUtil.checkMultiPermission(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET Manifest.permission.INTERNET
...@@ -301,7 +303,9 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener, ...@@ -301,7 +303,9 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
runOnUiThread(()->{ runOnUiThread(()->{
//Log.i(TAG, "onProgress: progress="+progress); //Log.i(TAG, "onProgress: progress="+progress);
String desc = "下载更新中..."+progress; String desc = "下载更新中..."+progress;
if (mLoadDialog != null) {
mLoadDialog.setContent(desc); mLoadDialog.setContent(desc);
}
}); });
} }
...@@ -310,16 +314,26 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener, ...@@ -310,16 +314,26 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
if (downStatus == DOWN_START){ if (downStatus == DOWN_START){
runOnUiThread(()->{ runOnUiThread(()->{
String desc = "准备下载更新"; String desc = "准备下载更新";
if (mLoadDialog != null) {
mLoadDialog.setContent(desc); mLoadDialog.setContent(desc);
mLoadDialog.show(); mLoadDialog.show();
}
}); });
} else if (downStatus== DOWN_FINISH){ } else if (downStatus== DOWN_FINISH){
//安装更新 //安装更新
//Log.i(TAG, "onResult:进来多少次");
runOnUiThread(()->{ runOnUiThread(()->{
if (mLoadDialog != null) {
mLoadDialog.dismiss(); mLoadDialog.dismiss();
showTips("更新版本,请进行安装"); }
showTips("更新版本,将进行安装");
boolean restricted = Utils.isRootPermissionRestricted();
if (!restricted){
Utils.clientInstall(installPath,MainActivity.this);
}else{
Utils.installApp(getApplicationContext(),new File(installPath)); Utils.installApp(getApplicationContext(),new File(installPath));
}
}); });
...@@ -489,7 +503,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener, ...@@ -489,7 +503,7 @@ public class MainActivity extends BaseActivity implements OnTimeUpdateListener,
@Override @Override
public void onQueryStatus(String desc, boolean status) { public void onQueryStatus(String desc, boolean status) {
runOnUiThread(()->{ runOnUiThread(()->{
if (status==false){ if (!status){
showTips(desc); showTips(desc);
} }
}); });
......
...@@ -27,14 +27,14 @@ public class LoadDialog extends Dialog { ...@@ -27,14 +27,14 @@ public class LoadDialog extends Dialog {
initWindow(); initWindow();
} }
public static LoadDialog getInstance(Context context){ /*public static LoadDialog getInstance(Context context){
if (loadDialog == null) { if (loadDialog == null) {
synchronized (LoadDialog.class){ synchronized (LoadDialog.class){
loadDialog = new LoadDialog(context); loadDialog = new LoadDialog(context);
} }
} }
return loadDialog; return loadDialog;
} }*/
private void initWindow() { private void initWindow() {
Window window = getWindow(); Window window = getWindow();
...@@ -47,15 +47,10 @@ public class LoadDialog extends Dialog { ...@@ -47,15 +47,10 @@ public class LoadDialog extends Dialog {
setCanceledOnTouchOutside(false); setCanceledOnTouchOutside(false);
} }
/*public void showDialog(){
show();
}
public void closeDialog(){
dismiss();
}*/
public void setContent(String content){ public void setContent(String content){
binding.tvLoadInfo.setText(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