diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 308ad7c..bd06ac1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,10 +32,15 @@ - - + + + android:value="4dff60bf3e49c9e25e7272f5a8b3e4fc" /> diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 308ad7c..bd06ac1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,10 +32,15 @@ - - + + + android:value="4dff60bf3e49c9e25e7272f5a8b3e4fc" /> diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 6a75200..7188b2a 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -1,27 +1,11 @@ package com.casic.dcms.utils; -import android.Manifest; - import com.casic.dcms.R; import java.util.Arrays; import java.util.List; public class LocaleConstant { - public static final String[] USER_PERMISSIONS = { - Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS, - Manifest.permission.ACCESS_COARSE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION, - Manifest.permission.READ_PHONE_STATE, - Manifest.permission.RECORD_AUDIO, - Manifest.permission.CALL_PHONE, - Manifest.permission.CAMERA, - Manifest.permission.READ_MEDIA_IMAGES, - Manifest.permission.READ_MEDIA_VIDEO, - Manifest.permission.MANAGE_EXTERNAL_STORAGE, - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE - }; public static final String[] CASE_PAGE_TITLES = {"待办案卷", "已办案卷"}; public static final String[] DEPT_PAGE_TITLES = {"待办案卷", "待处理", "部门调整批示", "二级缓办待处理", "部门授权审核", "二级延期待处理", "已办案卷"}; public static final String[] SPINNER_ITEMS = {"请选择", "已处理", "无需处理"}; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 308ad7c..bd06ac1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,10 +32,15 @@ - - + + + android:value="4dff60bf3e49c9e25e7272f5a8b3e4fc" /> diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 6a75200..7188b2a 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -1,27 +1,11 @@ package com.casic.dcms.utils; -import android.Manifest; - import com.casic.dcms.R; import java.util.Arrays; import java.util.List; public class LocaleConstant { - public static final String[] USER_PERMISSIONS = { - Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS, - Manifest.permission.ACCESS_COARSE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION, - Manifest.permission.READ_PHONE_STATE, - Manifest.permission.RECORD_AUDIO, - Manifest.permission.CALL_PHONE, - Manifest.permission.CAMERA, - Manifest.permission.READ_MEDIA_IMAGES, - Manifest.permission.READ_MEDIA_VIDEO, - Manifest.permission.MANAGE_EXTERNAL_STORAGE, - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE - }; public static final String[] CASE_PAGE_TITLES = {"待办案卷", "已办案卷"}; public static final String[] DEPT_PAGE_TITLES = {"待办案卷", "待处理", "部门调整批示", "二级缓办待处理", "部门授权审核", "二级延期待处理", "已办案卷"}; public static final String[] SPINNER_ITEMS = {"请选择", "已处理", "无需处理"}; diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 3a450f6..50936f1 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -19,13 +19,13 @@ private static final String TAG = "RetrofitServiceManager"; private static final RetrofitService api = RetrofitFactory.createRetrofit( - (String) SaveKeyValues.getValue(LocaleConstant.IP_KEY, "http://111.198.10.15:11414"), + (String) SaveKeyValues.getValue(LocaleConstant.IP_KEY, "http://111.198.10.15:11409"), RetrofitService.class ); - private static final RetrofitService shopApi = RetrofitFactory.createRetrofit( - "http://111.198.10.15:11409", RetrofitService.class - ); +// private static final RetrofitService shopApi = RetrofitFactory.createRetrofit( +// "http://111.198.10.15:11409", RetrofitService.class +// ); /** * 验证PublicKey @@ -179,14 +179,14 @@ * 商铺处罚类型统计 */ public static Observable getPunishTypeStatistic(String begTime, String endTime) { - return shopApi.getPunishType(AuthenticationHelper.getToken(), begTime, endTime); + return api.getPunishType(AuthenticationHelper.getToken(), begTime, endTime); } /** * 商铺处罚排行榜 */ public static Observable getPunishRanking(String begTime, String endTime) { - return shopApi.getPunishRanking(AuthenticationHelper.getToken(), begTime, endTime); + return api.getPunishRanking(AuthenticationHelper.getToken(), begTime, endTime); } /** @@ -570,7 +570,7 @@ * 根据养护类型获取养护内容 */ public static Observable getMaintainContentResult(String type) { - return shopApi.obtainMaintainContent(AuthenticationHelper.getToken(), type); + return api.obtainMaintainContent(AuthenticationHelper.getToken(), type); } /** @@ -579,7 +579,7 @@ public static Observable getAddMaintainRecordResult( String bridgeId, String content, String maintainTime, String personId, String longitude, String latitude, String description ) { - return shopApi.addMaintainRecord( + return api.addMaintainRecord( AuthenticationHelper.getToken(), bridgeId, content, maintainTime, personId, longitude, latitude, description); } @@ -587,21 +587,21 @@ * 桥梁养护记录 */ public static Observable getMaintainRecordResult(String startDate, String endDate, int offset) { - return shopApi.obtainMaintainRecord(AuthenticationHelper.getToken(), startDate, endDate, LocaleConstant.PAGE_LIMIT, offset); + return api.obtainMaintainRecord(AuthenticationHelper.getToken(), startDate, endDate, LocaleConstant.PAGE_LIMIT, offset); } /** * 路灯分页列表 */ public static Observable getLightListResult(int limit, int offset) { - return shopApi.obtainLightList(AuthenticationHelper.getToken(), limit, offset); + return api.obtainLightList(AuthenticationHelper.getToken(), limit, offset); } /** * 全部路灯 */ public static Observable getLightListResult() { - return shopApi.obtainLightList(AuthenticationHelper.getToken()); + return api.obtainLightList(AuthenticationHelper.getToken()); } /** @@ -609,42 +609,42 @@ * 因为返回的数据会出现结构不一致的问题,不能用实体类接收改为ResponseBody接收,然后在手动解析 */ public static Observable getLightDetailResult(String lampId) { - return shopApi.obtainLightDetail(AuthenticationHelper.getToken(), lampId); + return api.obtainLightDetail(AuthenticationHelper.getToken(), lampId); } /** * 控制路灯开关 */ public static Observable getLightControlResult(List lampIds, String controlType) { - return shopApi.controlStreetLight(AuthenticationHelper.getToken(), lampIds, controlType); + return api.controlStreetLight(AuthenticationHelper.getToken(), lampIds, controlType); } /** * 报警列表 */ public static Observable getAlarmListResult(int limit, int offset) { - return shopApi.obtainAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); + return api.obtainAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } /** * 单个取消报警 */ public static Observable getCancelAlarmResult(String id, String jobStatus, String handleMessage) { - return shopApi.cancelAlarm(AuthenticationHelper.getToken(), id, jobStatus, handleMessage); + return api.cancelAlarm(AuthenticationHelper.getToken(), id, jobStatus, handleMessage); } /** * 一键取消报警 */ public static Observable getCancelAlarmResult(String jobStatus, String handleMessage) { - return shopApi.cancelAlarm(AuthenticationHelper.getToken(), jobStatus, handleMessage); + return api.cancelAlarm(AuthenticationHelper.getToken(), jobStatus, handleMessage); } /** * 窨井列表 */ public static Observable getWellListResult(int offset) { - return shopApi.obtainWellList( + return api.obtainWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); } @@ -653,14 +653,14 @@ * 单个撤防/布防 */ public static Observable getSingleOptionWellResult(String wellId, String bfzt) { - return shopApi.optionWellStatus(AuthenticationHelper.getToken(), wellId, bfzt); + return api.optionWellStatus(AuthenticationHelper.getToken(), wellId, bfzt); } /** * 一键撤防/布防 */ public static Observable getBatchOptionWellResult(String bfzt) { - return shopApi.optionWellStatus(AuthenticationHelper.getToken(), bfzt); + return api.optionWellStatus(AuthenticationHelper.getToken(), bfzt); } /** @@ -674,7 +674,7 @@ // .client(createOKHttpClient())//log拦截器 // .build(); // RetrofitService service = retrofit.create(RetrofitService.class); - return shopApi.obtainWellDetail( + return api.obtainWellDetail( "json", "4326", "4326", "*", true, where ); } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 308ad7c..bd06ac1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,10 +32,15 @@ - - + + + android:value="4dff60bf3e49c9e25e7272f5a8b3e4fc" /> diff --git a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java index 6a75200..7188b2a 100644 --- a/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java +++ b/app/src/main/java/com/casic/dcms/utils/LocaleConstant.java @@ -1,27 +1,11 @@ package com.casic.dcms.utils; -import android.Manifest; - import com.casic.dcms.R; import java.util.Arrays; import java.util.List; public class LocaleConstant { - public static final String[] USER_PERMISSIONS = { - Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS, - Manifest.permission.ACCESS_COARSE_LOCATION, - Manifest.permission.ACCESS_FINE_LOCATION, - Manifest.permission.READ_PHONE_STATE, - Manifest.permission.RECORD_AUDIO, - Manifest.permission.CALL_PHONE, - Manifest.permission.CAMERA, - Manifest.permission.READ_MEDIA_IMAGES, - Manifest.permission.READ_MEDIA_VIDEO, - Manifest.permission.MANAGE_EXTERNAL_STORAGE, - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE - }; public static final String[] CASE_PAGE_TITLES = {"待办案卷", "已办案卷"}; public static final String[] DEPT_PAGE_TITLES = {"待办案卷", "待处理", "部门调整批示", "二级缓办待处理", "部门授权审核", "二级延期待处理", "已办案卷"}; public static final String[] SPINNER_ITEMS = {"请选择", "已处理", "无需处理"}; diff --git a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java index 3a450f6..50936f1 100644 --- a/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java +++ b/app/src/main/java/com/casic/dcms/utils/retrofit/RetrofitServiceManager.java @@ -19,13 +19,13 @@ private static final String TAG = "RetrofitServiceManager"; private static final RetrofitService api = RetrofitFactory.createRetrofit( - (String) SaveKeyValues.getValue(LocaleConstant.IP_KEY, "http://111.198.10.15:11414"), + (String) SaveKeyValues.getValue(LocaleConstant.IP_KEY, "http://111.198.10.15:11409"), RetrofitService.class ); - private static final RetrofitService shopApi = RetrofitFactory.createRetrofit( - "http://111.198.10.15:11409", RetrofitService.class - ); +// private static final RetrofitService shopApi = RetrofitFactory.createRetrofit( +// "http://111.198.10.15:11409", RetrofitService.class +// ); /** * 验证PublicKey @@ -179,14 +179,14 @@ * 商铺处罚类型统计 */ public static Observable getPunishTypeStatistic(String begTime, String endTime) { - return shopApi.getPunishType(AuthenticationHelper.getToken(), begTime, endTime); + return api.getPunishType(AuthenticationHelper.getToken(), begTime, endTime); } /** * 商铺处罚排行榜 */ public static Observable getPunishRanking(String begTime, String endTime) { - return shopApi.getPunishRanking(AuthenticationHelper.getToken(), begTime, endTime); + return api.getPunishRanking(AuthenticationHelper.getToken(), begTime, endTime); } /** @@ -570,7 +570,7 @@ * 根据养护类型获取养护内容 */ public static Observable getMaintainContentResult(String type) { - return shopApi.obtainMaintainContent(AuthenticationHelper.getToken(), type); + return api.obtainMaintainContent(AuthenticationHelper.getToken(), type); } /** @@ -579,7 +579,7 @@ public static Observable getAddMaintainRecordResult( String bridgeId, String content, String maintainTime, String personId, String longitude, String latitude, String description ) { - return shopApi.addMaintainRecord( + return api.addMaintainRecord( AuthenticationHelper.getToken(), bridgeId, content, maintainTime, personId, longitude, latitude, description); } @@ -587,21 +587,21 @@ * 桥梁养护记录 */ public static Observable getMaintainRecordResult(String startDate, String endDate, int offset) { - return shopApi.obtainMaintainRecord(AuthenticationHelper.getToken(), startDate, endDate, LocaleConstant.PAGE_LIMIT, offset); + return api.obtainMaintainRecord(AuthenticationHelper.getToken(), startDate, endDate, LocaleConstant.PAGE_LIMIT, offset); } /** * 路灯分页列表 */ public static Observable getLightListResult(int limit, int offset) { - return shopApi.obtainLightList(AuthenticationHelper.getToken(), limit, offset); + return api.obtainLightList(AuthenticationHelper.getToken(), limit, offset); } /** * 全部路灯 */ public static Observable getLightListResult() { - return shopApi.obtainLightList(AuthenticationHelper.getToken()); + return api.obtainLightList(AuthenticationHelper.getToken()); } /** @@ -609,42 +609,42 @@ * 因为返回的数据会出现结构不一致的问题,不能用实体类接收改为ResponseBody接收,然后在手动解析 */ public static Observable getLightDetailResult(String lampId) { - return shopApi.obtainLightDetail(AuthenticationHelper.getToken(), lampId); + return api.obtainLightDetail(AuthenticationHelper.getToken(), lampId); } /** * 控制路灯开关 */ public static Observable getLightControlResult(List lampIds, String controlType) { - return shopApi.controlStreetLight(AuthenticationHelper.getToken(), lampIds, controlType); + return api.controlStreetLight(AuthenticationHelper.getToken(), lampIds, controlType); } /** * 报警列表 */ public static Observable getAlarmListResult(int limit, int offset) { - return shopApi.obtainAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); + return api.obtainAlarmList(AuthenticationHelper.getToken(), "1", limit, offset); } /** * 单个取消报警 */ public static Observable getCancelAlarmResult(String id, String jobStatus, String handleMessage) { - return shopApi.cancelAlarm(AuthenticationHelper.getToken(), id, jobStatus, handleMessage); + return api.cancelAlarm(AuthenticationHelper.getToken(), id, jobStatus, handleMessage); } /** * 一键取消报警 */ public static Observable getCancelAlarmResult(String jobStatus, String handleMessage) { - return shopApi.cancelAlarm(AuthenticationHelper.getToken(), jobStatus, handleMessage); + return api.cancelAlarm(AuthenticationHelper.getToken(), jobStatus, handleMessage); } /** * 窨井列表 */ public static Observable getWellListResult(int offset) { - return shopApi.obtainWellList( + return api.obtainWellList( AuthenticationHelper.getToken(), "wellCode", "asc", LocaleConstant.PAGE_LIMIT, offset ); } @@ -653,14 +653,14 @@ * 单个撤防/布防 */ public static Observable getSingleOptionWellResult(String wellId, String bfzt) { - return shopApi.optionWellStatus(AuthenticationHelper.getToken(), wellId, bfzt); + return api.optionWellStatus(AuthenticationHelper.getToken(), wellId, bfzt); } /** * 一键撤防/布防 */ public static Observable getBatchOptionWellResult(String bfzt) { - return shopApi.optionWellStatus(AuthenticationHelper.getToken(), bfzt); + return api.optionWellStatus(AuthenticationHelper.getToken(), bfzt); } /** @@ -674,7 +674,7 @@ // .client(createOKHttpClient())//log拦截器 // .build(); // RetrofitService service = retrofit.create(RetrofitService.class); - return shopApi.obtainWellDetail( + return api.obtainWellDetail( "json", "4326", "4326", "*", true, where ); } diff --git a/app/src/main/java/com/casic/dcms/view/PermissionActivity.java b/app/src/main/java/com/casic/dcms/view/PermissionActivity.java index 77e2aaa..cccec39 100644 --- a/app/src/main/java/com/casic/dcms/view/PermissionActivity.java +++ b/app/src/main/java/com/casic/dcms/view/PermissionActivity.java @@ -1,5 +1,7 @@ package com.casic.dcms.view; +import android.Manifest; +import android.os.Build; import android.view.View; import androidx.annotation.NonNull; @@ -14,6 +16,7 @@ import com.pengxh.androidx.lite.hub.IntHub; import com.pengxh.androidx.lite.utils.ImmerseStatusBarManager; +import java.util.Arrays; import java.util.List; import pub.devrel.easypermissions.EasyPermissions; @@ -21,6 +24,17 @@ public class PermissionActivity extends AndroidxBaseActivity implements PermissionCallbacks { + public List USER_PERMISSIONS = Arrays.asList( + Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS, + Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.READ_PHONE_STATE, + Manifest.permission.RECORD_AUDIO, + Manifest.permission.CALL_PHONE, + Manifest.permission.CAMERA, + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE); + @Override protected void setupTopBarLayout() { ImmerseStatusBarManager.setColor(this, IntHub.convertColor(this, R.color.white)); @@ -34,14 +48,25 @@ @Override protected void initData() { - //判断是否有权限,如果版本大于5.1才需要判断(即6.0以上),其他则不需要判断。 - if (EasyPermissions.hasPermissions(this, LocaleConstant.USER_PERMISSIONS)) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + USER_PERMISSIONS.add(Manifest.permission.READ_MEDIA_IMAGES); + USER_PERMISSIONS.add(Manifest.permission.READ_MEDIA_VIDEO); + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + USER_PERMISSIONS.add(Manifest.permission.MANAGE_EXTERNAL_STORAGE); + } + + String[] permissions = new String[USER_PERMISSIONS.size()]; + for (int i = 0; i < USER_PERMISSIONS.size(); i++) { + permissions[i] = USER_PERMISSIONS.get(i); + } + + if (EasyPermissions.hasPermissions(this, permissions)) { startSplashScreenActivity(); } else { viewBinding.enterMainButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - EasyPermissions.requestPermissions(PermissionActivity.this, "需要获取相关权限", LocaleConstant.PERMISSIONS_CODE, LocaleConstant.USER_PERMISSIONS); + EasyPermissions.requestPermissions(PermissionActivity.this, "需要获取相关权限", LocaleConstant.PERMISSIONS_CODE, permissions); } }); }