Compare commits
55 Commits
master-non
...
dev_curren
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ffa98c931 | |||
| 8aa88879f2 | |||
| 61d369b97c | |||
| 57f07be916 | |||
| 2a712986d7 | |||
| b1a89e1f05 | |||
| 8c81509ccb | |||
| d565f299ad | |||
| 36a65da786 | |||
| 60bc4a2569 | |||
| 00b8dc27d1 | |||
| 4fe4322f46 | |||
| 2f5c8464b6 | |||
| 559fe05db2 | |||
| 7c22a5ca72 | |||
| c6ae0b54b2 | |||
| d830315c6b | |||
| e592017769 | |||
| 5b21d8c907 | |||
| 10b739c2fb | |||
| 49e428c037 | |||
| b2a03b8d8b | |||
| 98829d9e9e | |||
| 6cf1c3511f | |||
| c6a1737d63 | |||
| 3da460c914 | |||
| 4602d2eb0a | |||
| 7f8c96b238 | |||
| c503bff070 | |||
| 313818c6bf | |||
| e0109151ec | |||
| fcb107eb1b | |||
| 55537c4967 | |||
| b32f3f5d09 | |||
| c15ae82e72 | |||
| 9170934cff | |||
| 8698dbf17f | |||
| f440f09ca4 | |||
| 8706bb1243 | |||
| 1b6024d0cb | |||
| 52cd04a466 | |||
| 7432920fda | |||
| ea4b004637 | |||
| 02215187e7 | |||
| 08a542f5ec | |||
| 292863dcf7 | |||
| 0459d1e87c | |||
| 0fe733d138 | |||
| 258893dc10 | |||
| c925268911 | |||
| dd9144aa32 | |||
| eda74677d4 | |||
| c6ca30eb0f | |||
| 2e00c11735 | |||
| 23522e553f |
10
.idea/jarRepositories.xml
generated
@@ -46,5 +46,15 @@
|
|||||||
<option name="name" value="maven" />
|
<option name="name" value="maven" />
|
||||||
<option name="url" value="https://maven.aliyun.com/repository/apache-snapshots" />
|
<option name="url" value="https://maven.aliyun.com/repository/apache-snapshots" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven4" />
|
||||||
|
<option name="name" value="maven4" />
|
||||||
|
<option name="url" value="https://oss.sonatype.org/content/groups/public" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven5" />
|
||||||
|
<option name="name" value="maven5" />
|
||||||
|
<option name="url" value="https://maven.google.com/" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
@@ -7,10 +10,10 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.navinfo.outdoor"
|
applicationId "com.navinfo.outdoor"
|
||||||
minSdkVersion 22
|
minSdkVersion 23
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 21
|
versionCode 43
|
||||||
versionName "8.220510"
|
versionName "8.230130"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
@@ -37,6 +40,14 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
ndkVersion '21.3.6528147'
|
ndkVersion '21.3.6528147'
|
||||||
|
packagingOptions {
|
||||||
|
pickFirst 'lib/x86/libc++_shared.so'
|
||||||
|
pickFirst 'lib/x86_64/libjsc.so'
|
||||||
|
pickFirst 'lib/arm64-v8a/libjsc.so'
|
||||||
|
pickFirst 'lib/arm64-v8a/libc++_shared.so'
|
||||||
|
pickFirst 'lib/x86_64/libc++_shared.so'
|
||||||
|
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//efs {
|
//efs {
|
||||||
// //是否对启动过程进程插桩的开关,如果使用自动集成监控则必须开启
|
// //是否对启动过程进程插桩的开关,如果使用自动集成监控则必须开启
|
||||||
@@ -62,10 +73,10 @@ dependencies {
|
|||||||
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
||||||
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation files('libs\\jts-1.13.jar')
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
implementation "androidx.lifecycle:lifecycle-common:2.4.1"
|
||||||
//友盟自动检测bug
|
//友盟自动检测bug
|
||||||
implementation 'com.umeng.umsdk:apm:1.2.0'
|
implementation 'com.umeng.umsdk:apm:1.2.0'
|
||||||
//友盟基础库依赖(必须)
|
//友盟基础库依赖(必须)
|
||||||
@@ -82,7 +93,9 @@ dependencies {
|
|||||||
|
|
||||||
//网络框架
|
//网络框架
|
||||||
implementation 'com.lzy.net:okgo:3.0.4'
|
implementation 'com.lzy.net:okgo:3.0.4'
|
||||||
|
implementation 'com.lzy.net:okrx2:2.0.2'
|
||||||
implementation 'com.google.code.gson:gson:2.8.5'
|
implementation 'com.google.code.gson:gson:2.8.5'
|
||||||
|
implementation 'com.readystatesoftware.chuck:library:1.1.0'
|
||||||
|
|
||||||
//retrofit+rxJava
|
//retrofit+rxJava
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
|
||||||
@@ -114,12 +127,16 @@ dependencies {
|
|||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
// 地图库
|
// 地图库
|
||||||
implementation 'com.tencent.map:tencent-map-vector-sdk:4.4.2'
|
implementation 'com.tencent.map:tencent-map-vector-sdk:4.5.10'
|
||||||
// 地图组件库,包括小车平移、点聚合等组件功能,详见开发指南。
|
// // 地图组件库,包括小车平移、点聚合等组件功能,详见开发指南。
|
||||||
implementation 'com.tencent.map:sdk-utilities:1.0.6'
|
// implementation 'com.tencent.map:sdk-utilities:1.0.6'
|
||||||
|
// 导航库
|
||||||
|
implementation ("com.tencent.map:tencent-map-nav-sdk:5.4.2.3")
|
||||||
|
// 导航依赖库
|
||||||
|
implementation ("com.tencent.map:tencent-map-nav-surport:1.1.0.1")
|
||||||
|
|
||||||
//腾讯地图 定位
|
// //腾讯地图 定位
|
||||||
implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.2.6'
|
// implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.4.9'
|
||||||
|
|
||||||
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
||||||
implementation 'com.github.getActivity:XXPermissions:11.6'
|
implementation 'com.github.getActivity:XXPermissions:11.6'
|
||||||
@@ -128,7 +145,8 @@ dependencies {
|
|||||||
def room_version = "2.2.0-alpha01"
|
def room_version = "2.2.0-alpha01"
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
implementation "androidx.room:room-ktx:$room_version"
|
||||||
|
kapt "androidx.room:room-compiler:$room_version"
|
||||||
implementation "androidx.room:room-rxjava2:$room_version"
|
implementation "androidx.room:room-rxjava2:$room_version"
|
||||||
implementation "androidx.room:room-guava:$room_version"
|
implementation "androidx.room:room-guava:$room_version"
|
||||||
testImplementation "androidx.room:room-testing:$room_version"
|
testImplementation "androidx.room:room-testing:$room_version"
|
||||||
@@ -143,5 +161,12 @@ dependencies {
|
|||||||
implementation 'com.github.Hu12037102:ImageCompress:2.3.0'
|
implementation 'com.github.Hu12037102:ImageCompress:2.3.0'
|
||||||
//webp 转换
|
//webp 转换
|
||||||
implementation 'com.wanghong.webpnative:webpnative:0.1.0'
|
implementation 'com.wanghong.webpnative:webpnative:0.1.0'
|
||||||
|
// 自动发送邮件 https://github.com/teprinciple/MailSender
|
||||||
|
implementation 'com.teprinciple:mailsender:1.2.0'
|
||||||
|
// // https://github.com/JiongBull/jlog/blob/master/README_ZH.md 日志记录
|
||||||
|
// implementation 'com.github.JiongBull:jlog:0.1.0'
|
||||||
|
// // https://github.com/JiongBull/jlog-storage-qiniu 自动将日志上传到七牛云
|
||||||
|
// implementation 'com.github.JiongBull:jlog-storage-qiniu:0.1.0'
|
||||||
|
// https://github.com/elvishew/xLog/blob/master/README_ZH.md 日志记录
|
||||||
|
implementation 'com.elvishew:xlog:1.10.1'
|
||||||
}
|
}
|
||||||
BIN
app/libs/gt-epsg-hsql-25.0.jar
Normal file
BIN
app/libs/gt-main-25.0.jar
Normal file
BIN
app/libs/jts-core-1.18.2.jar
Normal file
@@ -2,6 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.navinfo.outdoor">
|
package="com.navinfo.outdoor">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.READ_CALENDAR" /> <!-- <uses-permission android:name="android.permission.WRITE_CALENDAR" /> -->
|
<uses-permission android:name="android.permission.READ_CALENDAR" /> <!-- <uses-permission android:name="android.permission.WRITE_CALENDAR" /> -->
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
@@ -9,9 +10,13 @@
|
|||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" /> <!-- <uses-sdk android:minSdkVersion="8"></uses-sdk> -->
|
<uses-permission android:name="android.permission.CAMERA" /> <!-- <uses-sdk android:minSdkVersion="8"></uses-sdk> -->
|
||||||
<!-- 在SDCard中创建与删除文件权限 -->
|
<!-- 在SDCard中创建与删除文件权限 -->
|
||||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" tools:ignore="ProtectedPermissions" /> <!-- 安装APK权限 -->
|
<uses-permission
|
||||||
|
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
|
||||||
|
tools:ignore="ProtectedPermissions" /> <!-- 安装APK权限 -->
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!-- 友盟检测bug -->
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!-- 友盟检测bug -->
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" tools:node="remove" /><!--移除自启动能力-->
|
<uses-permission
|
||||||
|
android:name="android.permission.RECEIVE_BOOT_COMPLETED"
|
||||||
|
tools:node="remove" /> <!-- 移除自启动能力 -->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
|
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> -->
|
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> -->
|
||||||
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" /> -->
|
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" /> -->
|
||||||
@@ -34,11 +39,13 @@
|
|||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.camera"
|
android:name="android.hardware.camera"
|
||||||
android:required="true" />
|
android:required="true" />
|
||||||
|
|
||||||
<queries>
|
<queries>
|
||||||
<intent>
|
<intent>
|
||||||
<action android:name="android.intent.action.TTS_SERVICE" />
|
<action android:name="android.intent.action.TTS_SERVICE" />
|
||||||
</intent>
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".api.UserApplication"
|
android:name=".api.UserApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@@ -51,6 +58,13 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.WhiteScreen"
|
android:theme="@style/Theme.WhiteScreen"
|
||||||
tools:targetApi="n">
|
tools:targetApi="n">
|
||||||
|
<!-- <activity-->
|
||||||
|
<!-- android:name=".NaviActivity"-->
|
||||||
|
<!-- android:exported="false">-->
|
||||||
|
<!-- <meta-data-->
|
||||||
|
<!-- android:name="android.app.lib_name"-->
|
||||||
|
<!-- android:value="" />-->
|
||||||
|
<!-- </activity>-->
|
||||||
<activity android:name=".activity.RegardMapActivity" />
|
<activity android:name=".activity.RegardMapActivity" />
|
||||||
<activity android:name=".activity.StatementActivity" />
|
<activity android:name=".activity.StatementActivity" />
|
||||||
<activity
|
<activity
|
||||||
@@ -63,34 +77,40 @@
|
|||||||
android:launchMode="singleTop" />
|
android:launchMode="singleTop" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.PhotographActivity"
|
android:name=".activity.PhotographActivity"
|
||||||
|
android:screenOrientation="landscape"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
||||||
android:launchMode="singleTop" />
|
android:launchMode="singleTop" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.webkit.WebView.EnableSafeBrowsing"
|
android:name="android.webkit.WebView.EnableSafeBrowsing"
|
||||||
android:value="true" />
|
android:value="true" /> <!-- <meta-data -->
|
||||||
|
<!-- android:name="TencentMapSDK" -->
|
||||||
|
<!-- android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" /> -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="TencentMapSDK"
|
android:name="TencentMapSDK"
|
||||||
android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" />
|
android:value="7UEBZ-TWAYK-5JFJM-A5SJI-FA4U6-3IBMX" /> <!-- 今日头屏幕适配 -->
|
||||||
<!-- 今日头屏幕适配 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="design_width_in_dp"
|
android:name="design_width_in_dp"
|
||||||
android:value="360" />
|
android:value="360" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="design_height_in_dp"
|
android:name="design_height_in_dp"
|
||||||
android:value="640" />
|
android:value="640" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<!-- <activity
|
<!--
|
||||||
|
<activity
|
||||||
android:name=".activity.UMClickActivity"
|
android:name=".activity.UMClickActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:exported="true" />-->
|
android:exported="true" />
|
||||||
|
-->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.LoginActivity"
|
android:name=".activity.LoginActivity"
|
||||||
android:configChanges="keyboardHidden|orientation"
|
android:configChanges="keyboardHidden|orientation"
|
||||||
@@ -104,14 +124,17 @@
|
|||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.FragmentManagement"
|
android:name=".activity.FragmentManagement"
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan" />
|
android:windowSoftInputMode="adjustPan" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.ImageShowActivity"
|
android:name=".activity.ImageShowActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.VideoActivity"
|
android:name=".activity.VideoActivity"
|
||||||
|
android:screenOrientation="portrait" /> <!-- 自动拍照界面 -->
|
||||||
|
<activity
|
||||||
|
android:name=".activity.AutoTakePictureActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.UserActivity"
|
android:name=".activity.UserActivity"
|
||||||
@@ -120,6 +143,15 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.GuidanceActivity"
|
android:name=".activity.GuidanceActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.NaviCarActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.NaviRideActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.NaviWalkActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
@@ -129,8 +161,7 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/file_paths" />
|
android:resource="@xml/file_paths" />
|
||||||
</provider>
|
</provider> <!-- 移除关联启动能力 -->
|
||||||
<!--移除关联启动能力-->
|
|
||||||
<service
|
<service
|
||||||
android:name="com.taobao.accs.ChannelService"
|
android:name="com.taobao.accs.ChannelService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
@@ -139,6 +170,7 @@
|
|||||||
android:name="com.taobao.accs.data.MsgDistributeService"
|
android:name="com.taobao.accs.data.MsgDistributeService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
tools:replace="android:exported" />
|
tools:replace="android:exported" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.taobao.accs.EventReceiver"
|
android:name="com.taobao.accs.EventReceiver"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
@@ -147,6 +179,7 @@
|
|||||||
android:name="com.taobao.accs.ServiceReceiver"
|
android:name="com.taobao.accs.ServiceReceiver"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
tools:replace="android:exported" />
|
tools:replace="android:exported" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="org.android.agoo.accs.AgooService"
|
android:name="org.android.agoo.accs.AgooService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
@@ -159,15 +192,16 @@
|
|||||||
android:name="com.umeng.message.XiaomiIntentService"
|
android:name="com.umeng.message.XiaomiIntentService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
tools:replace="android:exported" />
|
tools:replace="android:exported" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.taobao.agoo.AgooCommondReceiver"
|
android:name="com.taobao.agoo.AgooCommondReceiver"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
tools:replace="android:exported" />
|
tools:replace="android:exported" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.umeng.message.UmengMessageIntentReceiverService"
|
android:name="com.umeng.message.UmengMessageIntentReceiverService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
tools:replace="android:exported" />
|
tools:replace="android:exported" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,5 +1,20 @@
|
|||||||
package com.navinfo.outdoor.activity;
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
import com.elvishew.xlog.LogConfiguration;
|
||||||
|
import com.elvishew.xlog.LogLevel;
|
||||||
|
import com.elvishew.xlog.XLog;
|
||||||
|
import com.elvishew.xlog.flattener.ClassicFlattener;
|
||||||
|
import com.elvishew.xlog.printer.AndroidPrinter;
|
||||||
|
import com.elvishew.xlog.printer.ConsolePrinter;
|
||||||
|
import com.elvishew.xlog.printer.Printer;
|
||||||
|
import com.elvishew.xlog.printer.file.FilePrinter;
|
||||||
|
import com.elvishew.xlog.printer.file.backup.BackupStrategy2;
|
||||||
|
import com.elvishew.xlog.printer.file.backup.FileSizeBackupStrategy2;
|
||||||
|
import com.elvishew.xlog.printer.file.backup.NeverBackupStrategy;
|
||||||
|
import com.elvishew.xlog.printer.file.clean.FileLastModifiedCleanStrategy;
|
||||||
|
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;
|
||||||
|
import com.elvishew.xlog.printer.file.naming.LevelFileNameGenerator;
|
||||||
|
import com.github.lazylibrary.util.ShellUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||||
import com.kongzue.dialog.util.BaseDialog;
|
import com.kongzue.dialog.util.BaseDialog;
|
||||||
@@ -16,6 +31,7 @@ import com.navinfo.outdoor.fragment.TreasureFragment;
|
|||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
import com.navinfo.outdoor.room.PoiDatabase;
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
import com.navinfo.outdoor.util.BackHandlerHelper;
|
import com.navinfo.outdoor.util.BackHandlerHelper;
|
||||||
|
import com.navinfo.outdoor.util.NaviUtils;
|
||||||
import com.navinfo.outdoor.util.NoSlideViewPager;
|
import com.navinfo.outdoor.util.NoSlideViewPager;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -26,9 +42,13 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -36,7 +56,8 @@ import android.widget.Toast;
|
|||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
import com.umeng.message.PushAgent;
|
import com.teprinciple.mailsender.Mail;
|
||||||
|
import com.teprinciple.mailsender.MailSender;
|
||||||
import com.umeng.message.UmengNotificationClickHandler;
|
import com.umeng.message.UmengNotificationClickHandler;
|
||||||
import com.umeng.message.entity.UMessage;
|
import com.umeng.message.entity.UMessage;
|
||||||
|
|
||||||
@@ -44,10 +65,23 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableEmitter;
|
||||||
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.functions.Consumer;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页
|
* 首页
|
||||||
* tabLayout + viewPager
|
* tabLayout + viewPager
|
||||||
@@ -62,6 +96,8 @@ public class HomeActivity extends BaseActivity {
|
|||||||
public boolean handleMessage(@NonNull Message msg) {
|
public boolean handleMessage(@NonNull Message msg) {
|
||||||
if (msg.what == 0x100) {
|
if (msg.what == 0x100) {
|
||||||
isBack = false;
|
isBack = false;
|
||||||
|
} else if (msg.what == 0x101) {
|
||||||
|
checkMockLocation();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -77,6 +113,27 @@ public class HomeActivity extends BaseActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (Constant.USHERED != null) {
|
if (Constant.USHERED != null) {
|
||||||
Constant.initRootFolder(Constant.USHERED);
|
Constant.initRootFolder(Constant.USHERED);
|
||||||
|
// 检测用户是否为虚拟定位
|
||||||
|
boolean result = handler.sendEmptyMessageDelayed(0x101, 1000*60*(int)(10*Math.random()));
|
||||||
|
Log.d("HomeActivity", "作弊检查:"+result);
|
||||||
|
|
||||||
|
LogConfiguration logConfiguration = new LogConfiguration.Builder()
|
||||||
|
// .enableStackTrace(5)
|
||||||
|
.enableBorder()
|
||||||
|
.tag("OutDoor").build();
|
||||||
|
Printer androidPrinter = new AndroidPrinter(true); // 通过 android.util.Log 打印日志的打印器
|
||||||
|
Printer consolePrinter = new ConsolePrinter(); // 通过 System.out 打印日志到控制台的打印器
|
||||||
|
Printer filePrinter = new FilePrinter // 打印日志到文件的打印器
|
||||||
|
.Builder(Constant.LOG_FOLDER) // 指定保存日志文件的路径
|
||||||
|
.fileNameGenerator(new LevelFileNameGenerator()) // 指定日志文件名生成器,默认为 ChangelessFileNameGenerator("log")
|
||||||
|
.flattener(new ClassicFlattener())
|
||||||
|
.build();
|
||||||
|
// 初始化XLog
|
||||||
|
XLog.init( // 初始化 XLog
|
||||||
|
logConfiguration, // 指定日志配置,如果不指定,会默认使用 new LogConfiguration.Builder().build()
|
||||||
|
androidPrinter, // 添加任意多的打印器。如果没有添加任何打印器,会默认使用 AndroidPrinter(Android)/ConsolePrinter(java)
|
||||||
|
consolePrinter,
|
||||||
|
filePrinter);
|
||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@@ -94,6 +151,7 @@ public class HomeActivity extends BaseActivity {
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
initUM();
|
initUM();
|
||||||
|
// Toast.makeText(this, "作弊检查:"+result, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initUM() {
|
private void initUM() {
|
||||||
@@ -269,6 +327,214 @@ public class HomeActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否为模拟定位
|
||||||
|
* */
|
||||||
|
private void checkMockLocation() {
|
||||||
|
Log.d("HomeActivity", "checkMockLocation开始:");
|
||||||
|
Observable.create(new ObservableOnSubscribe<Map<String, Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<Map<String, Boolean>> emitter) throws Exception {
|
||||||
|
emitter.onNext(new HashMap<>());
|
||||||
|
emitter.onComplete();
|
||||||
|
}
|
||||||
|
}).subscribeOn(AndroidSchedulers.mainThread())
|
||||||
|
.observeOn(Schedulers.computation())
|
||||||
|
.doOnNext(new Consumer<Map<String, Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Map<String, Boolean> stringBooleanMap) throws Exception {
|
||||||
|
if (isInstallVirtual(HomeActivity.this)) {
|
||||||
|
stringBooleanMap.put("安装有虚拟定位软件", true);
|
||||||
|
}else {
|
||||||
|
Log.d("HomeActivity", "不安装有虚拟定位软件:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).doOnNext(new Consumer<Map<String, Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Map<String, Boolean> stringBooleanMap) throws Exception {
|
||||||
|
if (isOpenMockLocationSetting()) {
|
||||||
|
stringBooleanMap.put("打开了虚拟定位设置", true);
|
||||||
|
}else {
|
||||||
|
Log.d("HomeActivity", "不打开了虚拟定位设置:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).doOnNext(new Consumer<Map<String, Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Map<String, Boolean> stringBooleanMap) throws Exception {
|
||||||
|
if (isRunInVirtual()) {
|
||||||
|
stringBooleanMap.put("程序运行在虚拟环境中", true);
|
||||||
|
}else {
|
||||||
|
Log.d("HomeActivity", "不程序运行在虚拟环境中:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).doOnNext(new Consumer<Map<String, Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Map<String, Boolean> stringBooleanMap) throws Exception {
|
||||||
|
if (checkPkg(HomeActivity.this)) {
|
||||||
|
stringBooleanMap.put("存在应用双开", true);
|
||||||
|
} else {
|
||||||
|
Log.d("HomeActivity", "不存在应用双开:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Consumer<Map<String, Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Map<String, Boolean> stringBooleanMap) throws Exception {
|
||||||
|
Log.d("HomeActivity", "checkMockLocation结果:"+stringBooleanMap.isEmpty());
|
||||||
|
if (!stringBooleanMap.isEmpty()) {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder("检查到疑似存在以下违规行为:\n");
|
||||||
|
for (String key: stringBooleanMap.keySet()
|
||||||
|
) {
|
||||||
|
stringBuilder.append(key).append("\n");
|
||||||
|
}
|
||||||
|
stringBuilder.append("请及时修正,否则可能会影响到您的收益,如有疑问可联系管理员!");
|
||||||
|
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||||
|
DialogSettings.cancelable = false;
|
||||||
|
MessageDialog.show(HomeActivity.this, "提示", stringBuilder, "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
// 将违规行为通知给运营人员
|
||||||
|
// 创建邮箱
|
||||||
|
Mail mail = new Mail();
|
||||||
|
mail.setMailServerHost("smtp.163.com");
|
||||||
|
mail.setMailServerPort("25");
|
||||||
|
mail.setFromAddress("xiaoyan159@163.com");
|
||||||
|
mail.setPassword("YGPSXLMRPMADRHPS");
|
||||||
|
ArrayList<String> toAddressList = new ArrayList<>();
|
||||||
|
toAddressList.add("xiaoyan159@qq.com");
|
||||||
|
toAddressList.add("huangjichao@navinfo.com");
|
||||||
|
mail.setToAddress(toAddressList);
|
||||||
|
mail.setSubject("疑似违规记录");
|
||||||
|
mail.setContent(stringBuilder.append("用户名:").append(Constant.USER_NAME).append("\n")
|
||||||
|
.append("身份证号:").append(Constant.ID_NUMBER).append("\n")
|
||||||
|
.append("姓名:").append(Constant.NAME).append("\n")
|
||||||
|
.append("手机号:").append(Constant.MOBILE).toString());
|
||||||
|
// mail.attachFiles = arrayListOf(file);
|
||||||
|
|
||||||
|
// 发送邮箱
|
||||||
|
MailSender.getInstance().sendMail(mail, new MailSender.OnMailSendListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
// 发送成功,无需再报告
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable throwable) {
|
||||||
|
handler.sendEmptyMessageDelayed(0x101, 1000*60*(int)(10*Math.random()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
baseDialog.doDismiss();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
handler.sendEmptyMessageDelayed(0x101, 1000*60*(int)(10*Math.random()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInstallVirtual(Context context) {
|
||||||
|
Map<String, String> packageNames = getVirtualPackageNames();
|
||||||
|
PackageManager packageManager = context.getPackageManager();
|
||||||
|
List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
|
||||||
|
for (int i = 0; i < pinfo.size(); i++) {
|
||||||
|
if (packageNames.get(pinfo.get(i).packageName) != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> getVirtualPackageNames() {
|
||||||
|
Map<String, String> packageNames = new HashMap<>();
|
||||||
|
packageNames.put("com.lerist.fakelocation", "com.lerist.fakelocation");// Fake-location虚拟定位
|
||||||
|
packageNames.put("top.a1024bytes.mockloc.ca.pro", "top.a1024bytes.mockloc.ca.pro");// 天下任我行
|
||||||
|
packageNames.put("com.qgwapp.shadowside", "com.qgwapp.shadowside");// 任我行免ROOT
|
||||||
|
packageNames.put("net.superal", "net.superal");// 超级神行者
|
||||||
|
packageNames.put("com.deniu.daniu", "com.deniu.daniu");// 大牛
|
||||||
|
packageNames.put("com.deniu.multi", "com.deniu.multi");// 大牛助手
|
||||||
|
packageNames.put("com.txy.anywhere", "com.txy.anywhere");// 天下游
|
||||||
|
packageNames.put("de.robv.android.xposed.installer", "de.robv.android.xposed.installer");// Xposed
|
||||||
|
packageNames.put("github.tornaco.xposedmoduletest", "github.tornaco.xposedmoduletest");// 应用管理Xposed
|
||||||
|
return packageNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启虚拟定位设置
|
||||||
|
* */
|
||||||
|
private boolean isOpenMockLocationSetting() {
|
||||||
|
return Settings.Secure.getInt(getContentResolver(),Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isRunInVirtual() {
|
||||||
|
// 获取当前应用的uid
|
||||||
|
String filter = getUid(this);
|
||||||
|
ShellUtils.CommandResult commandResult = ShellUtils.execCommand("ps", false);
|
||||||
|
Log.d("HomeActivity: commandResult", commandResult.errorMsg+":::"+commandResult.successMsg+":::"+commandResult.result);
|
||||||
|
if (commandResult==null&&commandResult.successMsg==null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String result = commandResult.successMsg;
|
||||||
|
if (result == null || result.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String[] lines = result.split("\n");
|
||||||
|
if (lines == null || lines.length <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int exitDirCount = 0;
|
||||||
|
for (int i = 0; i < lines.length; i++) {
|
||||||
|
if (lines[i].contains(filter)) {
|
||||||
|
int pkgStartIndex = lines[i].lastIndexOf(" ");
|
||||||
|
String processName = lines[i].substring(pkgStartIndex <= 0
|
||||||
|
? 0 : pkgStartIndex + 1, lines[i].length());
|
||||||
|
File dataFile = new File(String.format("/data/data/%s",
|
||||||
|
processName, Locale.CHINA));
|
||||||
|
if (dataFile.exists()) {
|
||||||
|
exitDirCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return exitDirCount > 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用列表检查,防止应用多开
|
||||||
|
* */
|
||||||
|
private boolean checkPkg(Context context) {
|
||||||
|
try {
|
||||||
|
if (context == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
String packageName = context.getPackageName();
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
List<PackageInfo> pkgs = pm.getInstalledPackages(0);
|
||||||
|
for (PackageInfo info : pkgs) {
|
||||||
|
if (packageName.equals(info.packageName)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count > 1;
|
||||||
|
} catch (Exception ignore) {}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUid(Context context) {
|
||||||
|
String uid = "";
|
||||||
|
try {
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
ApplicationInfo ai = pm.getApplicationInfo("com.navinfo.outdoor", PackageManager.GET_META_DATA);
|
||||||
|
uid = String.valueOf(ai.uid);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (!BackHandlerHelper.handleBackPress(this)) {
|
if (!BackHandlerHelper.handleBackPress(this)) {
|
||||||
@@ -288,5 +554,7 @@ public class HomeActivity extends BaseActivity {
|
|||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
PoiDatabase.destroy();
|
PoiDatabase.destroy();
|
||||||
|
// 清空登录信息
|
||||||
|
Constant.clearLoginInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.github.lazylibrary.util.AppUtils;
|
||||||
import com.github.lazylibrary.util.FileUtils;
|
import com.github.lazylibrary.util.FileUtils;
|
||||||
import com.lzy.okgo.model.HttpParams;
|
import com.lzy.okgo.model.HttpParams;
|
||||||
import com.lzy.okgo.model.Progress;
|
import com.lzy.okgo.model.Progress;
|
||||||
@@ -32,6 +33,7 @@ import com.navinfo.outdoor.http.Callback;
|
|||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||||
import com.navinfo.outdoor.http.UploadCallBack;
|
import com.navinfo.outdoor.http.UploadCallBack;
|
||||||
|
import com.navinfo.outdoor.util.APKVersionCodeUtils;
|
||||||
import com.navinfo.outdoor.util.Base64;
|
import com.navinfo.outdoor.util.Base64;
|
||||||
import com.navinfo.outdoor.util.Md5Util;
|
import com.navinfo.outdoor.util.Md5Util;
|
||||||
import com.navinfo.outdoor.util.TimestampUtil;
|
import com.navinfo.outdoor.util.TimestampUtil;
|
||||||
@@ -125,7 +127,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
|||||||
navInfoEditor = navInfo.edit();
|
navInfoEditor = navInfo.edit();
|
||||||
TextView tvRegister = findViewById(R.id.tv_register);
|
TextView tvRegister = findViewById(R.id.tv_register);
|
||||||
TextView tvView = findViewById(R.id.tv_view);
|
TextView tvView = findViewById(R.id.tv_view);
|
||||||
tvView.setText(Constant.NAVIN_FO);
|
tvView.setText("版本号:"+AppUtils.getVerName(this));
|
||||||
etLoginName = findViewById(R.id.et_login_name);
|
etLoginName = findViewById(R.id.et_login_name);
|
||||||
etLoginPaw = findViewById(R.id.et_login_paw);
|
etLoginPaw = findViewById(R.id.et_login_paw);
|
||||||
TextView tvForgetPaw = findViewById(R.id.tv_forget_paw);
|
TextView tvForgetPaw = findViewById(R.id.tv_forget_paw);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
|
import com.github.lazylibrary.util.AppUtils;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
@@ -493,5 +494,6 @@ public class MainActivity extends BaseActivity {
|
|||||||
Constant.REFRESH_TOKEN = navInfo.getString("refresh_token", null);
|
Constant.REFRESH_TOKEN = navInfo.getString("refresh_token", null);
|
||||||
Constant.ACCESS_TOKEN = navInfo.getString("access_token", null);
|
Constant.ACCESS_TOKEN = navInfo.getString("access_token", null);
|
||||||
initPermission();
|
initPermission();
|
||||||
|
((TextView)findViewById(R.id.tv_view)).setText("版本号:"+ AppUtils.getVerName(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
public class MyCoordinate {
|
||||||
|
private double x;
|
||||||
|
private double Y;
|
||||||
|
|
||||||
|
public MyCoordinate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyCoordinate(double x, double y) {
|
||||||
|
this.x = x;
|
||||||
|
Y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(double x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getY() {
|
||||||
|
return Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(double y) {
|
||||||
|
Y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.navinfo.outdoor.activity;
|
||||||
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
|
import com.navinfo.outdoor.base.NaviLifeCycle;
|
||||||
|
import com.navinfo.outdoor.util.NaviUtils;
|
||||||
|
import com.tencent.map.navi.TencentNaviManager;
|
||||||
|
import com.tencent.map.navi.car.CarNaviView;
|
||||||
|
import com.tencent.map.navi.data.NaviPoi;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
|
|
||||||
|
public class NaviCarActivity extends BaseActivity {
|
||||||
|
private CarNaviView carNaviView;
|
||||||
|
private LifecycleObserver lifecycleObserver;
|
||||||
|
@Override
|
||||||
|
protected int getLayout() {
|
||||||
|
return R.layout.activity_navi_car;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
super.initView();
|
||||||
|
carNaviView = findViewById(R.id.carnaviview);
|
||||||
|
lifecycleObserver = new NaviLifeCycle(carNaviView);
|
||||||
|
getLifecycle().addObserver(lifecycleObserver);
|
||||||
|
TencentNaviManager naviManager = NaviUtils.getInstance().obitainnaviManager(this, Constant.currentNaviType, carNaviView);
|
||||||
|
// 获取起终点
|
||||||
|
LatLng startLatlng = (LatLng) getIntent().getExtras().get("start");
|
||||||
|
LatLng endLatlng = (LatLng) getIntent().getExtras().get("end");
|
||||||
|
try {
|
||||||
|
NaviUtils.getInstance().searchRoute(Constant.currentNaviType, naviManager, new NaviPoi(startLatlng.latitude, startLatlng.longitude), new NaviPoi(endLatlng.latitude, endLatlng.longitude));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getLifecycle().removeObserver(lifecycleObserver);
|
||||||
|
// 如果当前正在导航,自动停止
|
||||||
|
NaviUtils.getInstance().stopNavi();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
|
import com.navinfo.outdoor.base.NaviLifeCycle;
|
||||||
|
import com.navinfo.outdoor.util.NaviUtils;
|
||||||
|
import com.tencent.map.navi.TencentNaviManager;
|
||||||
|
import com.tencent.map.navi.car.CarNaviView;
|
||||||
|
import com.tencent.map.navi.data.NaviPoi;
|
||||||
|
import com.tencent.map.navi.ride.RideNaviView;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
|
|
||||||
|
public class NaviRideActivity extends BaseActivity {
|
||||||
|
private RideNaviView rideNaviView;
|
||||||
|
private LifecycleObserver lifecycleObserver;
|
||||||
|
@Override
|
||||||
|
protected int getLayout() {
|
||||||
|
return R.layout.activity_navi_car;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
super.initView();
|
||||||
|
rideNaviView = findViewById(R.id.ridenaviview);
|
||||||
|
lifecycleObserver = new NaviLifeCycle(rideNaviView);
|
||||||
|
getLifecycle().addObserver(lifecycleObserver);
|
||||||
|
TencentNaviManager naviManager = NaviUtils.getInstance().obitainnaviManager(this, Constant.currentNaviType, rideNaviView);
|
||||||
|
// 获取起终点
|
||||||
|
LatLng startLatlng = (LatLng) getIntent().getSerializableExtra("start");
|
||||||
|
LatLng endLatlng = (LatLng) getIntent().getSerializableExtra("end");
|
||||||
|
try {
|
||||||
|
NaviUtils.getInstance().searchRoute(Constant.currentNaviType, naviManager, new NaviPoi(startLatlng.latitude, startLatlng.longitude), new NaviPoi(endLatlng.latitude, endLatlng.longitude));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getLifecycle().removeObserver(lifecycleObserver);
|
||||||
|
// 如果当前正在导航,自动停止
|
||||||
|
NaviUtils.getInstance().stopNavi();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LifecycleObserver;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
|
import com.navinfo.outdoor.base.NaviLifeCycle;
|
||||||
|
import com.navinfo.outdoor.util.NaviUtils;
|
||||||
|
import com.tencent.map.navi.TencentNaviManager;
|
||||||
|
import com.tencent.map.navi.data.NaviPoi;
|
||||||
|
import com.tencent.map.navi.ride.RideNaviView;
|
||||||
|
import com.tencent.map.navi.walk.WalkNaviView;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
|
|
||||||
|
public class NaviWalkActivity extends BaseActivity {
|
||||||
|
private WalkNaviView walkNaviView;
|
||||||
|
private LifecycleObserver lifecycleObserver;
|
||||||
|
@Override
|
||||||
|
protected int getLayout() {
|
||||||
|
return R.layout.activity_navi_car;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
super.initView();
|
||||||
|
walkNaviView = findViewById(R.id.walknaviview);
|
||||||
|
lifecycleObserver = new NaviLifeCycle(walkNaviView);
|
||||||
|
getLifecycle().addObserver(lifecycleObserver);
|
||||||
|
TencentNaviManager naviManager = NaviUtils.getInstance().obitainnaviManager(this, Constant.currentNaviType, walkNaviView);
|
||||||
|
// 获取起终点
|
||||||
|
LatLng startLatlng = (LatLng) getIntent().getSerializableExtra("start");
|
||||||
|
LatLng endLatlng = (LatLng) getIntent().getSerializableExtra("end");
|
||||||
|
try {
|
||||||
|
NaviUtils.getInstance().searchRoute(Constant.currentNaviType, naviManager, new NaviPoi(startLatlng.latitude, startLatlng.longitude), new NaviPoi(endLatlng.latitude, endLatlng.longitude));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getLifecycle().removeObserver(lifecycleObserver);
|
||||||
|
// 如果当前正在导航,自动停止
|
||||||
|
NaviUtils.getInstance().stopNavi();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
import com.lzy.okgo.OkGo;
|
||||||
|
import com.lzy.okgo.adapter.AdapterParam;
|
||||||
|
import com.lzy.okgo.adapter.Call;
|
||||||
|
import com.lzy.okgo.adapter.CallAdapter;
|
||||||
|
import com.lzy.okgo.convert.StringConvert;
|
||||||
|
import com.lzy.okgo.model.Response;
|
||||||
|
import com.lzy.okgo.request.GetRequest;
|
||||||
|
import com.lzy.okgo.request.PostRequest;
|
||||||
|
import com.lzy.okrx2.adapter.ObservableBody;
|
||||||
|
import com.lzy.okrx2.adapter.ObservableResponse;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import io.reactivex.Flowable;
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
|
||||||
|
public class OkHttpUtils {
|
||||||
|
private static OkHttpUtils instance;
|
||||||
|
|
||||||
|
public static OkHttpUtils getInstance() {
|
||||||
|
if (instance==null) {
|
||||||
|
instance = new OkHttpUtils();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T>Observable<Response<T>> obtainOkGet(String url, Object tag, Map<String, String> params) {
|
||||||
|
GetRequest<T> getRequest = OkGo.getInstance().<T>get(url).tag(tag);
|
||||||
|
if (params!=null&&!params.isEmpty()) {
|
||||||
|
getRequest.params(params, true);
|
||||||
|
}
|
||||||
|
return getRequest.adapt(new ObservableResponse<T>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T>Observable<Response<T>> obtainOkPost(String url, Object tag, Map<String, String> params) {
|
||||||
|
PostRequest<T> postRequest = OkGo.getInstance().<T>post(url).tag(tag);
|
||||||
|
if (params!=null&&!params.isEmpty()) {
|
||||||
|
postRequest.params(params, true);
|
||||||
|
}
|
||||||
|
return postRequest.adapt(new ObservableResponse<T>());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ import com.otaliastudios.cameraview.CameraView;
|
|||||||
import com.otaliastudios.cameraview.FileCallback;
|
import com.otaliastudios.cameraview.FileCallback;
|
||||||
import com.otaliastudios.cameraview.PictureResult;
|
import com.otaliastudios.cameraview.PictureResult;
|
||||||
import com.otaliastudios.cameraview.controls.Mode;
|
import com.otaliastudios.cameraview.controls.Mode;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import com.wanghong.webpnative.WebPNative;
|
import com.wanghong.webpnative.WebPNative;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@@ -109,7 +109,7 @@ public class PhotographActivity extends BaseActivity implements View.OnClickL
|
|||||||
if (getIntent() != null) {
|
if (getIntent() != null) {
|
||||||
photo_path = getIntent().getStringExtra(Constant.INTENT_PHOTO_PATH);
|
photo_path = getIntent().getStringExtra(Constant.INTENT_PHOTO_PATH);
|
||||||
}
|
}
|
||||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
// this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
||||||
cameraView = findViewById(R.id.camera);
|
cameraView = findViewById(R.id.camera);
|
||||||
cameraView.setOnClickListener(this);
|
cameraView.setOnClickListener(this);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -690,7 +690,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
|
|||||||
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||||
0, //目标倾斜角
|
0, //目标倾斜角
|
||||||
tencentLocation.getBearing())); //目标旋转角 0~360° (正北方为0)
|
0)); //目标旋转角 0~360° (正北方为0)
|
||||||
tencentMap.animateCamera(cameraSigma);
|
tencentMap.animateCamera(cameraSigma);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import android.util.DisplayMetrics;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
@@ -52,10 +54,15 @@ import com.navinfo.outdoor.util.TimestampUtil;
|
|||||||
import com.navinfo.outdoor.util.ToastUtils;
|
import com.navinfo.outdoor.util.ToastUtils;
|
||||||
import com.otaliastudios.cameraview.CameraListener;
|
import com.otaliastudios.cameraview.CameraListener;
|
||||||
import com.otaliastudios.cameraview.CameraLogger;
|
import com.otaliastudios.cameraview.CameraLogger;
|
||||||
|
import com.otaliastudios.cameraview.CameraOptions;
|
||||||
import com.otaliastudios.cameraview.CameraView;
|
import com.otaliastudios.cameraview.CameraView;
|
||||||
import com.otaliastudios.cameraview.FileCallback;
|
import com.otaliastudios.cameraview.FileCallback;
|
||||||
import com.otaliastudios.cameraview.PictureResult;
|
import com.otaliastudios.cameraview.PictureResult;
|
||||||
import com.otaliastudios.cameraview.controls.Mode;
|
import com.otaliastudios.cameraview.controls.Mode;
|
||||||
|
import com.otaliastudios.cameraview.size.AspectRatio;
|
||||||
|
import com.otaliastudios.cameraview.size.Size;
|
||||||
|
import com.otaliastudios.cameraview.size.SizeSelector;
|
||||||
|
import com.otaliastudios.cameraview.size.SizeSelectors;
|
||||||
import com.tencent.map.geolocation.TencentLocation;
|
import com.tencent.map.geolocation.TencentLocation;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||||
@@ -74,9 +81,9 @@ import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||||
import com.umeng.commonsdk.internal.crash.UMCrashManager;
|
import com.umeng.commonsdk.internal.crash.UMCrashManager;
|
||||||
import com.umeng.umcrash.UMCrash;
|
import com.umeng.umcrash.UMCrash;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import org.locationtech.jts.geom.LineString;
|
||||||
import com.vividsolutions.jts.geom.MultiLineString;
|
import org.locationtech.jts.geom.MultiLineString;
|
||||||
import com.wanghong.webpnative.WebPNative;
|
import com.wanghong.webpnative.WebPNative;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@@ -96,10 +103,21 @@ import java.util.Timer;
|
|||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
|
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
|
||||||
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
|
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableEmitter;
|
||||||
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.functions.Action;
|
||||||
|
import io.reactivex.functions.Consumer;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拍照
|
* 拍照
|
||||||
* (poi录像 和 道路)
|
* (poi录像 和 道路)
|
||||||
@@ -122,25 +140,28 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
private SystemTTS systemTTS;
|
private SystemTTS systemTTS;
|
||||||
private StringBuilder picturesBuilder;
|
private StringBuilder picturesBuilder;
|
||||||
private LatLng startLatLine, endLatLine;
|
private LatLng startLatLine, endLatLine;
|
||||||
private TextView tvTitle;
|
private TextView tvTitle, tvConvert/*照片已转换为webp的张数*/;
|
||||||
private GPSUtils gpsUtils;
|
private GPSUtils gpsUtils;
|
||||||
private Location gpsLocation;
|
private Location gpsLocation;
|
||||||
private boolean isMapSlide = false;
|
private boolean isMapSlide = false;
|
||||||
private boolean isOration = true;
|
private boolean isOration = true; // 当前是否为自动拍照模式
|
||||||
private boolean isTerminus = false;
|
private boolean isTerminus = false;
|
||||||
private boolean isBack = true;
|
private boolean isBack = true;
|
||||||
private int initCount;
|
private int initCount;
|
||||||
private int type = 0;
|
private int type = 0;
|
||||||
private int radioPicture = 0;
|
private int radioPicture = 0;
|
||||||
private int videoIndex = -1;
|
private int videoIndex = -1;
|
||||||
|
private int convertIndex = 0;
|
||||||
private int startVideoIndex = -1;
|
private int startVideoIndex = -1;
|
||||||
|
private static int BRIGHTNESS=40, FRAMENESS=30;
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
private SimpleDateFormat formatter;
|
private SimpleDateFormat formatter;
|
||||||
private Handler handler = new Handler(new Handler.Callback() {
|
private Handler handler = new Handler(new Handler.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(@NonNull Message msg) {
|
public boolean handleMessage(@NonNull Message msg) {
|
||||||
if (msg.what == 0x101) {
|
if (msg.what == 0x101) {
|
||||||
camera.takePicture();
|
System.out.println("收到拍照按钮请求");
|
||||||
|
camera.takePictureSnapshot();
|
||||||
} else if (msg.what == 0x102) {
|
} else if (msg.what == 0x102) {
|
||||||
if (imageView != null) {
|
if (imageView != null) {
|
||||||
imageView.setEnabled(true);
|
imageView.setEnabled(true);
|
||||||
@@ -151,12 +172,25 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
capturePicture.setChecked(false);
|
capturePicture.setChecked(false);
|
||||||
stopTimer();
|
stopTimer();
|
||||||
|
} else if (msg.what == 0x104) {
|
||||||
|
tvConvert.setText("转换成功:"+(++msg.arg1));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
private boolean booleanExtra;
|
private boolean booleanExtra;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
SharedPreferences sharedPreferences = getSharedPreferences("pic", Context.MODE_PRIVATE);
|
||||||
|
BRIGHTNESS = sharedPreferences.getInt("brightness", 40);
|
||||||
|
FRAMENESS = sharedPreferences.getInt("framness", 30);
|
||||||
|
|
||||||
|
// 设置当前界面亮度为40%
|
||||||
|
setWindowBrightness(BRIGHTNESS);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
@@ -182,6 +216,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
} else {
|
} else {
|
||||||
videoIndex = videoIndex - 1;
|
videoIndex = videoIndex - 1;
|
||||||
}
|
}
|
||||||
|
convertIndex = videoIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
||||||
@@ -193,7 +228,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
tvMapView.setOnClickListener(this);
|
tvMapView.setOnClickListener(this);
|
||||||
ivPicRoadImage = findViewById(R.id.iv_pic_road);
|
ivPicRoadImage = findViewById(R.id.iv_pic_road);
|
||||||
ivPicVideoImage = findViewById(R.id.iv_pic_video);
|
ivPicVideoImage = findViewById(R.id.iv_pic_video);
|
||||||
Button btnSwitch = findViewById(R.id.btn_switch);
|
ImageView btnSwitch = findViewById(R.id.btn_switch);
|
||||||
btnSwitch.setOnClickListener(this);
|
btnSwitch.setOnClickListener(this);
|
||||||
gpsUtils = new GPSUtils(PicturesActivity.this);
|
gpsUtils = new GPSUtils(PicturesActivity.this);
|
||||||
gpsUtils.setOnClickGPSStatus(new GPSUtils.OnClickGPSStatus() {
|
gpsUtils.setOnClickGPSStatus(new GPSUtils.OnClickGPSStatus() {
|
||||||
@@ -206,20 +241,21 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
RadioButton radioBtnHand = findViewById(R.id.radio_btn_hand);
|
RadioButton radioBtnHand = findViewById(R.id.radio_btn_hand);
|
||||||
RadioButton radioBtnAuto = findViewById(R.id.radio_btn_auto);
|
RadioButton radioBtnAuto = findViewById(R.id.radio_btn_auto);
|
||||||
RadioButton radioBtnAutoSec = findViewById(R.id.radio_btn_auto_sec);
|
RadioButton radioBtnAutoSec = findViewById(R.id.radio_btn_auto_sec);
|
||||||
|
RadioButton radioBtnHalfSec = findViewById(R.id.radio_btn_half_sec);
|
||||||
if (type == 3) {//poiVideo 1秒
|
if (type == 3) {//poiVideo 1秒
|
||||||
ivPicVideoImage.setVisibility(View.VISIBLE);
|
ivPicVideoImage.setVisibility(View.VISIBLE);
|
||||||
ivPicRoadImage.setVisibility(View.GONE);
|
ivPicRoadImage.setVisibility(View.GONE);
|
||||||
radioPicture = 3;
|
radioPicture = 3;
|
||||||
radioBtnAutoSec.setTextColor(Color.parseColor("#FFEB3B"));
|
radioBtnAutoSec.setChecked(true);
|
||||||
radioBtnHand.setTextColor(Color.WHITE);
|
} else if (type == 4) {//道路1秒2张
|
||||||
radioBtnAuto.setTextColor(Color.WHITE);
|
|
||||||
} else if (type == 4) {//道路2秒
|
|
||||||
ivPicRoadImage.setVisibility(View.VISIBLE);
|
ivPicRoadImage.setVisibility(View.VISIBLE);
|
||||||
ivPicVideoImage.setVisibility(View.GONE);
|
ivPicVideoImage.setVisibility(View.GONE);
|
||||||
radioPicture = 3;
|
radioPicture = 4;
|
||||||
radioBtnAutoSec.setTextColor(Color.parseColor("#FFEB3B"));
|
radioBtnHalfSec.setChecked(true);
|
||||||
radioBtnAuto.setTextColor(Color.WHITE);
|
// 道路采集时自动隐藏其他选项,只保留自动0.5秒1张的设定
|
||||||
radioBtnHand.setTextColor(Color.WHITE);
|
radioBtnHand.setVisibility(View.GONE);
|
||||||
|
radioBtnAuto.setVisibility(View.GONE);
|
||||||
|
radioBtnAutoSec.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
radioGroupPicture.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
radioGroupPicture.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -230,27 +266,24 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
isOration = false;
|
isOration = false;
|
||||||
capturePicture.setText("拍摄");
|
capturePicture.setText("拍摄");
|
||||||
capturePicture.setChecked(false);
|
capturePicture.setChecked(false);
|
||||||
radioBtnHand.setTextColor(Color.parseColor("#FFEB3B"));
|
|
||||||
radioBtnAuto.setTextColor(Color.WHITE);
|
|
||||||
radioBtnAutoSec.setTextColor(Color.WHITE);
|
|
||||||
stopTimer();
|
stopTimer();
|
||||||
break;
|
break;
|
||||||
case R.id.radio_btn_auto://自动1秒:
|
case R.id.radio_btn_auto://自动1秒:
|
||||||
radioPicture = 2;
|
radioPicture = 2;
|
||||||
capturePicture.setText("开始采集");
|
capturePicture.setText("开始采集");
|
||||||
capturePicture.setChecked(false);
|
capturePicture.setChecked(false);
|
||||||
radioBtnAuto.setTextColor(Color.parseColor("#FFEB3B"));
|
|
||||||
radioBtnHand.setTextColor(Color.WHITE);
|
|
||||||
radioBtnAutoSec.setTextColor(Color.WHITE);
|
|
||||||
stopTimer();
|
stopTimer();
|
||||||
break;
|
break;
|
||||||
case R.id.radio_btn_auto_sec://自动2 秒
|
case R.id.radio_btn_auto_sec://自动2 秒
|
||||||
radioPicture = 3;
|
radioPicture = 3;
|
||||||
capturePicture.setText("开始采集");
|
capturePicture.setText("开始采集");
|
||||||
capturePicture.setChecked(false);
|
capturePicture.setChecked(false);
|
||||||
radioBtnAutoSec.setTextColor(Color.parseColor("#FFEB3B"));
|
stopTimer();
|
||||||
radioBtnAuto.setTextColor(Color.WHITE);
|
break;
|
||||||
radioBtnHand.setTextColor(Color.WHITE);
|
case R.id.radio_btn_half_sec://自动0.5 秒
|
||||||
|
radioPicture = 4;
|
||||||
|
capturePicture.setText("开始采集");
|
||||||
|
capturePicture.setChecked(false);
|
||||||
stopTimer();
|
stopTimer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -265,8 +298,12 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
ivLocation = findViewById(R.id.iv_location);
|
ivLocation = findViewById(R.id.iv_location);
|
||||||
ivLocation.setOnClickListener(this);
|
ivLocation.setOnClickListener(this);
|
||||||
camera = findViewById(R.id.camera);
|
camera = findViewById(R.id.camera);
|
||||||
|
CameraOptions cameraOptions = camera.getCameraOptions();
|
||||||
|
camera.setSnapshotMaxWidth(1920);
|
||||||
|
camera.setSnapshotMaxHeight(1440);
|
||||||
camera.setOnClickListener(this);
|
camera.setOnClickListener(this);
|
||||||
tvTitle = findViewById(R.id.tv_title);
|
tvTitle = findViewById(R.id.tv_title);
|
||||||
|
tvConvert = findViewById(R.id.tv_convert);
|
||||||
imageView = findViewById(R.id.image_view);
|
imageView = findViewById(R.id.image_view);
|
||||||
imageView.setOnClickListener(this);
|
imageView.setOnClickListener(this);
|
||||||
capturePicture = findViewById(R.id.capture_picture);
|
capturePicture = findViewById(R.id.capture_picture);
|
||||||
@@ -311,8 +348,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
camera.addCameraListener(new CameraListener() {
|
camera.addCameraListener(new CameraListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPictureTaken(@NonNull PictureResult result) {
|
public void onPictureTaken(@NonNull PictureResult result) {
|
||||||
if (result.getData() != null && result != null && result.getData().length > 0) {
|
if (result != null && result.getData() != null && result.getData().length > 0) {
|
||||||
super.onPictureTaken(result);
|
super.onPictureTaken(result);
|
||||||
|
System.out.println("收到拍照按钮jieguo:"+result.getSize().toString());
|
||||||
isBack = true;
|
isBack = true;
|
||||||
// 如果当前手机是竖向,则不
|
// 如果当前手机是竖向,则不
|
||||||
if (isOration) {
|
if (isOration) {
|
||||||
@@ -331,13 +369,23 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
isOration = false;
|
isOration = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = new File(finalVideoPath);
|
File file = new File(finalVideoPath);
|
||||||
result.toFile(file, new FileCallback() {
|
synchronized (finalVideoPath) {
|
||||||
@Override
|
// 生成点位marker
|
||||||
public void onFileReady(@Nullable File file) {
|
initMarker(booleanExtra);
|
||||||
UserApplication.fixedThreadPool.execute(new Jpg2WebpRunnable(/*result, */file, 0, booleanExtra));
|
result.toFile(file, new FileCallback() {
|
||||||
}
|
@Override
|
||||||
});
|
public void onFileReady(@Nullable File file) {
|
||||||
|
int currentIndex = videoIndex = Integer.parseInt(file.getName().replace(".webp", ""));
|
||||||
|
// 下一张照片的路径
|
||||||
|
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".webp";
|
||||||
|
tvTitle.setText("拍摄成功:" + (videoIndex + 1));
|
||||||
|
|
||||||
|
UserApplication.fixedThreadPool.execute(new Jpg2WebpRunnable(/*result, */file, 0, booleanExtra, currentIndex));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
isBack = false;
|
isBack = false;
|
||||||
if (isOration) {
|
if (isOration) {
|
||||||
@@ -360,7 +408,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (radioPicture == 1) {
|
if (radioPicture == 1) {
|
||||||
camera.takePicture();
|
camera.takePictureSnapshot();
|
||||||
} else {
|
} else {
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
message.what = 0x101;
|
message.what = 0x101;
|
||||||
@@ -368,47 +416,57 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Button btnSetting = findViewById(R.id.btn_setting);
|
||||||
|
btnSetting.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class Jpg2WebpRunnable implements Runnable {
|
class Jpg2WebpRunnable implements Runnable {
|
||||||
//private PictureResult pictureResult;
|
//private PictureResult pictureResult;
|
||||||
private File file;
|
private File file;
|
||||||
private int count;
|
private int count;/*线程重复执行的次数*/
|
||||||
private boolean isBoolean;
|
private boolean isBoolean;
|
||||||
|
private int index;
|
||||||
// 该转换执行次数,如果连续3次执行失败,则不再转换
|
// 该转换执行次数,如果连续3次执行失败,则不再转换
|
||||||
|
|
||||||
public Jpg2WebpRunnable(/*PictureResult pictureResult,*/ File file, int count, boolean isBoolean) {
|
public Jpg2WebpRunnable(/*PictureResult pictureResult,*/ File file, int count, boolean isBoolean, int index/*照片的索引*/) {
|
||||||
//this.pictureResult = pictureResult;
|
//this.pictureResult = pictureResult;
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
this.isBoolean = isBoolean;
|
this.isBoolean = isBoolean;
|
||||||
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (file.exists() && file != null) {
|
if (file.exists() && file != null) {
|
||||||
initWeb(file, count, isBoolean);
|
// if (initWeb(file, count, isBoolean, index)) {
|
||||||
if (count <= 0) { // 不是重新转换webp流程
|
initMarkerPaper(index);
|
||||||
runOnUiThread(new Runnable() {
|
if (PicturesActivity.this != null&&handler != null) {
|
||||||
@SuppressLint("SetTextI18n")
|
if (radioPicture == 1) {
|
||||||
@Override
|
Message message = new Message();
|
||||||
public void run() {
|
message.what = 0x103;
|
||||||
if (PicturesActivity.this != null) {
|
handler.sendMessage(message);
|
||||||
if (file.exists()) {
|
} else {
|
||||||
initMarker(isBoolean);
|
Message message = new Message();
|
||||||
videoIndex = Integer.parseInt(file.getName().replace(".webp", ""));
|
message.what = 0x104;
|
||||||
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".webp";
|
message.arg1 = index;
|
||||||
tvTitle.setText("保存成功:" + (videoIndex + 1));
|
handler.sendMessage(message);
|
||||||
}
|
}
|
||||||
if (radioPicture == 1 && handler != null) {
|
|
||||||
Message message = new Message();
|
|
||||||
message.what = 0x103;
|
|
||||||
handler.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
// runOnUiThread(new Runnable() {
|
||||||
|
// @SuppressLint("SetTextI18n")
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
isBack = false;
|
isBack = false;
|
||||||
if (isOration) {
|
if (isOration) {
|
||||||
@@ -428,7 +486,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initWeb(File file, int count, boolean isBoolean) {
|
private boolean initWeb(File file, int count, boolean isBoolean, int index) {
|
||||||
try {
|
try {
|
||||||
count++;
|
count++;
|
||||||
WebPNative webPNative = new WebPNative();
|
WebPNative webPNative = new WebPNative();
|
||||||
@@ -437,7 +495,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
if (!bitmap.isRecycled()) {
|
if (!bitmap.isRecycled()) {
|
||||||
bitmap.recycle();
|
bitmap.recycle();
|
||||||
}
|
}
|
||||||
initMarkerPaper();
|
initMarkerPaper(index);
|
||||||
|
return true;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
//如果是写入txt记录失败,上传失败记录
|
//如果是写入txt记录失败,上传失败记录
|
||||||
@@ -447,9 +506,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
UMCrashManager.reportCrash(this, e);
|
UMCrashManager.reportCrash(this, e);
|
||||||
if (count < 3) {
|
if (count < 3) {
|
||||||
//当尝试次数小于3次,则加入转换队列,尝试重新转换
|
//当尝试次数小于3次,则加入转换队列,尝试重新转换
|
||||||
UserApplication.fixedThreadPool.execute(new Jpg2WebpRunnable(/*result, */file, count, isBoolean));
|
UserApplication.fixedThreadPool.execute(new Jpg2WebpRunnable(/*result, */file, count, isBoolean, index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initLine() {
|
private void initLine() {
|
||||||
@@ -552,22 +612,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
picturesBuilder.append("userId:").append(Constant.USHERED).append(",");
|
picturesBuilder.append("userId:").append(Constant.USHERED).append(",");
|
||||||
}
|
}
|
||||||
camera.setMode(Mode.PICTURE);
|
camera.setMode(Mode.PICTURE);
|
||||||
|
initCameraSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.btn_stop_picture:
|
case R.id.btn_stop_picture:
|
||||||
if (isOration) {
|
exit();
|
||||||
stopTimer();
|
|
||||||
}
|
|
||||||
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了结束采集 ,");
|
|
||||||
Intent intent = new Intent();
|
|
||||||
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
|
|
||||||
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
|
||||||
intent.putExtra(Constant.INTENT_BOOLEAN,booleanExtra);
|
|
||||||
setResult(0x111, intent);
|
|
||||||
PicturesActivity.this.finish();
|
|
||||||
break;
|
break;
|
||||||
case R.id.image_view:
|
case R.id.image_view:
|
||||||
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了切换的窗口 ,");
|
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了切换的窗口 ,");
|
||||||
@@ -577,8 +629,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
break;
|
break;
|
||||||
case R.id.btn_switch:
|
case R.id.btn_switch:
|
||||||
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了切换按钮 ,");
|
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了切换按钮 ,");
|
||||||
v.setEnabled(false);
|
|
||||||
handler.sendEmptyMessageDelayed(0x102, 2000);// 利用handler延迟发送更改状态信息
|
|
||||||
benSwitch();
|
benSwitch();
|
||||||
break;
|
break;
|
||||||
case R.id.iv_zoom_add://放大
|
case R.id.iv_zoom_add://放大
|
||||||
@@ -682,6 +732,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
ivZoomDel.setVisibility(View.GONE);
|
ivZoomDel.setVisibility(View.GONE);
|
||||||
ivLocation.setVisibility(View.GONE);
|
ivLocation.setVisibility(View.GONE);
|
||||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
|
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
|
||||||
|
// 道路水平方向图标显示
|
||||||
|
ivPicRoadImage.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//大图
|
//大图
|
||||||
@@ -691,6 +743,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
ivZoomDel.setVisibility(View.VISIBLE);
|
ivZoomDel.setVisibility(View.VISIBLE);
|
||||||
ivLocation.setVisibility(View.VISIBLE);
|
ivLocation.setVisibility(View.VISIBLE);
|
||||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
||||||
|
// 道路水平方向图标显示
|
||||||
|
ivPicRoadImage.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -704,6 +758,42 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
camera.open();
|
camera.open();
|
||||||
tvMapView.onResume();
|
tvMapView.onResume();
|
||||||
|
camera.setPreviewFrameRate(FRAMENESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置相机的拍照size
|
||||||
|
* */
|
||||||
|
private void initCameraSize() {
|
||||||
|
SizeSelector maxWidth = SizeSelectors.maxWidth(1920);
|
||||||
|
SizeSelector maxHeight = SizeSelectors.maxHeight(1440);
|
||||||
|
SizeSelector minWidth = SizeSelectors.minWidth(1440);
|
||||||
|
SizeSelector minHeight = SizeSelectors.minHeight(1080);
|
||||||
|
SizeSelector maxDimensions = SizeSelectors.and(maxWidth, maxHeight); // Matches sizes bigger than 1000x2000.
|
||||||
|
SizeSelector minDimensions = SizeSelectors.and(minWidth, minHeight); // Matches sizes bigger than 1000x2000.
|
||||||
|
SizeSelector verticalRatio = SizeSelectors.aspectRatio(AspectRatio.of(1080, 1920), 0.2f); // Matches 1:1 sizes.
|
||||||
|
SizeSelector horzentalRatio = SizeSelectors.aspectRatio(AspectRatio.of(1920, 1080), 0.2f); // Matches 1:1 sizes.
|
||||||
|
|
||||||
|
SizeSelector result = SizeSelectors.or(
|
||||||
|
SizeSelectors.and(verticalRatio, maxDimensions, minDimensions), // Try to match both constraints
|
||||||
|
SizeSelectors.and(horzentalRatio, maxDimensions, minDimensions), // Try to match both constraints
|
||||||
|
verticalRatio, // If none is found, at least try to match the aspect ratio
|
||||||
|
horzentalRatio, // If none is found, at least try to match the aspect ratio
|
||||||
|
SizeSelectors.biggest() // If none is found, take the biggest
|
||||||
|
);
|
||||||
|
camera.setPictureSize(result);
|
||||||
|
camera.setPreviewStreamSize(result);
|
||||||
|
/**
|
||||||
|
* app:cameraPictureSizeAspectRatio="1920:1080"
|
||||||
|
* app:cameraPictureSizeBiggest="true"
|
||||||
|
* app:cameraPictureSizeMaxArea="3686400"
|
||||||
|
* app:cameraPictureSizeMaxHeight="1920"
|
||||||
|
* app:cameraPictureSizeMaxWidth="1920"
|
||||||
|
* app:cameraPictureSizeMinArea="1166400"
|
||||||
|
* app:cameraPictureSizeMinHeight="1080"
|
||||||
|
* app:cameraPictureSizeMinWidth="1080"
|
||||||
|
* app:cameraPictureSizeSmallest="true"
|
||||||
|
* */
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -764,6 +854,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
if (EventBus.getDefault().isRegistered(this)) {
|
if (EventBus.getDefault().isRegistered(this)) {
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
}
|
}
|
||||||
|
if (gpsUtils!=null) {
|
||||||
|
gpsUtils.unRegisterAllListener();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
@@ -782,8 +875,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void initMarkerPaper() {
|
public void initMarkerPaper(int index) {
|
||||||
int endVideoIndex = videoIndex == -1 ? 0 : (videoIndex + 1);
|
int endVideoIndex = index == -1 ? 0 : index;
|
||||||
if (startVideoIndex == endVideoIndex) {
|
if (startVideoIndex == endVideoIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -792,8 +885,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(formatter.format(new Date())); // 记录当前时
|
sb.append(formatter.format(new Date())); // 记录当前时
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(videoIndex == -1 ? 0 : (videoIndex + 1));//個數
|
sb.append(index == -1 ? 0 : index);//個數
|
||||||
startVideoIndex = videoIndex == -1 ? 0 : (videoIndex + 1);
|
startVideoIndex = index == -1 ? 0 : index;
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(Constant.currentLocation.getLatitude());
|
sb.append(Constant.currentLocation.getLatitude());
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
@@ -866,17 +959,25 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSpeedLimitTips = false;
|
||||||
private void initSpeed() {
|
private void initSpeed() {
|
||||||
|
if (isSpeedLimitTips == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
float speed = Constant.currentLocation.getSpeed();//米/秒
|
float speed = Constant.currentLocation.getSpeed();//米/秒
|
||||||
if (speed != 0) {
|
if (speed != 0) {
|
||||||
float a = (speed * 3600 / 1000);//km/h
|
float a = (speed * 3600 / 1000);//km/h
|
||||||
if (type == 3) {
|
if (type == 3) {
|
||||||
if (a > 40) {//40千米/h
|
if (a > 40) {//40千米/h
|
||||||
|
systemTTS.stopSpeak();
|
||||||
systemTTS.playText("您已超速");
|
systemTTS.playText("您已超速");
|
||||||
|
isSpeedLimitTips=true;
|
||||||
}
|
}
|
||||||
} else if (type == 4) {
|
} else if (type == 4) {
|
||||||
if (a > 80) {//80千米/h
|
if (a > 80) {//80千米/h
|
||||||
|
systemTTS.stopSpeak();
|
||||||
systemTTS.playText("您已超速");
|
systemTTS.playText("您已超速");
|
||||||
|
isSpeedLimitTips=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -888,24 +989,32 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
if (radioPicture == 2) {
|
if (radioPicture == 2) {
|
||||||
double speeds = ((geometry / 1) * 3600 / 1000);
|
double speeds = ((geometry / 1) * 3600 / 1000);
|
||||||
if (speeds > 40) {//40千米/h
|
if (speeds > 40) {//40千米/h
|
||||||
|
systemTTS.stopSpeak();
|
||||||
systemTTS.playText("您已超速");
|
systemTTS.playText("您已超速");
|
||||||
|
isSpeedLimitTips=true;
|
||||||
}
|
}
|
||||||
} else if (radioPicture == 3) {
|
} else if (radioPicture == 3) {
|
||||||
double speeds = ((geometry / 2) * 3600 / 1000);
|
double speeds = ((geometry / 2) * 3600 / 1000);
|
||||||
if (speeds > 40) {//40千米/h
|
if (speeds > 40) {//40千米/h
|
||||||
|
systemTTS.stopSpeak();
|
||||||
systemTTS.playText("您已超速");
|
systemTTS.playText("您已超速");
|
||||||
|
isSpeedLimitTips=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == 4) {
|
} else if (type == 4) {
|
||||||
if (radioPicture == 2) {
|
if (radioPicture == 2) {
|
||||||
double speeds = ((geometry / 1) * 3600 / 1000);
|
double speeds = ((geometry / 1) * 3600 / 1000);
|
||||||
if (speeds > 80) { //80千米/h
|
if (speeds > 80) { //80千米/h
|
||||||
|
systemTTS.stopSpeak();
|
||||||
systemTTS.playText("您已超速");
|
systemTTS.playText("您已超速");
|
||||||
|
isSpeedLimitTips=true;
|
||||||
}
|
}
|
||||||
} else if (radioPicture == 3) {
|
} else if (radioPicture == 3) {
|
||||||
double speeds = ((geometry / 2) * 3600 / 1000);
|
double speeds = ((geometry / 2) * 3600 / 1000);
|
||||||
if (speeds > 80) { //80千米/h
|
if (speeds > 80) { //80千米/h
|
||||||
|
systemTTS.stopSpeak();
|
||||||
systemTTS.playText("您已超速");
|
systemTTS.playText("您已超速");
|
||||||
|
isSpeedLimitTips=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -916,9 +1025,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (isOration) {
|
|
||||||
stopTimer();
|
|
||||||
}
|
|
||||||
String tvIndex = tvTitle.getText().toString();
|
String tvIndex = tvTitle.getText().toString();
|
||||||
String message = null;
|
String message = null;
|
||||||
if (tvIndex.equals("")) {
|
if (tvIndex.equals("")) {
|
||||||
@@ -930,17 +1036,55 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
MessageDialog.show(this, "提示", message, "是", "否").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
MessageDialog.show(this, "提示", message, "是", "否").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了结束采集 ,");
|
baseDialog.doDismiss();
|
||||||
Intent intent = new Intent();
|
exit();
|
||||||
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
|
|
||||||
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
|
||||||
setResult(0x111, intent);
|
|
||||||
PicturesActivity.this.finish();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void exit() {
|
||||||
|
Observable.create(new ObservableOnSubscribe<String>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||||
|
stopTimer();
|
||||||
|
handler.removeMessages(0x101); // 如果handler中存在缓存的拍摄请求,也清空
|
||||||
|
picturesBuilder.append(TimestampUtil.time()).append(",").append("onClick 点击了结束采集 ,");
|
||||||
|
emitter.onComplete();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.delay(2, TimeUnit.SECONDS)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
showLoadingDialog("正在保存照片...");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
Intent intent = new Intent();
|
||||||
|
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
|
||||||
|
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
|
||||||
|
setResult(0x111, intent);
|
||||||
|
PicturesActivity.this.finish();
|
||||||
|
handler = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 腾讯轨迹点
|
* 腾讯轨迹点
|
||||||
*/
|
*/
|
||||||
@@ -974,12 +1118,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
timerTask = new TimerTask() {
|
timerTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (radioPicture == 1) {
|
if (handler!=null) {
|
||||||
camera.takePicture();
|
if (radioPicture == 1) {
|
||||||
} else {
|
camera.takePictureSnapshot();
|
||||||
Message message = new Message();
|
} else {
|
||||||
message.what = 0x101;
|
Message message = new Message();
|
||||||
handler.sendMessage(message);
|
message.what = 0x101;
|
||||||
|
handler.sendMessage(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -990,6 +1136,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
timer.schedule(timerTask, 0, 1000);
|
timer.schedule(timerTask, 0, 1000);
|
||||||
} else if (radioPicture == 3) {
|
} else if (radioPicture == 3) {
|
||||||
timer.schedule(timerTask, 0, 2000);
|
timer.schedule(timerTask, 0, 2000);
|
||||||
|
} else if (radioPicture == 4) {
|
||||||
|
timer.schedule(timerTask, 0, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1003,4 +1151,12 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
|||||||
timerTask = null;
|
timerTask = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置当前界面亮度
|
||||||
|
private void setWindowBrightness(int brightness) {
|
||||||
|
// Window window = getWindow();
|
||||||
|
// WindowManager.LayoutParams lp = window.getAttributes();
|
||||||
|
// lp.screenBrightness = brightness / 255.0f;
|
||||||
|
// window.setAttributes(lp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.navinfo.outdoor.activity;
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@@ -22,7 +25,10 @@ import com.github.lazylibrary.util.FileUtils;
|
|||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||||
|
import com.kongzue.dialog.interfaces.OnShowListener;
|
||||||
import com.kongzue.dialog.util.BaseDialog;
|
import com.kongzue.dialog.util.BaseDialog;
|
||||||
|
import com.kongzue.dialog.util.DialogSettings;
|
||||||
|
import com.kongzue.dialog.v3.CustomDialog;
|
||||||
import com.kongzue.dialog.v3.MessageDialog;
|
import com.kongzue.dialog.v3.MessageDialog;
|
||||||
import com.lzy.okgo.model.HttpParams;
|
import com.lzy.okgo.model.HttpParams;
|
||||||
import com.lzy.okgo.model.Progress;
|
import com.lzy.okgo.model.Progress;
|
||||||
@@ -31,6 +37,7 @@ import com.navinfo.outdoor.api.Constant;
|
|||||||
import com.navinfo.outdoor.base.BaseActivity;
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
import com.navinfo.outdoor.bean.CityBean;
|
import com.navinfo.outdoor.bean.CityBean;
|
||||||
import com.navinfo.outdoor.bean.JsonBean;
|
import com.navinfo.outdoor.bean.JsonBean;
|
||||||
|
import com.navinfo.outdoor.bean.MessageCodeBean;
|
||||||
import com.navinfo.outdoor.bean.UserBean;
|
import com.navinfo.outdoor.bean.UserBean;
|
||||||
import com.navinfo.outdoor.http.Callback;
|
import com.navinfo.outdoor.http.Callback;
|
||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
@@ -49,7 +56,9 @@ import java.text.DateFormat;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -68,6 +77,9 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
|||||||
private StringBuilder userBuilder;
|
private StringBuilder userBuilder;
|
||||||
private String region_text;
|
private String region_text;
|
||||||
private SharedPreferences spNavinfo;
|
private SharedPreferences spNavinfo;
|
||||||
|
private Button btnPhoneEdit;
|
||||||
|
private String sessionId, updatePhone;
|
||||||
|
private CountDownTimer timer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
@@ -124,6 +136,8 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
|||||||
etPhone = findViewById(R.id.et_phone);
|
etPhone = findViewById(R.id.et_phone);
|
||||||
etPhone.setEnabled(false);
|
etPhone.setEnabled(false);
|
||||||
etPhone.setOnClickListener(this);
|
etPhone.setOnClickListener(this);
|
||||||
|
btnPhoneEdit = findViewById(R.id.btn_phone_edit);
|
||||||
|
btnPhoneEdit.setOnClickListener(this);
|
||||||
etQq = findViewById(R.id.edit_qq);
|
etQq = findViewById(R.id.edit_qq);
|
||||||
etQq.setOnClickListener(this);
|
etQq.setOnClickListener(this);
|
||||||
etMailbox = findViewById(R.id.edit_mailbox);
|
etMailbox = findViewById(R.id.edit_mailbox);
|
||||||
@@ -169,16 +183,6 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
|||||||
Intent gatheringIntent = new Intent(this, FragmentManagement.class);
|
Intent gatheringIntent = new Intent(this, FragmentManagement.class);
|
||||||
gatheringIntent.putExtra("tag", 24);
|
gatheringIntent.putExtra("tag", 24);
|
||||||
startActivity(gatheringIntent);
|
startActivity(gatheringIntent);
|
||||||
|
|
||||||
/* if (Constant.AUDIOTAPES == -1) {
|
|
||||||
ToastUtils.Message(UserActivity.this,"请先实名认证");
|
|
||||||
} else if (Constant.AUDIOTAPES == 1) {//认证通过
|
|
||||||
Intent gatheringIntent = new Intent(this, FragmentManagement.class);
|
|
||||||
gatheringIntent.putExtra("tag", 24);
|
|
||||||
startActivity(gatheringIntent);
|
|
||||||
} else if (Constant.AUDIOTAPES == 0) {
|
|
||||||
ToastUtils.Message(this,Constant.AUDITING + "");
|
|
||||||
}*/
|
|
||||||
break;
|
break;
|
||||||
case R.id.btn_attestations:
|
case R.id.btn_attestations:
|
||||||
userBuilder.append(TimestampUtil.time()).append(",").append("点击了去认证的返回 ,");
|
userBuilder.append(TimestampUtil.time()).append(",").append("点击了去认证的返回 ,");
|
||||||
@@ -204,9 +208,192 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
|||||||
userBuilder.append(TimestampUtil.time()).append(",").append("点击了微信 去提交的按钮 ,");
|
userBuilder.append(TimestampUtil.time()).append(",").append("点击了微信 去提交的按钮 ,");
|
||||||
ToastUtils.Message(UserActivity.this,"此功能未开通");
|
ToastUtils.Message(UserActivity.this,"此功能未开通");
|
||||||
break;
|
break;
|
||||||
|
case R.id.btn_phone_edit:
|
||||||
|
// 用户修改手机号
|
||||||
|
View dialogRootView = LayoutInflater.from(UserActivity.this).inflate(R.layout.edit_phone, null);
|
||||||
|
MessageDialog.show(UserActivity.this, "修改手机号", "")
|
||||||
|
.setCustomView(dialogRootView)
|
||||||
|
.setOnShowListener(new OnShowListener() {
|
||||||
|
@Override
|
||||||
|
public void onShow(BaseDialog dialog) {
|
||||||
|
EditText edtPhoneNew = dialogRootView.findViewById(R.id.edt_phone_new);
|
||||||
|
EditText edtConfirmCode = dialogRootView.findViewById(R.id.edt_phone_confirm_code);
|
||||||
|
TextView btnConfirmCode = dialogRootView.findViewById(R.id.tv_confirm_code);
|
||||||
|
btnConfirmCode.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
// 获取手机验证码
|
||||||
|
EditText edtPhoneNew = dialogRootView.findViewById(R.id.edt_phone_new);
|
||||||
|
EditText edtConfirmCode = dialogRootView.findViewById(R.id.edt_phone_confirm_code);
|
||||||
|
TextView btnConfirmCode = dialogRootView.findViewById(R.id.tv_confirm_code);
|
||||||
|
String newPhone=edtPhoneNew.getText().toString();
|
||||||
|
if (checkPhoneNum(newPhone)) {
|
||||||
|
// 发送请求拉取新的验证码
|
||||||
|
getConfirmCode(UserActivity.this, newPhone, btnConfirmCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Button btnFinish = dialogRootView.findViewById(R.id.btn_finish);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setCancelable(true)
|
||||||
|
.setOkButton("确定", new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
EditText edtPhoneNew = dialogRootView.findViewById(R.id.edt_phone_new);
|
||||||
|
EditText edtConfirmCode = dialogRootView.findViewById(R.id.edt_phone_confirm_code);
|
||||||
|
TextView btnConfirmCode = dialogRootView.findViewById(R.id.tv_confirm_code);
|
||||||
|
String newPhone=edtPhoneNew.getText().toString();
|
||||||
|
String confirmCode = edtConfirmCode.getText().toString().trim();
|
||||||
|
// 检查是否获取过验证码
|
||||||
|
if (sessionId == null) {
|
||||||
|
Toast.makeText(UserActivity.this, "请先获取验证码", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!checkPhoneNum(updatePhone)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (confirmCode.isEmpty()) {
|
||||||
|
Toast.makeText(UserActivity.this, "请输入验证码", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpParams httpParams = new HttpParams();
|
||||||
|
httpParams.put("pid", Constant.USHERED);
|
||||||
|
httpParams.put("datetime", System.currentTimeMillis());
|
||||||
|
httpParams.put("mobile", updatePhone);
|
||||||
|
httpParams.put("sessionId", sessionId);
|
||||||
|
httpParams.put("code", confirmCode);
|
||||||
|
showLoadingDialog();
|
||||||
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
|
.time(30)
|
||||||
|
.Builder(UserActivity.this)
|
||||||
|
.url(HttpInterface.UPDATE_PHONE_NUM_URL)
|
||||||
|
.cls(MessageCodeBean.class)
|
||||||
|
.token(null)
|
||||||
|
.params(httpParams);
|
||||||
|
okGoBuilder.postRequest(new UploadCallBack<MessageCodeBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(MessageCodeBean response, int id) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
if (response.getCode() == 200) {
|
||||||
|
// 手机号修改成功
|
||||||
|
ToastUtils.Message(UserActivity.this, "手机号修改成功!");
|
||||||
|
Constant.MOBILE = updatePhone;
|
||||||
|
etPhone.setText(updatePhone);
|
||||||
|
baseDialog.doDismiss();
|
||||||
|
} else {
|
||||||
|
// 手机号修改失败,提示用户
|
||||||
|
ToastUtils.Message(UserActivity.this, response.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void uploadProgress(Progress progress) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e, int id) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
String message = e.getMessage();
|
||||||
|
assert message != null;
|
||||||
|
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||||
|
ToastUtils.Message(UserActivity.this, "请求超时");
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(UserActivity.this, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setCancelButton("取消", new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkPhoneNum(String newPhone) {
|
||||||
|
if (newPhone == null || newPhone.length()!=11 || !newPhone.startsWith("1")) {
|
||||||
|
Toast.makeText(UserActivity.this, "请检查手机号是否正确!", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (newPhone.equals(Constant.MOBILE)) {
|
||||||
|
Toast.makeText(UserActivity.this, "与原有手机号相同!", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getConfirmCode(Activity context, String phone, TextView btnPhoneConfirmCode) {
|
||||||
|
HttpParams httpParams = new HttpParams();
|
||||||
|
httpParams.put("mobile", phone);
|
||||||
|
httpParams.put("type", 3);
|
||||||
|
sessionId = null;
|
||||||
|
updatePhone = null;
|
||||||
|
showLoadingDialog();
|
||||||
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
|
.time(30)
|
||||||
|
.Builder(context)
|
||||||
|
.url(HttpInterface.USER_MESSAGE)
|
||||||
|
.cls(MessageCodeBean.class)
|
||||||
|
.token(null)
|
||||||
|
.params(httpParams);
|
||||||
|
okGoBuilder.getRequest(new Callback<MessageCodeBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(MessageCodeBean response, int id) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
if (response.getCode() == 200) {
|
||||||
|
sessionId = response.getBody();
|
||||||
|
updatePhone = phone; // 记录用户获取验证码的手机号
|
||||||
|
registerNote(btnPhoneConfirmCode);
|
||||||
|
ToastUtils.Message(context, "验证码已发送");
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(context, response.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e, int id) {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
String message = e.getMessage();
|
||||||
|
assert message != null;
|
||||||
|
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||||
|
ToastUtils.Message(context, "请求超时");
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(context, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerNote(TextView btnConfirm) {
|
||||||
|
if (timer != null) {
|
||||||
|
timer.cancel();
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
btnConfirm.setEnabled(false);
|
||||||
|
timer = new CountDownTimer(60 * 1000, 1000) {
|
||||||
|
@Override
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
btnConfirm.setText(millisUntilFinished / 1000 + "秒后重新获取验证码");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
btnConfirm.setEnabled(true);
|
||||||
|
btnConfirm.setText("重新获取");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
private void netWork() {
|
private void netWork() {
|
||||||
userBuilder.append(TimestampUtil.time()).append(",").append("点击了保存的按钮 ,");
|
userBuilder.append(TimestampUtil.time()).append(",").append("点击了保存的按钮 ,");
|
||||||
String userphone = etPhone.getText().toString().trim();
|
String userphone = etPhone.getText().toString().trim();
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
|||||||
import com.umeng.umcrash.UMCrash;
|
import com.umeng.umcrash.UMCrash;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 常量
|
* 常量
|
||||||
@@ -173,7 +175,6 @@ public class Constant {
|
|||||||
public static final String INTENT_DETAIL = "Detail";//poiEntity 的detail
|
public static final String INTENT_DETAIL = "Detail";//poiEntity 的detail
|
||||||
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
|
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
|
||||||
public static TencentMap.OnMarkerClickListener markerClickListener = null;
|
public static TencentMap.OnMarkerClickListener markerClickListener = null;
|
||||||
public static final String NAVIN_FO = "12.10";//版本日期
|
|
||||||
|
|
||||||
//marker
|
//marker
|
||||||
public static final BitmapDescriptor MARKER_CHARGE_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_show);
|
public static final BitmapDescriptor MARKER_CHARGE_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_show);
|
||||||
@@ -224,4 +225,54 @@ public class Constant {
|
|||||||
public static String REGION_YUE_PHONE = "892781071";
|
public static String REGION_YUE_PHONE = "892781071";
|
||||||
public static String REGION_YUN_NAME = "云贵-地图寻宝群";
|
public static String REGION_YUN_NAME = "云贵-地图寻宝群";
|
||||||
public static String REGION_YUN_PHONE = "284447253";
|
public static String REGION_YUN_PHONE = "284447253";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取信号强度描述文字
|
||||||
|
* */
|
||||||
|
public static String getRssiDesStr(int rssi) {
|
||||||
|
if (rssi == 0) {
|
||||||
|
return "无信号";
|
||||||
|
} else if (rssi == 1) {
|
||||||
|
return "弱";
|
||||||
|
} else if (rssi == 2) {
|
||||||
|
return "中";
|
||||||
|
} else if (rssi == 3) {
|
||||||
|
return "强";
|
||||||
|
}
|
||||||
|
return "无信号"; // 默认为无信号
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<String> submitIdSet = new HashSet<>();
|
||||||
|
public static final String SUBMIT_TOAST_MSG= "当前POI已经在提交列表中,无需重复提交!";
|
||||||
|
public static final long DEFAULT_CUT_SIZE = 5*1024*1024; // 文件切分默认大小为5MB
|
||||||
|
public static final int DEFAULT_TIME_OUT = 300; // 默认http超时时间设置为300秒
|
||||||
|
|
||||||
|
public static void clearLoginInfo() {
|
||||||
|
ACCESS_TOKEN = null;
|
||||||
|
REFRESH_TOKEN = null;
|
||||||
|
USHERED = null;
|
||||||
|
USER_NAME = null;//登录账号/修改账号/注册
|
||||||
|
PASS_WORD = null;//登录密码/修改密码/注册密码
|
||||||
|
AUDITING = null;//身份证审核信息
|
||||||
|
AUDIOTAPES = -1;//身份证审核状态 //0:不通過,1:通過,-1:待审核
|
||||||
|
ID_NUM = null;//身份证号
|
||||||
|
NAME = null;//身份证姓名
|
||||||
|
ID_NUMBER = null;//身份证号
|
||||||
|
BACKGROUND = null;//银行卡号
|
||||||
|
BACKGROUND_NAME = null;//银行卡名称
|
||||||
|
SEX = -1;//性别
|
||||||
|
QQ = null;
|
||||||
|
WCHAR = null;
|
||||||
|
MOBILE = null;//手机号
|
||||||
|
FILE_PATH = null;//银行卡图片途径
|
||||||
|
LEVEL = 0;//用户等级
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导航方式
|
||||||
|
public enum NAV_TYPE {
|
||||||
|
CAR, RIDE, WALK
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NAV_TYPE currentNaviType; // 当前的导航方式
|
||||||
|
public static boolean NAV_NEAREST_POI = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import android.widget.RemoteViews;
|
|||||||
|
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
|
|
||||||
|
import com.elvishew.xlog.LogLevel;
|
||||||
|
import com.elvishew.xlog.XLog;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.lzy.okgo.OkGo;
|
import com.lzy.okgo.OkGo;
|
||||||
import com.lzy.okgo.cache.CacheEntity;
|
import com.lzy.okgo.cache.CacheEntity;
|
||||||
@@ -26,6 +28,9 @@ import com.navinfo.outdoor.activity.WebActivity;
|
|||||||
import com.navinfo.outdoor.bean.NotificationBean;
|
import com.navinfo.outdoor.bean.NotificationBean;
|
||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
import com.navinfo.outdoor.util.TalentLocationUtils;
|
import com.navinfo.outdoor.util.TalentLocationUtils;
|
||||||
|
import com.tencent.map.navi.TencentNavi;
|
||||||
|
import com.tencent.navi.surport.utils.DeviceUtils;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer;
|
||||||
import com.umeng.commonsdk.UMConfigure;
|
import com.umeng.commonsdk.UMConfigure;
|
||||||
import com.umeng.message.IUmengRegisterCallback;
|
import com.umeng.message.IUmengRegisterCallback;
|
||||||
import com.umeng.message.MsgConstant;
|
import com.umeng.message.MsgConstant;
|
||||||
@@ -59,6 +64,16 @@ public class UserApplication extends Application {
|
|||||||
TalentLocationUtils.getInstance(this).startLocation(this);
|
TalentLocationUtils.getInstance(this).startLocation(this);
|
||||||
//创建一个线程池
|
//创建一个线程池
|
||||||
fixedThreadPool = Executors.newSingleThreadExecutor(); // 使用单线程线程池
|
fixedThreadPool = Executors.newSingleThreadExecutor(); // 使用单线程线程池
|
||||||
|
|
||||||
|
TencentMapInitializer.setAgreePrivacy(true);
|
||||||
|
TencentNavi.setUserAgreePrivacy(true);
|
||||||
|
// 初始化腾讯导航
|
||||||
|
TencentNavi.Config config = new TencentNavi.Config();
|
||||||
|
// 记录设备标识,反馈导航问题时请提供该设备标识以及发生问题的时间
|
||||||
|
String deviceID = DeviceUtils.getImei(getApplicationContext());
|
||||||
|
config.setDeviceId(deviceID);
|
||||||
|
// 或者设置开发者自己的的设备号config.setDeviceId(xxxxxxxx);
|
||||||
|
TencentNavi.init(this, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserApplication getUserApplication() {
|
public static UserApplication getUserApplication() {
|
||||||
@@ -161,7 +176,7 @@ public class UserApplication extends Application {
|
|||||||
//设置公共请求头
|
//设置公共请求头
|
||||||
.addCommonHeaders(headers)
|
.addCommonHeaders(headers)
|
||||||
//全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0;
|
//全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0;
|
||||||
.setRetryCount(0);
|
.setRetryCount(3);
|
||||||
StrictMode.VmPolicy.Builder picBuilder = new StrictMode.VmPolicy.Builder();
|
StrictMode.VmPolicy.Builder picBuilder = new StrictMode.VmPolicy.Builder();
|
||||||
StrictMode.setVmPolicy(picBuilder.build());
|
StrictMode.setVmPolicy(picBuilder.build());
|
||||||
picBuilder.detectFileUriExposure();
|
picBuilder.detectFileUriExposure();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.github.lazylibrary.util.StringUtils;
|
||||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.navinfo.outdoor.activity.WebActivity;
|
import com.navinfo.outdoor.activity.WebActivity;
|
||||||
@@ -80,6 +81,10 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showLoadingDialog() {
|
public void showLoadingDialog() {
|
||||||
|
showLoadingDialog(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showLoadingDialog(String msg) {
|
||||||
if (alertDialog!=null) {
|
if (alertDialog!=null) {
|
||||||
alertDialog.dismiss();
|
alertDialog.dismiss();
|
||||||
}
|
}
|
||||||
@@ -91,6 +96,10 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
//loading样式
|
//loading样式
|
||||||
View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
|
View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
|
||||||
|
TextView tv = view.findViewById(R.id.progressBar_tx);
|
||||||
|
if (!StringUtils.isBlank(msg)) {
|
||||||
|
tv.setText(msg);
|
||||||
|
}
|
||||||
alertDialog.setView(view);
|
alertDialog.setView(view);
|
||||||
alertDialog.setCanceledOnTouchOutside(false);
|
alertDialog.setCanceledOnTouchOutside(false);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.navinfo.outdoor.base;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.lifecycle.DefaultLifecycleObserver;
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
|
||||||
|
import com.tencent.map.navi.car.CarNaviView;
|
||||||
|
import com.tencent.map.ui.NaviView;
|
||||||
|
|
||||||
|
public class NaviLifeCycle implements DefaultLifecycleObserver {
|
||||||
|
private NaviView naviView;
|
||||||
|
|
||||||
|
public NaviLifeCycle(NaviView naviView) {
|
||||||
|
this.naviView = naviView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart(@NonNull LifecycleOwner owner) {
|
||||||
|
DefaultLifecycleObserver.super.onStart(owner);
|
||||||
|
naviView.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(@NonNull LifecycleOwner owner) {
|
||||||
|
DefaultLifecycleObserver.super.onResume(owner);
|
||||||
|
naviView.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause(@NonNull LifecycleOwner owner) {
|
||||||
|
DefaultLifecycleObserver.super.onPause(owner);
|
||||||
|
naviView.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop(@NonNull LifecycleOwner owner) {
|
||||||
|
DefaultLifecycleObserver.super.onStop(owner);
|
||||||
|
naviView.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||||
|
DefaultLifecycleObserver.super.onDestroy(owner);
|
||||||
|
naviView.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,276 @@
|
|||||||
|
package com.navinfo.outdoor.bean;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.lzy.okgo.OkGo;
|
||||||
|
import com.lzy.okgo.cache.CacheEntity;
|
||||||
|
import com.lzy.okgo.cache.CacheMode;
|
||||||
|
import com.lzy.okgo.convert.Converter;
|
||||||
|
import com.lzy.okgo.convert.StringConvert;
|
||||||
|
import com.lzy.okgo.model.HttpHeaders;
|
||||||
|
import com.lzy.okgo.model.HttpParams;
|
||||||
|
import com.lzy.okgo.model.Response;
|
||||||
|
import com.lzy.okgo.request.GetRequest;
|
||||||
|
import com.lzy.okgo.request.PostRequest;
|
||||||
|
import com.lzy.okgo.request.base.Request;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.api.UserApplication;
|
||||||
|
import com.navinfo.outdoor.http.Callback;
|
||||||
|
import com.navinfo.outdoor.http.JsonCallback;
|
||||||
|
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||||
|
import com.navinfo.outdoor.util.Md5Util;
|
||||||
|
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||||
|
import com.navinfo.outdoor.util.ToastUtils;
|
||||||
|
import com.umeng.umcrash.UMCrash;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
|
public class CommonRequestSend<T extends CommonResponseBase> {
|
||||||
|
public void getMethodCommon(Activity mContext, String url, HttpParams params, int timeOut, Callback<CommonResponse<T>> callback, Class<T> tClass) {
|
||||||
|
try {
|
||||||
|
Response<CommonResponse<T>> response = ((GetRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 0, tClass))
|
||||||
|
.adapt()
|
||||||
|
.execute();
|
||||||
|
if (response.code() == 200) {
|
||||||
|
if (response.body().getCode() == 200) {
|
||||||
|
callback.onSuccess(response.body(), 1);
|
||||||
|
} else if (response.body().getCode() == 230){
|
||||||
|
FlushTokenUtil.flushToken(mContext);
|
||||||
|
Toast.makeText(mContext, "token过期,请重新登录后再试...", Toast.LENGTH_LONG).show();
|
||||||
|
Throwable throwable = new Throwable("token过期,请重新登录后再试...");
|
||||||
|
callback.onError(throwable, -1);
|
||||||
|
/*
|
||||||
|
* 友盟+
|
||||||
|
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||||
|
*/
|
||||||
|
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||||
|
} else {
|
||||||
|
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
|
||||||
|
Throwable throwable = new Throwable(response.message());
|
||||||
|
callback.onError(throwable, -2);
|
||||||
|
/*
|
||||||
|
* 友盟+
|
||||||
|
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||||
|
*/
|
||||||
|
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Throwable throwable = e;
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
callback.onError(throwable, -3);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 友盟+
|
||||||
|
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||||
|
*/
|
||||||
|
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommonResponse<T> getMethodCommonSync(Activity mContext, String url, HttpParams params, int timeOut, Class<T> tClass) {
|
||||||
|
try {
|
||||||
|
Response<CommonResponse<T>> response = ((GetRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 0, tClass))
|
||||||
|
.adapt()
|
||||||
|
.execute();
|
||||||
|
if (response.code() == 200) {
|
||||||
|
if (response.body().getCode() == 230){
|
||||||
|
FlushTokenUtil.flushToken(mContext);
|
||||||
|
}
|
||||||
|
return response.body();
|
||||||
|
} else {
|
||||||
|
return new CommonResponse<T>(response.code(), response.message(), null);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
String message = e.getMessage();
|
||||||
|
assert message != null;
|
||||||
|
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||||
|
ToastUtils.Message(mContext, "请求超时");
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(mContext, message);
|
||||||
|
}
|
||||||
|
Log.d("TAG", "onError: " + e.getMessage());
|
||||||
|
return new CommonResponse<T>(e.hashCode(), e.getMessage(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postMethodCommon(Activity mContext, String url, HttpParams params, int timeOut, Callback<CommonResponse<T>> callback, Class<T> tClass) {
|
||||||
|
try {
|
||||||
|
Response<CommonResponse<T>> response = ((GetRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 1, tClass))
|
||||||
|
.adapt()
|
||||||
|
.execute();
|
||||||
|
if (response.code() == 200) {
|
||||||
|
if (response.body().getCode() == 200) {
|
||||||
|
callback.onSuccess(response.body(), 1);
|
||||||
|
} else if (response.body().getCode() == 230){
|
||||||
|
FlushTokenUtil.flushToken(mContext);
|
||||||
|
Toast.makeText(mContext, "token过期,请重新登录后再试...", Toast.LENGTH_LONG).show();
|
||||||
|
Throwable throwable = new Throwable("token过期,请重新登录后再试...");
|
||||||
|
callback.onError(throwable, -1);
|
||||||
|
/*
|
||||||
|
* 友盟+
|
||||||
|
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||||
|
*/
|
||||||
|
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||||
|
} else {
|
||||||
|
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
|
||||||
|
Throwable throwable = new Throwable(response.message());
|
||||||
|
callback.onError(throwable, -2);
|
||||||
|
/*
|
||||||
|
* 友盟+
|
||||||
|
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||||
|
*/
|
||||||
|
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Toast.makeText(mContext, response.message(), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Throwable throwable = e;
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
callback.onError(throwable, -3);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 友盟+
|
||||||
|
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||||
|
*/
|
||||||
|
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommonResponse<T> postMethodCommonSync(Activity mContext, String url, HttpParams params, int timeOut, List<File> files, Class<T> tClass) {
|
||||||
|
try {
|
||||||
|
PostRequest<CommonResponse<T>> postRequest = (PostRequest<CommonResponse<T>>) obitainRequest(mContext, url, params, timeOut, 1, tClass);
|
||||||
|
if (files!=null) {
|
||||||
|
postRequest.addFileParams("file", files);
|
||||||
|
}
|
||||||
|
Response<CommonResponse<T>> response = postRequest
|
||||||
|
.adapt()
|
||||||
|
.execute();
|
||||||
|
if (response.code() == 200) {
|
||||||
|
if (response.body().getCode() == 230){
|
||||||
|
FlushTokenUtil.flushToken(mContext);
|
||||||
|
}
|
||||||
|
return response.body();
|
||||||
|
} else {
|
||||||
|
return new CommonResponse<T>(response.code(), response.message(), null);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
String message = e.getMessage();
|
||||||
|
assert message != null;
|
||||||
|
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||||
|
ToastUtils.Message(mContext, "请求超时");
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(mContext, message);
|
||||||
|
}
|
||||||
|
Log.d("TAG", "onError: " + e.getMessage());
|
||||||
|
return new CommonResponse<T>(e.hashCode(), e.getMessage(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成通用请求
|
||||||
|
* @param requestType 0-默认为get请求,非0-post请求
|
||||||
|
* */
|
||||||
|
private Request obitainRequest(Activity mContext, String url, HttpParams params, int timeOut, int requestType, Class<T> clazz) throws Exception{
|
||||||
|
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
|
||||||
|
throw new Exception("网络不可用");
|
||||||
|
}
|
||||||
|
initTimeOut(timeOut);
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
params.put("datetime", time);
|
||||||
|
Request request = null;
|
||||||
|
if (requestType != 0) {
|
||||||
|
request= OkGo
|
||||||
|
// 请求方式和请求url
|
||||||
|
.<CommonResponse<T>>post(url);
|
||||||
|
} else {
|
||||||
|
request= OkGo
|
||||||
|
// 请求方式和请求url
|
||||||
|
.<CommonResponse<T>>get(url);
|
||||||
|
}
|
||||||
|
return request
|
||||||
|
.headers(getHeader(params))
|
||||||
|
.params(params)
|
||||||
|
.retryCount(3)
|
||||||
|
.converter(new MyJsonCallback(clazz) {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Response response) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 请求的 tag, 主要用于取消对应的请求
|
||||||
|
.tag(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTimeOut(int time) {
|
||||||
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||||
|
builder.readTimeout(time, TimeUnit.SECONDS);
|
||||||
|
//全局的写入超时时间
|
||||||
|
builder.writeTimeout(time, TimeUnit.SECONDS);
|
||||||
|
//全局的连接超时时间
|
||||||
|
builder.connectTimeout(time, TimeUnit.SECONDS);
|
||||||
|
builder.callTimeout(time, TimeUnit.SECONDS);
|
||||||
|
OkGo.getInstance().init(UserApplication.getUserApplication()).setOkHttpClient(builder.build())
|
||||||
|
//全局统一缓存模式,默认不使用缓存,可以不传
|
||||||
|
.setCacheMode(CacheMode.NO_CACHE)
|
||||||
|
//全局统一缓存时间,默认永不过期,可以不传
|
||||||
|
.setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE)
|
||||||
|
.setRetryCount(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpHeaders getHeader(HttpParams params) {
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
try {
|
||||||
|
if (Constant.ACCESS_TOKEN == null) {
|
||||||
|
headers.put("Authorization", "Basic YXBwOmFwcHNlY3JldA==");
|
||||||
|
} else {
|
||||||
|
headers.put("Authorization", "bearer " + Constant.ACCESS_TOKEN);
|
||||||
|
}
|
||||||
|
StringBuilder util = new StringBuilder();//k1=v1&k2=v2&k3=v3
|
||||||
|
if (params != null && params.urlParamsMap != null) {
|
||||||
|
for (Map.Entry<String, List<String>> entry : params.urlParamsMap.entrySet()) {
|
||||||
|
if (!"file".equals(entry.getKey())) {
|
||||||
|
util.append(entry.getKey()).append("=").append(entry.getValue().get(0).toString()).append("&");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!util.toString().equals("")) {
|
||||||
|
util = new StringBuilder(util.substring(0, util.length() - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headers.put("key", Md5Util.toMD5("dtxb_2021_navinfo" + util));
|
||||||
|
headers.put("Accept-Encoding", "identity");
|
||||||
|
return headers;
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.navinfo.outdoor.bean;
|
||||||
|
|
||||||
|
public class CommonResponse<T> extends CommonResponseBase{
|
||||||
|
public CommonResponse(int code, String message, T body) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommonResponse() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected T body;
|
||||||
|
|
||||||
|
public T getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(T body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.navinfo.outdoor.bean;
|
||||||
|
|
||||||
|
public class CommonResponseBase {
|
||||||
|
protected Integer code;
|
||||||
|
protected String message;
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommonResponse toLzyResponse() {
|
||||||
|
CommonResponse lzyResponse = new CommonResponse();
|
||||||
|
lzyResponse.code = code;
|
||||||
|
lzyResponse.message = message;
|
||||||
|
return lzyResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
72
app/src/main/java/com/navinfo/outdoor/bean/Convert.java
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
package com.navinfo.outdoor.bean;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonIOException;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.readystatesoftware.chuck.internal.support.JsonConvertor;
|
||||||
|
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class Convert {
|
||||||
|
|
||||||
|
private static Gson create() {
|
||||||
|
return Convert.GsonHolder.gson;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class GsonHolder {
|
||||||
|
private static Gson gson = new Gson();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T fromJson(String json, Class<T> type) throws JsonIOException, JsonSyntaxException {
|
||||||
|
return create().fromJson(json, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T fromJson(String json, Type type) {
|
||||||
|
return create().fromJson(json, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T fromJson(JsonReader reader, Type typeOfT) throws JsonIOException, JsonSyntaxException {
|
||||||
|
return create().fromJson(reader, typeOfT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T fromJson(Reader json, Class<T> classOfT) throws JsonSyntaxException, JsonIOException {
|
||||||
|
return create().fromJson(json, classOfT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T fromJson(Reader json, Type typeOfT) throws JsonIOException, JsonSyntaxException {
|
||||||
|
return create().fromJson(json, typeOfT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toJson(Object src) {
|
||||||
|
return create().toJson(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toJson(Object src, Type typeOfSrc) {
|
||||||
|
return create().toJson(src, typeOfSrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatJson(String json) {
|
||||||
|
try {
|
||||||
|
JsonParser jp = new JsonParser();
|
||||||
|
JsonElement je = jp.parse(json);
|
||||||
|
return JsonConvertor.getInstance().toJson(je);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatJson(Object src) {
|
||||||
|
try {
|
||||||
|
JsonParser jp = new JsonParser();
|
||||||
|
JsonElement je = jp.parse(toJson(src));
|
||||||
|
return JsonConvertor.getInstance().toJson(je);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return e.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,7 +88,7 @@ public class JobSearchBean implements Serializable {
|
|||||||
this.list = list;
|
this.list = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ListBean {
|
public static class ListBean implements Serializable{
|
||||||
/**
|
/**
|
||||||
* id : 8992
|
* id : 8992
|
||||||
* geo : dy3feM6SkaeY3Q3FrUcdfMyvvsAqu2MktMG2JtDX/+gDQ7IT9aNcPn2v1Rvi
|
* geo : dy3feM6SkaeY3Q3FrUcdfMyvvsAqu2MktMG2JtDX/+gDQ7IT9aNcPn2v1Rvi
|
||||||
|
|||||||
136
app/src/main/java/com/navinfo/outdoor/bean/LocationRecorder.java
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
package com.navinfo.outdoor.bean;
|
||||||
|
|
||||||
|
import android.location.Location;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.tencent.map.geolocation.TencentLocation;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Entity(tableName = "LocationRecorder")
|
||||||
|
public class LocationRecorder implements Serializable {
|
||||||
|
@PrimaryKey
|
||||||
|
private long time; // 采集时间
|
||||||
|
private double tencentLocationX;
|
||||||
|
private double tencentLocationY;
|
||||||
|
private double gpsLocationX;
|
||||||
|
private double gpsLocationY;
|
||||||
|
private int rssi; // 信号强度
|
||||||
|
private double bearing; // 角度方向
|
||||||
|
private int satelliteCount; // 卫星颗数
|
||||||
|
private String imgFileName; // 照片名称
|
||||||
|
|
||||||
|
public long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(long time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTencentLocationX() {
|
||||||
|
return tencentLocationX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTencentLocationX(double tencentLocationX) {
|
||||||
|
this.tencentLocationX = tencentLocationX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTencentLocationY() {
|
||||||
|
return tencentLocationY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTencentLocationY(double tencentLocationY) {
|
||||||
|
this.tencentLocationY = tencentLocationY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGpsLocationX() {
|
||||||
|
return gpsLocationX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGpsLocationX(double gpsLocationX) {
|
||||||
|
this.gpsLocationX = gpsLocationX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGpsLocationY() {
|
||||||
|
return gpsLocationY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGpsLocationY(double gpsLocationY) {
|
||||||
|
this.gpsLocationY = gpsLocationY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRssi() {
|
||||||
|
return rssi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRssi(int rssi) {
|
||||||
|
this.rssi = rssi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getBearing() {
|
||||||
|
return bearing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBearing(double bearing) {
|
||||||
|
this.bearing = bearing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSatelliteCount() {
|
||||||
|
return satelliteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSatelliteCount(int satelliteCount) {
|
||||||
|
this.satelliteCount = satelliteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImgFileName() {
|
||||||
|
return imgFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImgFileName(String imgFileName) {
|
||||||
|
this.imgFileName = imgFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "LocationRecorder{" +
|
||||||
|
"time=" + time +
|
||||||
|
", tencentLocationX=" + tencentLocationX +
|
||||||
|
", tencentLocationY=" + tencentLocationY +
|
||||||
|
", gpsLocationX=" + gpsLocationX +
|
||||||
|
", gpsLocationY=" + gpsLocationY +
|
||||||
|
", rssi=" + rssi +
|
||||||
|
", bearing=" + bearing +
|
||||||
|
", satelliteCount=" + satelliteCount +
|
||||||
|
", imgFileName='" + imgFileName + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
public String toString(SimpleDateFormat dateFormat, int index) {
|
||||||
|
return new StringBuilder()
|
||||||
|
.append(dateFormat.format(new Date(time)))
|
||||||
|
.append(",")
|
||||||
|
.append(index)
|
||||||
|
.append(",")
|
||||||
|
.append(tencentLocationY)
|
||||||
|
.append(",")
|
||||||
|
.append(tencentLocationX)
|
||||||
|
.append(",")
|
||||||
|
.append(bearing)
|
||||||
|
.append(",")
|
||||||
|
.append(Constant.getRssiDesStr(rssi))
|
||||||
|
.append(",")
|
||||||
|
.append(satelliteCount)
|
||||||
|
.append(",")
|
||||||
|
.append(gpsLocationY)
|
||||||
|
.append(",")
|
||||||
|
.append(gpsLocationX)
|
||||||
|
.append("\r\n")
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
128
app/src/main/java/com/navinfo/outdoor/bean/MyJsonCallback.java
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
package com.navinfo.outdoor.bean;
|
||||||
|
|
||||||
|
import com.google.gson.stream.JsonReader;
|
||||||
|
import com.lzy.okgo.callback.AbsCallback;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
|
public abstract class MyJsonCallback<T> extends AbsCallback<T> {
|
||||||
|
|
||||||
|
private Type type;
|
||||||
|
private Class<T> clazz;
|
||||||
|
|
||||||
|
public MyJsonCallback() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyJsonCallback(Type type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyJsonCallback(Class<T> clazz) {
|
||||||
|
this.clazz = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T convertResponse(Response response) throws Throwable {
|
||||||
|
|
||||||
|
if (type == null) {
|
||||||
|
if (clazz == null) {
|
||||||
|
// 如果没有通过构造函数传进来,就自动解析父类泛型的真实类型(有局限性,继承后就无法解析到)
|
||||||
|
Type genType = getClass().getGenericSuperclass();
|
||||||
|
type = ((ParameterizedType) genType).getActualTypeArguments()[0];
|
||||||
|
} else {
|
||||||
|
return parseClass(response, clazz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type instanceof ParameterizedType) {
|
||||||
|
return parseParameterizedType(response, (ParameterizedType) type);
|
||||||
|
} else if (type instanceof Class) {
|
||||||
|
return parseClass(response, (Class<?>) type);
|
||||||
|
} else {
|
||||||
|
return parseType(response, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private T parseClass(Response response, Class<?> rawType) throws Exception {
|
||||||
|
if (rawType == null) return null;
|
||||||
|
ResponseBody body = response.body();
|
||||||
|
if (body == null) return null;
|
||||||
|
JsonReader jsonReader = new JsonReader(body.charStream());
|
||||||
|
|
||||||
|
if (rawType == String.class) {
|
||||||
|
//noinspection unchecked
|
||||||
|
return (T) body.string();
|
||||||
|
} else if (rawType == JSONObject.class) {
|
||||||
|
//noinspection unchecked
|
||||||
|
return (T) new JSONObject(body.string());
|
||||||
|
} else if (rawType == JSONArray.class) {
|
||||||
|
//noinspection unchecked
|
||||||
|
return (T) new JSONArray(body.string());
|
||||||
|
} else {
|
||||||
|
T t = Convert.fromJson(jsonReader, rawType);
|
||||||
|
response.close();
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private T parseType(Response response, Type type) throws Exception {
|
||||||
|
if (type == null) return null;
|
||||||
|
ResponseBody body = response.body();
|
||||||
|
if (body == null) return null;
|
||||||
|
JsonReader jsonReader = new JsonReader(body.charStream());
|
||||||
|
|
||||||
|
// 泛型格式如下: new JsonCallback<任意JavaBean>(this)
|
||||||
|
T t = Convert.fromJson(jsonReader, type);
|
||||||
|
response.close();
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
private T parseParameterizedType(Response response, ParameterizedType type) throws Exception {
|
||||||
|
if (type == null) return null;
|
||||||
|
ResponseBody body = response.body();
|
||||||
|
if (body == null) return null;
|
||||||
|
JsonReader jsonReader = new JsonReader(body.charStream());
|
||||||
|
|
||||||
|
Type rawType = type.getRawType(); // 泛型的实际类型
|
||||||
|
Type typeArgument = type.getActualTypeArguments()[0]; // 泛型的参数
|
||||||
|
if (rawType != CommonResponse.class) {
|
||||||
|
// 泛型格式如下: new JsonCallback<外层BaseBean<内层JavaBean>>(this)
|
||||||
|
T t = Convert.fromJson(jsonReader, type);
|
||||||
|
response.close();
|
||||||
|
return t;
|
||||||
|
} else {
|
||||||
|
if (typeArgument == Void.class) {
|
||||||
|
// 泛型格式如下: new JsonCallback<LzyResponse<Void>>(this)
|
||||||
|
CommonResponseBase simpleResponse = Convert.fromJson(jsonReader, CommonResponseBase.class);
|
||||||
|
response.close();
|
||||||
|
//noinspection unchecked
|
||||||
|
return (T) simpleResponse.toLzyResponse();
|
||||||
|
} else {
|
||||||
|
// 泛型格式如下: new JsonCallback<LzyResponse<内层JavaBean>>(this)
|
||||||
|
CommonResponse lzyResponse = Convert.fromJson(jsonReader, type);
|
||||||
|
response.close();
|
||||||
|
int code = lzyResponse.code;
|
||||||
|
// 一般来说服务器会和客户端约定一个数表示成功,如200,其余的表示失败,如400,300等,这里根据实际情况罗列并抛出
|
||||||
|
if (code == 0) {
|
||||||
|
//noinspection unchecked
|
||||||
|
return (T) lzyResponse;
|
||||||
|
} else if (code == 230) {
|
||||||
|
throw new IllegalStateException("Token已过期");
|
||||||
|
} /*else if (code == 300) {
|
||||||
|
throw new IllegalStateException("用户名密码错误");
|
||||||
|
} */else {
|
||||||
|
// 直接将服务端的错误信息抛出,onError中可以获取
|
||||||
|
throw new IllegalStateException("错误代码:" + code + ",错误信息:" + lzyResponse.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
202
app/src/main/java/com/navinfo/outdoor/bean/RoadMatchEntity.java
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
package com.navinfo.outdoor.bean;
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.activity.MyCoordinate;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
|
|
||||||
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
|
import org.locationtech.jts.geom.Envelope;
|
||||||
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
import org.locationtech.jts.geom.LineString;
|
||||||
|
import org.locationtech.jts.geom.Point;
|
||||||
|
import org.locationtech.jts.geom.Polygon;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 道路匹配的封装类
|
||||||
|
* */
|
||||||
|
public class RoadMatchEntity implements Serializable {
|
||||||
|
private int id; // 唯一id
|
||||||
|
private JobSearchBean.BodyBean.ListBean dataDetail; // 具体的内容信息
|
||||||
|
private double angle=0; // 起点匹配方向
|
||||||
|
private double length=0; //geometry的长度
|
||||||
|
private String geometry; // 数据的geometry,此处应该为lineString
|
||||||
|
// private String buffer; // line外扩的buffer,用来判断行驶过程中是否可以与当前geometry匹配
|
||||||
|
private String sPoint; // 起点
|
||||||
|
private String ePoint; // 起点
|
||||||
|
private long startMatchTime; // 开始匹配的时间
|
||||||
|
private long endMathchTime; // 结束匹配的时间
|
||||||
|
private double currentLineDistance=0f; // 当前匹配到的距离道路线的距离
|
||||||
|
private double lastEndDistance=0f; // 上次匹配到的距离终点的距离
|
||||||
|
private int matchCount; // <连续>匹配到的点位个数
|
||||||
|
private int unMatchCount; // <连续>未匹配到的点位个数
|
||||||
|
private List<MyCoordinate> matchPointList = new ArrayList<>(); // 已匹配的点位列表
|
||||||
|
private List<MyCoordinate> unMatchPointList = new ArrayList<>(); // 未匹配的点位列表
|
||||||
|
private double matchedLength = 0;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JobSearchBean.BodyBean.ListBean getDataDetail() {
|
||||||
|
return dataDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataDetail(JobSearchBean.BodyBean.ListBean dataDetail) {
|
||||||
|
this.dataDetail = dataDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getAngle() {
|
||||||
|
return angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAngle(double angle) {
|
||||||
|
this.angle = angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGeometry() {
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeometry(LineString geometry) {
|
||||||
|
this.geometry = geometry.toString();
|
||||||
|
this.length = geometry.getLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLength() {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public String getBuffer() {
|
||||||
|
// return buffer;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setBuffer(String buffer) {
|
||||||
|
// this.buffer = buffer;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public String getsPoint() {
|
||||||
|
return sPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setsPoint(String sPoint) {
|
||||||
|
this.sPoint = sPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getePoint() {
|
||||||
|
return ePoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setePoint(String ePoint) {
|
||||||
|
this.ePoint = ePoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStartMatchTime() {
|
||||||
|
return startMatchTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartMatchTime(long startMatchTime) {
|
||||||
|
this.startMatchTime = startMatchTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getEndMathchTime() {
|
||||||
|
return endMathchTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndMathchTime(long endMathchTime) {
|
||||||
|
this.endMathchTime = endMathchTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLastEndDistance() {
|
||||||
|
return lastEndDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastEndDistance(double lastEndDistance) {
|
||||||
|
this.lastEndDistance = lastEndDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMatchCount() {
|
||||||
|
return matchCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchCount(int matchCount) {
|
||||||
|
this.matchCount = matchCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUnMatchCount() {
|
||||||
|
return unMatchCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnMatchCount(int unMatchCount) {
|
||||||
|
this.unMatchCount = unMatchCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MyCoordinate> getMatchPointList() {
|
||||||
|
return matchPointList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchPointList(List<MyCoordinate> matchPointList) {
|
||||||
|
this.matchPointList = matchPointList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MyCoordinate> getUnMatchPointList() {
|
||||||
|
return unMatchPointList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnMatchPointList(List<MyCoordinate> unMatchPointList) {
|
||||||
|
this.unMatchPointList = unMatchPointList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getCurrentLineDistance() {
|
||||||
|
return currentLineDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentLineDistance(double currentLineDistance) {
|
||||||
|
this.currentLineDistance = currentLineDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMatchedLength() {
|
||||||
|
return matchedLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchedLength(double matchedLength) {
|
||||||
|
this.matchedLength = matchedLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
RoadMatchEntity that = (RoadMatchEntity) o;
|
||||||
|
|
||||||
|
if (id != that.id) return false;
|
||||||
|
return true;
|
||||||
|
// if (angle != that.angle) return false;
|
||||||
|
// if (dataDetail != null ? !dataDetail.equals(that.dataDetail) : that.dataDetail != null)
|
||||||
|
// return false;
|
||||||
|
// if (geometry != null ? !geometry.equals(that.geometry) : that.geometry != null)
|
||||||
|
// return false;
|
||||||
|
// if (buffer != null ? !buffer.equals(that.buffer) : that.buffer != null) return false;
|
||||||
|
// if (sPoint != null ? !sPoint.equals(that.sPoint) : that.sPoint != null) return false;
|
||||||
|
// return ePoint != null ? ePoint.equals(that.ePoint) : that.ePoint == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = id;
|
||||||
|
result = 31 * result + (dataDetail != null ? dataDetail.hashCode() : 0);
|
||||||
|
result = 31 * result + (geometry != null ? geometry.hashCode() : 0);
|
||||||
|
result = 31 * result + (sPoint != null ? sPoint.hashCode() : 0);
|
||||||
|
result = 31 * result + (ePoint != null ? ePoint.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1047,70 +1047,70 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
case R.id.rl_panorama:
|
case R.id.rl_panorama:
|
||||||
chargingPileBuilder.append("点击了全景照片进行拍照,");
|
chargingPileBuilder.append("点击了全景照片进行拍照,");
|
||||||
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File panoramaFile = PhotoUtils.showPhotoFile("a", latLng);
|
File panoramaFile = PhotoUtils.showPhotoFile("a", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, panoramaFile.getPath());
|
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, panoramaFile.getPath());
|
||||||
startActivityForResult(intentPanorama, 101);
|
startActivityForResult(intentPanorama, 101);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_coding:
|
case R.id.rl_coding:
|
||||||
chargingPileBuilder.append("点击了充电桩编码进行拍照,");
|
chargingPileBuilder.append("点击了充电桩编码进行拍照,");
|
||||||
Intent intentCoding = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentCoding = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File codingFile = PhotoUtils.showPhotoFile("b", latLng);
|
File codingFile = PhotoUtils.showPhotoFile("b", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentCoding.putExtra(Constant.INTENT_PHOTO_PATH, codingFile.getPath());
|
intentCoding.putExtra(Constant.INTENT_PHOTO_PATH, codingFile.getPath());
|
||||||
startActivityForResult(intentCoding, 102);
|
startActivityForResult(intentCoding, 102);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_equipment:
|
case R.id.rl_equipment:
|
||||||
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
||||||
Intent intentEquipment = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentEquipment = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File equipmentFile = PhotoUtils.showPhotoFile("c", latLng);
|
File equipmentFile = PhotoUtils.showPhotoFile("c", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentEquipment.putExtra(Constant.INTENT_PHOTO_PATH, equipmentFile.getPath());
|
intentEquipment.putExtra(Constant.INTENT_PHOTO_PATH, equipmentFile.getPath());
|
||||||
startActivityForResult(intentEquipment, 103);
|
startActivityForResult(intentEquipment, 103);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_facility:
|
case R.id.rl_facility:
|
||||||
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
||||||
Intent intentFacility = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentFacility = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File facilityFile = PhotoUtils.showPhotoFile("c", latLng);
|
File facilityFile = PhotoUtils.showPhotoFile("c", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentFacility.putExtra(Constant.INTENT_PHOTO_PATH, facilityFile.getPath());
|
intentFacility.putExtra(Constant.INTENT_PHOTO_PATH, facilityFile.getPath());
|
||||||
startActivityForResult(intentFacility, 104);
|
startActivityForResult(intentFacility, 104);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_scutcheon:
|
case R.id.rl_scutcheon:
|
||||||
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
||||||
Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File scutcheonFile = PhotoUtils.showPhotoFile("c", latLng);
|
File scutcheonFile = PhotoUtils.showPhotoFile("c", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
|
intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
|
||||||
startActivityForResult(intentScutcheon, 105);
|
startActivityForResult(intentScutcheon, 105);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_device:
|
case R.id.rl_device:
|
||||||
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
chargingPileBuilder.append("点击了设备标牌进行拍照,");
|
||||||
Intent intentDevice = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentDevice = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File deviceFile = PhotoUtils.showPhotoFile("c", latLng);
|
File deviceFile = PhotoUtils.showPhotoFile("c", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentDevice.putExtra(Constant.INTENT_PHOTO_PATH, deviceFile.getPath());
|
intentDevice.putExtra(Constant.INTENT_PHOTO_PATH, deviceFile.getPath());
|
||||||
startActivityForResult(intentDevice, 106);
|
startActivityForResult(intentDevice, 106);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_usable:
|
case R.id.rl_usable:
|
||||||
chargingPileBuilder.append("点击了可用状态进行拍照,");
|
chargingPileBuilder.append("点击了可用状态进行拍照,");
|
||||||
Intent intentUsable = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentUsable = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File usableFile = PhotoUtils.showPhotoFile("d", latLng);
|
File usableFile = PhotoUtils.showPhotoFile("d", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentUsable.putExtra(Constant.INTENT_PHOTO_PATH, usableFile.getPath());
|
intentUsable.putExtra(Constant.INTENT_PHOTO_PATH, usableFile.getPath());
|
||||||
startActivityForResult(intentUsable, 107);
|
startActivityForResult(intentUsable, 107);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_available:
|
case R.id.rl_available:
|
||||||
chargingPileBuilder.append("点击了可用专题进行拍照,");
|
chargingPileBuilder.append("点击了可用专题进行拍照,");
|
||||||
Intent intentAvailable = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentAvailable = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File availableFile = PhotoUtils.showPhotoFile("d", latLng);
|
File availableFile = PhotoUtils.showPhotoFile("d", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentAvailable.putExtra(Constant.INTENT_PHOTO_PATH, availableFile.getPath());
|
intentAvailable.putExtra(Constant.INTENT_PHOTO_PATH, availableFile.getPath());
|
||||||
startActivityForResult(intentAvailable, 108);
|
startActivityForResult(intentAvailable, 108);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_parking:
|
case R.id.rl_parking:
|
||||||
chargingPileBuilder.append("点击了停车位编号进行拍照,");
|
chargingPileBuilder.append("点击了停车位编号进行拍照,");
|
||||||
Intent intentParking = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentParking = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File parkingFile = PhotoUtils.showPhotoFile("e", latLng);
|
File parkingFile = PhotoUtils.showPhotoFile("e", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentParking.putExtra(Constant.INTENT_PHOTO_PATH, parkingFile.getPath());
|
intentParking.putExtra(Constant.INTENT_PHOTO_PATH, parkingFile.getPath());
|
||||||
startActivityForResult(intentParking, 109);
|
startActivityForResult(intentParking, 109);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_number:
|
case R.id.rl_number:
|
||||||
chargingPileBuilder.append("点击了停车位编号进行拍照,");
|
chargingPileBuilder.append("点击了停车位编号进行拍照,");
|
||||||
Intent intentNumber = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentNumber = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File numberFile = PhotoUtils.showPhotoFile("e", latLng);
|
File numberFile = PhotoUtils.showPhotoFile("e", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentNumber.putExtra(Constant.INTENT_PHOTO_PATH, numberFile.getPath());
|
intentNumber.putExtra(Constant.INTENT_PHOTO_PATH, numberFile.getPath());
|
||||||
startActivityForResult(intentNumber, 110);
|
startActivityForResult(intentNumber, 110);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -99,7 +99,16 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableEmitter;
|
||||||
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.ObservableSource;
|
||||||
|
import io.reactivex.Scheduler;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.functions.Function;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -774,7 +783,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (getPhoneBean.getCode() == 200) {
|
if (getPhoneBean.getCode() == 200) {
|
||||||
String code = getPhoneBean.getBody().getCode();
|
String code = getPhoneBean.getBody().getCode();
|
||||||
Integer telLength = getPhoneBean.getBody().getTelLength();
|
Integer telLength = getPhoneBean.getBody().getTelLength();
|
||||||
if (!code.equals(Constant.CODE)) {
|
if (code!=null&&!Constant.CODE.equals(code)) {
|
||||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||||
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "此地区区号为" + code + ",请手动修改", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "此地区区号为" + code + ",请手动修改", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -879,8 +888,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (currentChargingPileList != null && !currentChargingPileList.isEmpty()) {
|
if (currentChargingPileList != null && !currentChargingPileList.isEmpty()) {
|
||||||
for (int i = 0; i < currentChargingPileList.size(); i++) {
|
for (int i = 0; i < currentChargingPileList.size(); i++) {
|
||||||
if (currentChargingPileList.get(i).getPileId() == chargingPileEntity.getPileId()) {
|
if (currentChargingPileList.get(i).getPileId() == chargingPileEntity.getPileId()) {
|
||||||
currentChargingPileList.add(i, chargingPileEntity);
|
currentChargingPileList.set(i, chargingPileEntity);
|
||||||
currentChargingPileList.remove(i + 1);
|
|
||||||
break m;
|
break m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1044,35 +1052,35 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
case R.id.rl_panorama:
|
case R.id.rl_panorama:
|
||||||
chargingStationBuilder.append(TimestampUtil.time()).append("点击了全景照片进行拍照 ,");
|
chargingStationBuilder.append(TimestampUtil.time()).append("点击了全景照片进行拍照 ,");
|
||||||
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File PanoramaFile = PhotoUtils.showPhotoFile("a", latLng);
|
File PanoramaFile = PhotoUtils.showPhotoFile("a", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, PanoramaFile.getPath());
|
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, PanoramaFile.getPath());
|
||||||
startActivityForResult(intentPanorama, 101);
|
startActivityForResult(intentPanorama, 101);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_name:
|
case R.id.rl_name:
|
||||||
chargingStationBuilder.append(TimestampUtil.time()).append("点击了名称照片进行拍照 ,");
|
chargingStationBuilder.append(TimestampUtil.time()).append("点击了名称照片进行拍照 ,");
|
||||||
Intent intentName = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentName = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File nameFile = PhotoUtils.showPhotoFile("b", latLng);
|
File nameFile = PhotoUtils.showPhotoFile("b", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentName.putExtra(Constant.INTENT_PHOTO_PATH, nameFile.getPath());
|
intentName.putExtra(Constant.INTENT_PHOTO_PATH, nameFile.getPath());
|
||||||
startActivityForResult(intentName, 102);
|
startActivityForResult(intentName, 102);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_internal_photos:
|
case R.id.rl_internal_photos:
|
||||||
chargingStationBuilder.append(TimestampUtil.time()).append("点击了服务说明进行拍照 ,");
|
chargingStationBuilder.append(TimestampUtil.time()).append("点击了服务说明进行拍照 ,");
|
||||||
Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File internalFile = PhotoUtils.showPhotoFile("c", latLng);
|
File internalFile = PhotoUtils.showPhotoFile("c", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, internalFile.getPath());
|
intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, internalFile.getPath());
|
||||||
startActivityForResult(intentInternal, 103);
|
startActivityForResult(intentInternal, 103);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_else:
|
case R.id.rl_else:
|
||||||
chargingStationBuilder.append(TimestampUtil.time()).append("点击了充电站指引牌进行拍照 ,");
|
chargingStationBuilder.append(TimestampUtil.time()).append("点击了充电站指引牌进行拍照 ,");
|
||||||
Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File elseFile = PhotoUtils.showPhotoFile("d", latLng);
|
File elseFile = PhotoUtils.showPhotoFile("d", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentElse.putExtra(Constant.INTENT_PHOTO_PATH, elseFile.getPath());
|
intentElse.putExtra(Constant.INTENT_PHOTO_PATH, elseFile.getPath());
|
||||||
startActivityForResult(intentElse, 104);
|
startActivityForResult(intentElse, 104);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_scutcheon:
|
case R.id.rl_scutcheon:
|
||||||
chargingStationBuilder.append(TimestampUtil.time()).append("点击了停车收费标牌进行拍照 ,");
|
chargingStationBuilder.append(TimestampUtil.time()).append("点击了停车收费标牌进行拍照 ,");
|
||||||
Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File scutcheonFile = PhotoUtils.showPhotoFile("e", latLng);
|
File scutcheonFile = PhotoUtils.showPhotoFile("e", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
|
intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
|
||||||
startActivityForResult(intentScutcheon, 105);
|
startActivityForResult(intentScutcheon, 105);
|
||||||
break;
|
break;
|
||||||
@@ -1163,7 +1171,85 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用RxJava提交充电站数据,附带提交充电桩数据
|
||||||
|
* */
|
||||||
|
private Observable submitChargingStation(PoiEntity poiEntity) {
|
||||||
|
return Observable.just(poiEntity).subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||||
|
.doOnEach(poiEntityNotification -> {
|
||||||
|
HttpParams httpParams = new HttpParams();
|
||||||
|
httpParams.put("taskId", poiEntity.getTaskId());
|
||||||
|
httpParams.put("sptype", poiEntity.getStation_type());
|
||||||
|
httpParams.put("existence", poiEntity.getExistence());
|
||||||
|
httpParams.put("name", poiEntity.getName());
|
||||||
|
httpParams.put("address", poiEntity.getAddress());
|
||||||
|
httpParams.put("telephone", poiEntity.getTelPhone());
|
||||||
|
httpParams.put("memo", poiEntity.getMemo());
|
||||||
|
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||||
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
|
.time(30)
|
||||||
|
.Builder(getActivity())
|
||||||
|
.url(HttpInterface.SUBMIT_CTASK)
|
||||||
|
.cls(ChargingStationBean.class)
|
||||||
|
.params(httpParams)
|
||||||
|
.token(Constant.ACCESS_TOKEN);
|
||||||
|
Response response = okGoBuilder.getSynchronization();
|
||||||
|
Gson gson = new Gson();
|
||||||
|
ChargingStationBean chargingStationBean = gson.fromJson(response.body().string(), ChargingStationBean.class);
|
||||||
|
if (chargingStationBean.getCode() == 200) {
|
||||||
|
Integer bodyId = chargingStationBean.getBody();
|
||||||
|
if (bodyId != null && bodyId != 0) {
|
||||||
|
poiEntity.setBodyId(bodyId);
|
||||||
|
poiEntity.setTaskStatus(3);
|
||||||
|
|
||||||
|
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||||
|
// 实时禁用当前的保存按钮,防止用户再次点击保存,重新生成新的POI数据
|
||||||
|
Message obtain1 = Message.obtain();
|
||||||
|
obtain1.what = Constant.CHARGING_STATION_DISABLE;
|
||||||
|
EventBus.getDefault().post(obtain1);
|
||||||
|
} else {
|
||||||
|
Message obtain1 = Message.obtain();
|
||||||
|
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||||
|
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
||||||
|
EventBus.getDefault().post(obtain1);
|
||||||
|
}
|
||||||
|
} else if (chargingStationBean.getCode() == 230) {
|
||||||
|
FlushTokenUtil.flushToken(getActivity());
|
||||||
|
} else {
|
||||||
|
Message obtain1 = Message.obtain();
|
||||||
|
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||||
|
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
||||||
|
EventBus.getDefault().post(obtain1);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.concatMap(new Function<PoiEntity, ObservableSource<ChargingPileEntity>>() {
|
||||||
|
@Override
|
||||||
|
public ObservableSource<ChargingPileEntity> apply(PoiEntity chargingStationPoiEntity) throws Exception {
|
||||||
|
if (chargingStationPoiEntity != null) {
|
||||||
|
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(getActivity()).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
|
||||||
|
PoiEntity poiEntity = PoiDatabase.getInstance(getActivity()).getPoiDao().getPoiEntity(chargingStationPoiEntity.getId());
|
||||||
|
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||||
|
chargingPileEntityList = chargingPileEntityList.stream().filter(chargingPileEntity -> chargingPileEntity.getBodyId()==0).collect(Collectors.toList());
|
||||||
|
return getSaveChargingObservable(chargingPileEntityList, poiEntity.getBodyId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Observable.never();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Observable<ChargingPileEntity> getSaveChargingObservable(List<ChargingPileEntity> chargingPileEntityList, int bodyId) {
|
||||||
|
return Observable.fromIterable(chargingPileEntityList).subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||||
|
.doOnEach(chargingPileEntityNotification -> {
|
||||||
|
saveChargingPileByWork(chargingPileEntityNotification.getValue(), bodyId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void chargingStationSaveWork(PoiEntity poiEntity) {
|
private void chargingStationSaveWork(PoiEntity poiEntity) {
|
||||||
|
if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||||
|
ToastUtils.Message(getActivity(), Constant.SUBMIT_TOAST_MSG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("taskId", poiEntity.getTaskId());
|
httpParams.put("taskId", poiEntity.getTaskId());
|
||||||
httpParams.put("sptype", poiEntity.getStation_type());
|
httpParams.put("sptype", poiEntity.getStation_type());
|
||||||
@@ -1215,7 +1301,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||||
Response execute = OkGoBuilder.getInstance()
|
Response execute = OkGoBuilder.getInstance()
|
||||||
.time(0)
|
.time(600)
|
||||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||||
.params(httpParams)
|
.params(httpParams)
|
||||||
.token(Constant.ACCESS_TOKEN)
|
.token(Constant.ACCESS_TOKEN)
|
||||||
@@ -1259,7 +1345,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("auditId", poiEntity.getBodyId());
|
httpParams.put("auditId", poiEntity.getBodyId());
|
||||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
.time(0)
|
.time(600)
|
||||||
.Builder(getActivity())
|
.Builder(getActivity())
|
||||||
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
|
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
|
||||||
.cls(PoiUploadBean.class)
|
.cls(PoiUploadBean.class)
|
||||||
@@ -1280,6 +1366,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
|
|
||||||
/*保存充电站数据到服务器*/
|
/*保存充电站数据到服务器*/
|
||||||
private void chargingStationSaveByWork(PoiEntity poiEntity) {
|
private void chargingStationSaveByWork(PoiEntity poiEntity) {
|
||||||
|
if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||||
|
ToastUtils.Message(getActivity(), Constant.SUBMIT_TOAST_MSG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("taskId", poiEntity.getTaskId());
|
httpParams.put("taskId", poiEntity.getTaskId());
|
||||||
httpParams.put("sptype", poiEntity.getStation_type());
|
httpParams.put("sptype", poiEntity.getStation_type());
|
||||||
@@ -1297,10 +1387,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
.cls(ChargingStationBean.class)
|
.cls(ChargingStationBean.class)
|
||||||
.params(httpParams)
|
.params(httpParams)
|
||||||
.token(Constant.ACCESS_TOKEN);
|
.token(Constant.ACCESS_TOKEN);
|
||||||
|
Constant.submitIdSet.add(poiEntity.getId());
|
||||||
okGoBuilder.getRequest(new Callback<ChargingStationBean>() {
|
okGoBuilder.getRequest(new Callback<ChargingStationBean>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ChargingStationBean chargingStationBean, int id) {
|
public void onSuccess(ChargingStationBean chargingStationBean, int id) {
|
||||||
dismissLoadingDialog();
|
|
||||||
if (chargingStationBean.getCode() == 200) {
|
if (chargingStationBean.getCode() == 200) {
|
||||||
Integer bodyId = chargingStationBean.getBody();
|
Integer bodyId = chargingStationBean.getBody();
|
||||||
if (bodyId != null && bodyId != 0) {
|
if (bodyId != null && bodyId != 0) {
|
||||||
@@ -1317,6 +1407,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
|
|
||||||
// 充电站数据已经保存在服务上,批量保存充电桩数据
|
// 充电站数据已经保存在服务上,批量保存充电桩数据
|
||||||
saveChargingPileByChargingStation(poiEntity);
|
saveChargingPileByChargingStation(poiEntity);
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1331,12 +1422,16 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}).start();
|
}).start();
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.Message(getActivity(), chargingStationBean.getMessage());
|
ToastUtils.Message(getActivity(), chargingStationBean.getMessage());
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
}
|
}
|
||||||
} else if (chargingStationBean.getCode() == 230) {
|
} else if (chargingStationBean.getCode() == 230) {
|
||||||
FlushTokenUtil.flushToken(getActivity());
|
FlushTokenUtil.flushToken(getActivity());
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.Message(getActivity(), chargingStationBean.getMessage());
|
ToastUtils.Message(getActivity(), chargingStationBean.getMessage());
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
}
|
}
|
||||||
|
dismissLoadingDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1350,6 +1445,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
ToastUtils.Message(getActivity(), message);
|
ToastUtils.Message(getActivity(), message);
|
||||||
}
|
}
|
||||||
Log.d("TAG", "onError: " + e.getMessage());
|
Log.d("TAG", "onError: " + e.getMessage());
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1404,7 +1500,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ToastUtils.Message(getActivity(), taskNameBean.getMessage());
|
ToastUtils.Message(getActivity(), taskNameBean.getMessage()+"");
|
||||||
editNameContent.setTextColor(Color.RED);
|
editNameContent.setTextColor(Color.RED);
|
||||||
btnSaveLocal.setEnabled(false);
|
btnSaveLocal.setEnabled(false);
|
||||||
btnUploading.setEnabled(false);
|
btnUploading.setEnabled(false);
|
||||||
@@ -1544,7 +1640,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
/**
|
/**
|
||||||
* 保存充电桩数据到服务端
|
* 保存充电桩数据到服务端
|
||||||
*/
|
*/
|
||||||
private void saveChargingPileByWork(ChargingPileEntity chargingPileEntity, int bodyId) {
|
private ChargingPileEntity saveChargingPileByWork(ChargingPileEntity chargingPileEntity, int bodyId) {
|
||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("taskId", chargingPileEntity.getTaskId());
|
httpParams.put("taskId", chargingPileEntity.getTaskId());
|
||||||
httpParams.put("name", chargingPileEntity.getName());
|
httpParams.put("name", chargingPileEntity.getName());
|
||||||
@@ -1582,6 +1678,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
return chargingPileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initList() {
|
private void initList() {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import com.navinfo.outdoor.util.GeometryTools;
|
|||||||
import com.navinfo.outdoor.util.TimestampUtil;
|
import com.navinfo.outdoor.util.TimestampUtil;
|
||||||
import com.navinfo.outdoor.util.ToastUtils;
|
import com.navinfo.outdoor.util.ToastUtils;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.navinfo.outdoor.fragment;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -21,6 +22,9 @@ import com.kongzue.dialog.util.DialogSettings;
|
|||||||
import com.kongzue.dialog.v3.MessageDialog;
|
import com.kongzue.dialog.v3.MessageDialog;
|
||||||
import com.lzy.okgo.model.HttpParams;
|
import com.lzy.okgo.model.HttpParams;
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.activity.NaviCarActivity;
|
||||||
|
import com.navinfo.outdoor.activity.NaviRideActivity;
|
||||||
|
import com.navinfo.outdoor.activity.NaviWalkActivity;
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseFragment;
|
import com.navinfo.outdoor.base.BaseFragment;
|
||||||
import com.navinfo.outdoor.bean.PolygonTaskBean;
|
import com.navinfo.outdoor.bean.PolygonTaskBean;
|
||||||
@@ -40,11 +44,14 @@ import com.navinfo.outdoor.room.PoiEntity;
|
|||||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||||
import com.navinfo.outdoor.util.Geohash;
|
import com.navinfo.outdoor.util.Geohash;
|
||||||
import com.navinfo.outdoor.util.GeometryTools;
|
import com.navinfo.outdoor.util.GeometryTools;
|
||||||
|
import com.navinfo.outdoor.util.NaviUtils;
|
||||||
import com.navinfo.outdoor.util.TimestampUtil;
|
import com.navinfo.outdoor.util.TimestampUtil;
|
||||||
import com.navinfo.outdoor.util.ToastUtils;
|
import com.navinfo.outdoor.util.ToastUtils;
|
||||||
import com.tencent.lbssearch.httpresponse.Poi;
|
import com.tencent.lbssearch.httpresponse.Poi;
|
||||||
|
import com.tencent.map.navi.car.TencentCarNaviManager;
|
||||||
|
import com.tencent.map.navi.data.NaviPoi;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
@@ -65,6 +72,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
private PoiEntity poiEntity;
|
private PoiEntity poiEntity;
|
||||||
private File logFile;
|
private File logFile;
|
||||||
private StringBuilder gatherGetBuilder;
|
private StringBuilder gatherGetBuilder;
|
||||||
|
private TextView tvStartNav;
|
||||||
|
|
||||||
public static GatherGetFragment newInstance(Bundle bundle) {
|
public static GatherGetFragment newInstance(Bundle bundle) {
|
||||||
GatherGetFragment fragment = new GatherGetFragment();
|
GatherGetFragment fragment = new GatherGetFragment();
|
||||||
@@ -144,6 +152,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
TextView tvTime = findViewById(R.id.tv_time);
|
TextView tvTime = findViewById(R.id.tv_time);
|
||||||
TextView tvDistance = findViewById(R.id.tv_distance);
|
TextView tvDistance = findViewById(R.id.tv_distance);
|
||||||
TextView tvDescribe = findViewById(R.id.tv_describe);
|
TextView tvDescribe = findViewById(R.id.tv_describe);
|
||||||
|
tvStartNav = findViewById(R.id.tv_gather_start_navi);
|
||||||
Button btnDelete = findViewById(R.id.btn_delete);
|
Button btnDelete = findViewById(R.id.btn_delete);
|
||||||
btnDelete.setOnClickListener(this);
|
btnDelete.setOnClickListener(this);
|
||||||
btnCancelGet = findViewById(R.id.btn_cancel_get);//取消领取
|
btnCancelGet = findViewById(R.id.btn_cancel_get);//取消领取
|
||||||
@@ -185,9 +194,33 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
assert poiEntity != null;
|
assert poiEntity != null;
|
||||||
int taskStatus = poiEntity.getTaskStatus();
|
int taskStatus = poiEntity.getTaskStatus();
|
||||||
initViewByTaskStatus(taskStatus);
|
initViewByTaskStatus(taskStatus);
|
||||||
|
// 用户点击开始导航
|
||||||
|
tvStartNav.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (Constant.currentNaviType == null) {
|
||||||
|
NaviUtils.getInstance().selectNaviType((AppCompatActivity) getActivity(), new NaviUtils.SelectNaviTypeListener() {
|
||||||
|
@Override
|
||||||
|
public void selectNaviType(Constant.NAV_TYPE nav_type) {
|
||||||
|
// 显示导航类型选择的对话框
|
||||||
|
Constant.currentNaviType = nav_type;
|
||||||
|
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX())));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 已选择导航方式
|
||||||
|
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存小数点后两位
|
* 保存小数点后两位
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
|||||||
} else if (response.getCode() == 230) {
|
} else if (response.getCode() == 230) {
|
||||||
FlushTokenUtil.flushToken(getActivity());
|
FlushTokenUtil.flushToken(getActivity());
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.Message(getActivity(), "绑定失败!");
|
ToastUtils.Message(getActivity(), response.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,10 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
|||||||
public void onError(Throwable e, int id) {
|
public void onError(Throwable e, int id) {
|
||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
assert message != null;
|
if (message == null) {
|
||||||
|
ToastUtils.Message(getActivity(), "获取余额失败,请重试!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||||
ToastUtils.Message(getActivity(), "请求超时");
|
ToastUtils.Message(getActivity(), "请求超时");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -512,14 +512,14 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
case R.id.rl_picture:
|
case R.id.rl_picture:
|
||||||
otherBuilder.append(TimestampUtil.time()).append(",").append("点击了第一个照片进行拍照 ,");
|
otherBuilder.append(TimestampUtil.time()).append(",").append("点击了第一个照片进行拍照 ,");
|
||||||
Intent intentPicture = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentPicture = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File file = PhotoUtils.showPhotoFile("a", latLng);
|
File file = PhotoUtils.showPhotoFile("a", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentPicture.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
|
intentPicture.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
|
||||||
startActivityForResult(intentPicture, 101);
|
startActivityForResult(intentPicture, 101);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_pictures:
|
case R.id.rl_pictures:
|
||||||
otherBuilder.append(TimestampUtil.time()).append(",").append("点击了第二个照片进行拍照 ,");
|
otherBuilder.append(TimestampUtil.time()).append(",").append("点击了第二个照片进行拍照 ,");
|
||||||
Intent intentPictures = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentPictures = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File files = PhotoUtils.showPhotoFile("b", latLng);
|
File files = PhotoUtils.showPhotoFile("b", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentPictures.putExtra(Constant.INTENT_PHOTO_PATH, files.getPath());
|
intentPictures.putExtra(Constant.INTENT_PHOTO_PATH, files.getPath());
|
||||||
startActivityForResult(intentPictures, 102);
|
startActivityForResult(intentPictures, 102);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ import java.util.Comparator;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片-fragment
|
* 图片-fragment
|
||||||
@@ -107,33 +110,36 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
|||||||
List<File> fileArrayList = new ArrayList<>();
|
List<File> fileArrayList = new ArrayList<>();
|
||||||
if (fileListByUUID.size() >= 2) {
|
if (fileListByUUID.size() >= 2) {
|
||||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||||
if (!fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
File file = fileListByUUID.get(i);
|
||||||
|
// 过滤分包数据,如果不是txt和照片文件,则自动跳过
|
||||||
|
if (!file.getName().endsWith(".txt")&&!file.getName().endsWith(".webp")&&!file.getName().endsWith(".jpg")&&!file.getName().endsWith(".png")&&!file.getName().endsWith(".jpeg")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!fileListByUUID.get(i).getPath().endsWith("paper.txt")) {
|
||||||
fileArrayList.add(fileListByUUID.get(i));
|
fileArrayList.add(fileListByUUID.get(i));
|
||||||
} else {
|
} else {
|
||||||
fileTxt = fileListByUUID.get(i);
|
fileTxt = fileListByUUID.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(fileArrayList, new Comparator<File>() {
|
|
||||||
|
fileArrayList = fileArrayList.stream().sorted(new Comparator<File>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(File o1, File o2) {
|
public int compare(File o1, File o2) {
|
||||||
String[] split = o1.getName().split(".webp");
|
String o1Name = o1.getName().replace(".webp","").replace(".jpg", "").replace(".png", "").replace("jpeg", "");
|
||||||
int i = Integer.parseInt(split[0]);
|
String o2Name = o2.getName().replace(".webp","").replace(".jpg", "").replace(".png", "").replace("jpeg", "");
|
||||||
String[] split2 = o2.getName().split(".webp");
|
if (Integer.parseInt(o1Name)>Integer.parseInt(o2Name)) {
|
||||||
int i2 = Integer.parseInt(split2[0]);
|
|
||||||
if (i > i2) {
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
if (fileArrayList.size() > 0) {
|
if (fileArrayList.size() > 0) {
|
||||||
for (int i = 0; i < fileArrayList.size(); i++) {
|
for (int i = 0; i < fileArrayList.size(); i++) {
|
||||||
if (fileArrayList.get(i).getPath().contains(".webp") && !fileArrayList.get(i).getPath().contains("paper.txt")) {
|
if (fileArrayList.get(i).exists()) {
|
||||||
if (fileArrayList.get(i).exists()) {
|
fileBeans.add(new FileBean(fileArrayList.get(i), false));
|
||||||
fileBeans.add(new FileBean(fileArrayList.get(i), false));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -343,6 +343,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
initShowPoi();
|
initShowPoi();
|
||||||
//拍照长按删除
|
//拍照长按删除
|
||||||
onLongDel();
|
onLongDel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//拍照长按删除
|
//拍照长按删除
|
||||||
@@ -615,7 +616,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
if (getPhoneBean.getCode() == 200) {
|
if (getPhoneBean.getCode() == 200) {
|
||||||
String code = getPhoneBean.getBody().getCode();
|
String code = getPhoneBean.getBody().getCode();
|
||||||
Integer telLength = getPhoneBean.getBody().getTelLength();
|
Integer telLength = getPhoneBean.getBody().getTelLength();
|
||||||
if (!Constant.CODE.equals(code)) {
|
if (code!=null&&!Constant.CODE.equals(code)) {
|
||||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||||
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "此地区区号为" + code + ",请手动修改", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "此地区区号为" + code + ",请手动修改", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -815,35 +816,35 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
case R.id.rl_panorama:
|
case R.id.rl_panorama:
|
||||||
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了全景图的进行拍照,");
|
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了全景图的进行拍照,");
|
||||||
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File filePanorama = PhotoUtils.showPhotoFile("a", latLng);
|
File filePanorama = PhotoUtils.showPhotoFile("a", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, filePanorama.getPath());
|
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, filePanorama.getPath());
|
||||||
startActivityForResult(intentPanorama, 101);
|
startActivityForResult(intentPanorama, 101);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_name:
|
case R.id.rl_name:
|
||||||
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了名称的进行拍照,");
|
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了名称的进行拍照,");
|
||||||
Intent intentName = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentName = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File fileName = PhotoUtils.showPhotoFile("b", latLng);
|
File fileName = PhotoUtils.showPhotoFile("b", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentName.putExtra(Constant.INTENT_PHOTO_PATH, fileName.getPath());
|
intentName.putExtra(Constant.INTENT_PHOTO_PATH, fileName.getPath());
|
||||||
startActivityForResult(intentName, 102);
|
startActivityForResult(intentName, 102);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_internal_photos:
|
case R.id.rl_internal_photos:
|
||||||
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了内部照片的进行拍照,");
|
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了内部照片的进行拍照,");
|
||||||
Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File fileInternal = PhotoUtils.showPhotoFile("c", latLng);
|
File fileInternal = PhotoUtils.showPhotoFile("c", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, fileInternal.getPath());
|
intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, fileInternal.getPath());
|
||||||
startActivityForResult(intentInternal, 103);
|
startActivityForResult(intentInternal, 103);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_card:
|
case R.id.rl_card:
|
||||||
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了名片的进行拍照,");
|
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了名片的进行拍照,");
|
||||||
Intent intentCard = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentCard = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File fileCard = PhotoUtils.showPhotoFile("d", latLng);
|
File fileCard = PhotoUtils.showPhotoFile("d", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentCard.putExtra(Constant.INTENT_PHOTO_PATH, fileCard.getPath());
|
intentCard.putExtra(Constant.INTENT_PHOTO_PATH, fileCard.getPath());
|
||||||
startActivityForResult(intentCard, 104);
|
startActivityForResult(intentCard, 104);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_else:
|
case R.id.rl_else:
|
||||||
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了其他的进行拍照,");
|
poiBuilder.append(TimestampUtil.time()).append(",").append("点击了其他的进行拍照,");
|
||||||
Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
|
Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
|
||||||
File fileElse = PhotoUtils.showPhotoFile("e", latLng);
|
File fileElse = PhotoUtils.showPhotoFile("e", new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||||
intentElse.putExtra(Constant.INTENT_PHOTO_PATH, fileElse.getPath());
|
intentElse.putExtra(Constant.INTENT_PHOTO_PATH, fileElse.getPath());
|
||||||
startActivityForResult(intentElse, 105);
|
startActivityForResult(intentElse, 105);
|
||||||
break;
|
break;
|
||||||
@@ -1001,7 +1002,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("auditId", body);
|
httpParams.put("auditId", body);
|
||||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
.time(0)
|
.time(600)
|
||||||
.Builder(getActivity())
|
.Builder(getActivity())
|
||||||
.url(HttpInterface.POI_TASK_UPLOAD_PIC)
|
.url(HttpInterface.POI_TASK_UPLOAD_PIC)
|
||||||
.cls(OtherUploadPicBean.class)
|
.cls(OtherUploadPicBean.class)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import com.navinfo.outdoor.room.PoiDao;
|
|||||||
import com.navinfo.outdoor.room.PoiDatabase;
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
import com.navinfo.outdoor.room.PoiEntity;
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
import com.navinfo.outdoor.util.AWMp4ParserHelper;
|
import com.navinfo.outdoor.util.AWMp4ParserHelper;
|
||||||
|
import com.navinfo.outdoor.util.DataSaveUtils;
|
||||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||||
import com.navinfo.outdoor.util.Geohash;
|
import com.navinfo.outdoor.util.Geohash;
|
||||||
import com.navinfo.outdoor.util.GeometryTools;
|
import com.navinfo.outdoor.util.GeometryTools;
|
||||||
@@ -66,7 +67,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -499,57 +500,12 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
break;
|
break;
|
||||||
case R.id.btn_poi_video_upload:
|
case R.id.btn_poi_video_upload:
|
||||||
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了上传的按钮 ,");
|
poiVideoBuilder.append(TimestampUtil.time()).append(",").append("点击了上传的按钮 ,");
|
||||||
if (Constant.isPresent) {
|
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||||
if (fmPoiVideoPic.getTag() != null) {
|
if (poiEntity.getTaskStatus() == 1 || poiEntity.getTaskStatus() == 2 || poiEntity.getTaskStatus() == 0 || poiEntity.getTaskStatus() == 5) {
|
||||||
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
|
initPoiSaveLocal(true);
|
||||||
boolean existsPic = PoiSaveUtils.getInstance(getActivity()).checkPicExists(videoFileList);
|
|
||||||
if (!existsPic) {
|
|
||||||
ToastUtils.Message(getActivity(), "本地不存在照片文件,无法上传数据,请确认!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
|
||||||
long zipTrueSize = ZipUtils.getZipTrueSize(fileZip.getAbsolutePath());
|
|
||||||
if (zipTrueSize > 0) {
|
|
||||||
if (getActivity() != null) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (showPoiEntity == null) {
|
|
||||||
showPoiEntity = new PoiEntity();
|
|
||||||
}
|
|
||||||
if (showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 5) {
|
|
||||||
initPoiSaveLocal(true);
|
|
||||||
} else {
|
|
||||||
poiVideoUpload(showPoiEntity.getBodyId(), fileZip);
|
|
||||||
Constant.isPresent = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (getActivity() != null) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
fileZip.delete();
|
|
||||||
ToastUtils.Message(getActivity(), "压缩文件失败,请重新提交");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
} else {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
ToastUtils.Message(getActivity(), "请录像");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.Message(getActivity(), "该任务正在提交中");
|
poiVideoUpload(poiEntity);
|
||||||
|
Constant.isPresent = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -631,32 +587,46 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void poiVideoUpload(int poiVideoBody, File fileZip) {
|
private void poiVideoUpload(PoiEntity poiEntity) {
|
||||||
if (poiVideoBody == 0) {
|
if (poiEntity.getBodyId() == 0) {
|
||||||
ToastUtils.Message(getActivity(), "请先保存本地在上传");
|
ToastUtils.Message(getActivity(), "请先保存本地在上传");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fileZip == null) {
|
if (Constant.isPresent) {
|
||||||
ToastUtils.Message(getActivity(), "未压缩完成");
|
if (fmPoiVideoPic.getTag() != null) {
|
||||||
return;
|
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
|
||||||
}
|
boolean existsPic = PoiSaveUtils.getInstance(getActivity()).checkPicExists(videoFileList);
|
||||||
HttpParams httpParams = new HttpParams();
|
if (!existsPic) {
|
||||||
httpParams.put("auditId", poiVideoBody);
|
ToastUtils.Message(getActivity(), "本地不存在照片文件,无法上传数据,请确认!");
|
||||||
long time = System.currentTimeMillis();
|
return;
|
||||||
httpParams.put("datetime", time);
|
}
|
||||||
httpParams.put("file", fileZip);
|
DataSaveUtils.getInstance().uploadFiles(getActivity(), showPoiEntity, videoFileList, new DataSaveUtils.UploadCallback() {
|
||||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
@Override
|
||||||
.time(0)
|
public void onStart() {
|
||||||
.Builder(getActivity())
|
dismissLoadingDialog();
|
||||||
.url(HttpInterface.POI_VIDEO_UPLOAD_PIC)
|
Constant.isPresent = false;
|
||||||
.cls(OtherUploadPicBean.class)
|
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||||
.params(httpParams)
|
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
|
||||||
.token(Constant.ACCESS_TOKEN);
|
WaitDialog.dismiss(3000);
|
||||||
if (getActivity() != null) {
|
}
|
||||||
okGoBuilder.postRequest(UploadUtils.getInstance().getPoiVideoUploadCallback(getActivity(), showPoiEntity, fileZip));
|
|
||||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
@Override
|
||||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
|
public void onFinish() {
|
||||||
WaitDialog.dismiss(3000);
|
Constant.isPresent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
ToastUtils.Message(getActivity(), "请录像拍照");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(getActivity(), "该任务正在提交中");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,7 +662,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
poiVideoUpload(poiVideoBody, fileZip);
|
poiVideoUpload(poiEntity);
|
||||||
Constant.isPresent = false;
|
Constant.isPresent = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -919,8 +889,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr(fileListByUUID);
|
// String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr(fileListByUUID);
|
||||||
poiEntity.setPhoto(photoStr);
|
poiEntity.setPhoto(fileListByUUID.size()+"");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,14 +34,17 @@ import com.hjq.permissions.XXPermissions;
|
|||||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||||
import com.kongzue.dialog.util.BaseDialog;
|
import com.kongzue.dialog.util.BaseDialog;
|
||||||
import com.kongzue.dialog.util.DialogSettings;
|
import com.kongzue.dialog.util.DialogSettings;
|
||||||
|
import com.kongzue.dialog.v3.CustomDialog;
|
||||||
import com.kongzue.dialog.v3.MessageDialog;
|
import com.kongzue.dialog.v3.MessageDialog;
|
||||||
import com.kongzue.dialog.v3.WaitDialog;
|
import com.kongzue.dialog.v3.WaitDialog;
|
||||||
import com.lzy.okgo.model.HttpParams;
|
import com.lzy.okgo.model.HttpParams;
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.activity.AutoTakePictureActivity;
|
||||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||||
import com.navinfo.outdoor.activity.PicturesActivity;
|
import com.navinfo.outdoor.activity.PicturesActivity;
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||||
|
import com.navinfo.outdoor.util.DataSaveUtils;
|
||||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||||
import com.navinfo.outdoor.util.PoiSaveUtils;
|
import com.navinfo.outdoor.util.PoiSaveUtils;
|
||||||
import com.navinfo.outdoor.util.PreserveUtils;
|
import com.navinfo.outdoor.util.PreserveUtils;
|
||||||
@@ -68,7 +71,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -100,6 +103,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
private RadioButton rbtnRoadOpen/*道路已开通*/, rbtnRoadPartOpen/*道路部分开通*/, rbtnRoadHasntOpen/*道路未开通*/, rbtnRoadHasntFind/*道路未找到*/, rbtnRoadOther/*其他*/;
|
private RadioButton rbtnRoadOpen/*道路已开通*/, rbtnRoadPartOpen/*道路部分开通*/, rbtnRoadHasntOpen/*道路未开通*/, rbtnRoadHasntFind/*道路未找到*/, rbtnRoadOther/*其他*/;
|
||||||
private RadioGroup rgRoadStatus; // 道路状态的radioGroup
|
private RadioGroup rgRoadStatus; // 道路状态的radioGroup
|
||||||
private EditText edtCheckedOther;
|
private EditText edtCheckedOther;
|
||||||
|
private int existence = 0; // 是否存在
|
||||||
|
|
||||||
public static RoadFragment newInstance(Bundle bundle) {
|
public static RoadFragment newInstance(Bundle bundle) {
|
||||||
RoadFragment fragment = new RoadFragment();
|
RoadFragment fragment = new RoadFragment();
|
||||||
@@ -227,6 +231,10 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||||
rgRoadStatus.setTag(findViewById(checkedId).getTag());
|
rgRoadStatus.setTag(findViewById(checkedId).getTag());
|
||||||
|
existence = Integer.parseInt((findViewById(checkedId).getTag()).toString());
|
||||||
|
if (showPoiEntity!=null) {
|
||||||
|
showPoiEntity.setExistence(existence);
|
||||||
|
}
|
||||||
switch (checkedId) {
|
switch (checkedId) {
|
||||||
case R.id.rbtn_road_other:
|
case R.id.rbtn_road_other:
|
||||||
edtCheckedOther.setVisibility(View.VISIBLE);
|
edtCheckedOther.setVisibility(View.VISIBLE);
|
||||||
@@ -374,12 +382,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
if (describe != null && !describe.equals("")) {
|
if (describe != null && !describe.equals("")) {
|
||||||
etDesc.setText(describe);
|
etDesc.setText(describe);
|
||||||
}
|
}
|
||||||
String photoList = showPoiEntity.getPhoto();//存儲在數據庫中的數據
|
// String photoList = showPoiEntity.getPhoto();//存儲在數據庫中的數據
|
||||||
if (!StringUtils.isEmpty(photoList)) {
|
// if (!StringUtils.isEmpty(photoList)) {
|
||||||
boolean isImageLoad = false;
|
boolean isImageLoad = false;
|
||||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
|
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
|
||||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||||
if (fileListByUUID.get(i).getPath().contains(".webp") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
if (fileListByUUID.get(i).getPath().endsWith(".webp") || fileListByUUID.get(i).getPath().endsWith(".png")
|
||||||
|
|| fileListByUUID.get(i).getPath().endsWith(".jpg")|| fileListByUUID.get(i).getPath().endsWith(".jpeg")) {
|
||||||
if (fileListByUUID.get(i).exists() && !isImageLoad) {
|
if (fileListByUUID.get(i).exists() && !isImageLoad) {
|
||||||
// 使用glide加载视频的第一帧
|
// 使用glide加载视频的第一帧
|
||||||
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivRoadPicture);
|
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivRoadPicture);
|
||||||
@@ -388,7 +397,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmRoadPic.setTag(fileListByUUID);
|
fmRoadPic.setTag(fileListByUUID);
|
||||||
}
|
// }
|
||||||
if (showPoiEntity.getTaskStatus() == 3) {
|
if (showPoiEntity.getTaskStatus() == 3) {
|
||||||
disables();
|
disables();
|
||||||
}
|
}
|
||||||
@@ -396,6 +405,15 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
if (showPoiEntity.getTaskId()>0) {
|
if (showPoiEntity.getTaskId()>0) {
|
||||||
etRoadName.setEnabled(false);
|
etRoadName.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
if (rgRoadStatus!=null) {
|
||||||
|
for (int i = 0; i < rgRoadStatus.getChildCount(); i++) {
|
||||||
|
RadioButton childAt = (RadioButton) rgRoadStatus.getChildAt(i);
|
||||||
|
if (childAt.getTag().equals(showPoiEntity.getExistence())) {
|
||||||
|
childAt.setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +426,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
if (!StringUtils.isEmpty(photo)) {
|
if (!StringUtils.isEmpty(photo)) {
|
||||||
File videoFile = new File(photo);
|
File videoFile = new File(photo);
|
||||||
videoFileList.add(new File(photo));
|
videoFileList.add(new File(photo));
|
||||||
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
|
if (videoFile.getName().endsWith(".webp") || videoFile.getName().endsWith(".png")
|
||||||
|
|| videoFile.getName().endsWith(".jpg")|| videoFile.getName().endsWith(".jpeg")) {
|
||||||
if (videoFile.exists() && !isImageLoad) {
|
if (videoFile.exists() && !isImageLoad) {
|
||||||
// 使用glide加载视频的第一帧
|
// 使用glide加载视频的第一帧
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||||
@@ -456,7 +475,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
boolean isImageLoad = false;
|
boolean isImageLoad = false;
|
||||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||||
File videoFile = fileListByUUID.get(i);
|
File videoFile = fileListByUUID.get(i);
|
||||||
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
|
if (videoFile.getName().endsWith(".webp") || videoFile.getName().endsWith(".png")
|
||||||
|
|| videoFile.getName().endsWith(".jpg")|| videoFile.getName().endsWith(".jpeg")) {
|
||||||
if (videoFile.exists() && !isImageLoad) {
|
if (videoFile.exists() && !isImageLoad) {
|
||||||
// 使用glide加载视频的第一帧
|
// 使用glide加载视频的第一帧
|
||||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||||
@@ -507,6 +527,54 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置亮度和摄像机刷新率
|
||||||
|
// CustomDialog.show((AppCompatActivity) getActivity(), R.layout.camera_setting_pre, new CustomDialog.OnBindView() {
|
||||||
|
// @Override
|
||||||
|
// public void onBind(CustomDialog dialog, View v) {
|
||||||
|
// SharedPreferences sharedPreferences = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE);
|
||||||
|
// int brightness = sharedPreferences.getInt("brightness", 40);
|
||||||
|
// EditText edtBrightness = v.findViewById(R.id.edt_camera_setting_brightness);
|
||||||
|
// edtBrightness.setText(brightness+"");
|
||||||
|
//
|
||||||
|
// int framness = sharedPreferences.getInt("framness", 30);
|
||||||
|
// EditText edtFramness = v.findViewById(R.id.edt_camera_setting_framness);
|
||||||
|
// edtFramness.setText(framness+"");
|
||||||
|
//
|
||||||
|
// Button btnConfirm = v.findViewById(R.id.btn_camera_setting_confirm);
|
||||||
|
// btnConfirm.setOnClickListener(new View.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(View v) {
|
||||||
|
// SharedPreferences.Editor editor = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE).edit();
|
||||||
|
// if (!edtBrightness.getText().toString().isEmpty()) {
|
||||||
|
// int b = Integer.parseInt(edtBrightness.getText().toString());
|
||||||
|
// editor.putInt("brightness", b);
|
||||||
|
// }
|
||||||
|
// if (!edtFramness.getText().toString().isEmpty()) {
|
||||||
|
// int f = Integer.parseInt(edtFramness.getText().toString());
|
||||||
|
// editor.putInt("framness", f);
|
||||||
|
// }
|
||||||
|
// editor.commit();
|
||||||
|
// Toast.makeText(getActivity(), "设置完成", Toast.LENGTH_SHORT).show();
|
||||||
|
//
|
||||||
|
// Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||||
|
// File finalFile = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||||
|
// intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
|
||||||
|
// intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
|
||||||
|
// intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
|
||||||
|
// intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
|
||||||
|
// int gpsRssi = Constant.currentLocation.getGPSRssi();
|
||||||
|
// if (gpsRssi == 0) {
|
||||||
|
// intent.putExtra(Constant.INTENT_BOOLEAN, false);
|
||||||
|
// } else {
|
||||||
|
// intent.putExtra(Constant.INTENT_BOOLEAN, true);
|
||||||
|
// }
|
||||||
|
// startActivityForResult(intent, 0x101);
|
||||||
|
// dialog.doDismiss();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }).setFullScreen(true);
|
||||||
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||||
File finalFile = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
File finalFile = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||||
intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
|
intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
|
||||||
@@ -522,59 +590,16 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
startActivityForResult(intent, 0x101);
|
startActivityForResult(intent, 0x101);
|
||||||
break;
|
break;
|
||||||
case R.id.road_upload:
|
case R.id.road_upload:
|
||||||
|
// 如果该数据没有被保存,需要先调用保存功能自动保存数据
|
||||||
roadBuilder.append(TimestampUtil.time()).append(",").append("点击了上传的按钮 ,");
|
roadBuilder.append(TimestampUtil.time()).append(",").append("点击了上传的按钮 ,");
|
||||||
if (Constant.isPresent) {
|
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
|
||||||
if (fmRoadPic.getTag() != null) {
|
if (poiEntity.getTaskStatus() == 1 || poiEntity.getTaskStatus() == 2 || poiEntity.getTaskStatus() == 0 || poiEntity.getTaskStatus() == 5) {
|
||||||
List<File> videoFileList = (List<File>) fmRoadPic.getTag();
|
initPoiSaveLocal(true);
|
||||||
boolean existsPic = PoiSaveUtils.getInstance(getActivity()).checkPicExists(videoFileList);
|
|
||||||
if (!existsPic) {
|
|
||||||
ToastUtils.Message(getActivity(), "本地不存在照片文件,无法上传数据,请确认!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ZipUtil.zipFiles(videoFileList, fileZip, null);//压缩
|
|
||||||
long zipTrueSize = ZipUtils.getZipTrueSize(fileZip.getAbsolutePath());
|
|
||||||
if (zipTrueSize > 0) {
|
|
||||||
if (getActivity() != null) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (showPoiEntity == null) {
|
|
||||||
showPoiEntity = new PoiEntity();
|
|
||||||
}
|
|
||||||
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 5) {
|
|
||||||
initPoiSaveLocal(true);
|
|
||||||
} else {
|
|
||||||
poiVideoUpload(showPoiEntity.getBodyId(), fileZip);
|
|
||||||
Constant.isPresent = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (getActivity() != null) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
fileZip.delete();
|
|
||||||
ToastUtils.Message(getActivity(), "压缩文件失败,请重新提交");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
} else {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
ToastUtils.Message(getActivity(), "请录像");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.Message(getActivity(), "该任务正在提交中");
|
poiVideoUpload(poiEntity);
|
||||||
|
Constant.isPresent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -637,7 +662,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
httpParams.put("workType", 0);
|
httpParams.put("workType", 0);
|
||||||
httpParams.put("memo", poiEntity.getMemo());
|
httpParams.put("memo", poiEntity.getMemo());
|
||||||
// 增加对应九天平台的参数
|
// 增加对应九天平台的参数
|
||||||
httpParams.put("existence", rgRoadStatus.getTag().toString());
|
httpParams.put("existence", existence);
|
||||||
httpParams.put("description", edtCheckedOther!=null&&edtCheckedOther.isShown()? edtCheckedOther.getText().toString().trim(): "");
|
httpParams.put("description", edtCheckedOther!=null&&edtCheckedOther.isShown()? edtCheckedOther.getText().toString().trim(): "");
|
||||||
|
|
||||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
@@ -655,32 +680,46 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void poiVideoUpload(int body, File fileZip) {
|
private void poiVideoUpload(PoiEntity poiEntity) {
|
||||||
if (body == 0) {
|
if (poiEntity.getBodyId() == 0) {
|
||||||
ToastUtils.Message(getActivity(), "请先保存本地上传");
|
ToastUtils.Message(getActivity(), "请先保存本地在上传");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fileZip == null) {
|
if (Constant.isPresent) {
|
||||||
ToastUtils.Message(getActivity(), "未压缩完成");
|
if (fmRoadPic.getTag() != null) {
|
||||||
return;
|
List<File> videoFileList = (List<File>) fmRoadPic.getTag();
|
||||||
}
|
boolean existsPic = PoiSaveUtils.getInstance(getActivity()).checkPicExists(videoFileList);
|
||||||
HttpParams httpParams = new HttpParams();
|
if (!existsPic) {
|
||||||
httpParams.put("auditId", body);
|
ToastUtils.Message(getActivity(), "本地不存在照片文件,无法上传数据,请确认!");
|
||||||
long time = System.currentTimeMillis();
|
return;
|
||||||
httpParams.put("datetime", time);
|
}
|
||||||
httpParams.put("file", fileZip);
|
DataSaveUtils.getInstance().uploadFiles(getActivity(), poiEntity, videoFileList, new DataSaveUtils.UploadCallback() {
|
||||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
@Override
|
||||||
.time(0)
|
public void onStart() {
|
||||||
.Builder(getActivity())
|
dismissLoadingDialog();
|
||||||
.url(HttpInterface.ROAD_TASK_UPLOAD_PIC)
|
Constant.isPresent = false;
|
||||||
.cls(OtherUploadPicBean.class)
|
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||||
.params(httpParams)
|
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
|
||||||
.token(Constant.ACCESS_TOKEN);
|
WaitDialog.dismiss(3000);
|
||||||
if (getActivity() != null) {
|
}
|
||||||
okGoBuilder.postRequest(UploadUtils.getInstance().getRoadUploadCallback(getActivity(), showPoiEntity, fileZip));
|
|
||||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
@Override
|
||||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
|
public void onFinish() {
|
||||||
WaitDialog.dismiss(3000);
|
Constant.isPresent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dismissLoadingDialog();
|
||||||
|
ToastUtils.Message(getActivity(), "请录像拍照");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(getActivity(), "该任务正在提交中");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -694,7 +733,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
httpParams.put("workType", 0);
|
httpParams.put("workType", 0);
|
||||||
httpParams.put("memo", poiEntity.getMemo());
|
httpParams.put("memo", poiEntity.getMemo());
|
||||||
// 增加对应九天平台的参数
|
// 增加对应九天平台的参数
|
||||||
httpParams.put("existence", rgRoadStatus.getTag().toString());
|
httpParams.put("existence", existence);
|
||||||
httpParams.put("description", edtCheckedOther!=null&&edtCheckedOther.isShown()? edtCheckedOther.getText().toString().trim(): "");
|
httpParams.put("description", edtCheckedOther!=null&&edtCheckedOther.isShown()? edtCheckedOther.getText().toString().trim(): "");
|
||||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
.time(30)
|
.time(30)
|
||||||
@@ -720,7 +759,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
poiVideoUpload(roadBody, fileZip);
|
poiVideoUpload(poiEntity);
|
||||||
Constant.isPresent = false;
|
Constant.isPresent = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -950,8 +989,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr(fileListByUUID);
|
// String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr(fileListByUUID);
|
||||||
poiEntity.setPhoto(photoStr);
|
poiEntity.setPhoto(fileListByUUID.size()+"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return poiEntity;
|
return poiEntity;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -19,13 +20,17 @@ import android.view.Gravity;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.widget.NestedScrollView;
|
import androidx.core.widget.NestedScrollView;
|
||||||
@@ -44,12 +49,14 @@ import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
|||||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||||
import com.kongzue.dialog.util.BaseDialog;
|
import com.kongzue.dialog.util.BaseDialog;
|
||||||
import com.kongzue.dialog.util.DialogSettings;
|
import com.kongzue.dialog.util.DialogSettings;
|
||||||
|
import com.kongzue.dialog.v3.CustomDialog;
|
||||||
import com.kongzue.dialog.v3.MessageDialog;
|
import com.kongzue.dialog.v3.MessageDialog;
|
||||||
import com.kongzue.dialog.v3.ShareDialog;
|
import com.kongzue.dialog.v3.ShareDialog;
|
||||||
import com.lzy.okgo.OkGo;
|
import com.lzy.okgo.OkGo;
|
||||||
import com.lzy.okgo.model.HttpParams;
|
import com.lzy.okgo.model.HttpParams;
|
||||||
import com.lzy.okgo.model.Progress;
|
import com.lzy.okgo.model.Progress;
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.activity.AutoTakePictureActivity;
|
||||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||||
import com.navinfo.outdoor.activity.HomeActivity;
|
import com.navinfo.outdoor.activity.HomeActivity;
|
||||||
import com.navinfo.outdoor.activity.WebActivity;
|
import com.navinfo.outdoor.activity.WebActivity;
|
||||||
@@ -75,7 +82,10 @@ import com.navinfo.outdoor.util.Geohash;
|
|||||||
import com.navinfo.outdoor.util.GeometryTools;
|
import com.navinfo.outdoor.util.GeometryTools;
|
||||||
import com.navinfo.outdoor.util.MapManager;
|
import com.navinfo.outdoor.util.MapManager;
|
||||||
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||||
|
import com.navinfo.outdoor.util.NaviUtils;
|
||||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||||
|
import com.navinfo.outdoor.util.SystemTTS;
|
||||||
|
import com.navinfo.outdoor.util.TencentMarkerUtils;
|
||||||
import com.navinfo.outdoor.util.TimestampUtil;
|
import com.navinfo.outdoor.util.TimestampUtil;
|
||||||
import com.navinfo.outdoor.util.ToastUtils;
|
import com.navinfo.outdoor.util.ToastUtils;
|
||||||
import com.sothree.slidinguppanel.ScrollableViewHelper;
|
import com.sothree.slidinguppanel.ScrollableViewHelper;
|
||||||
@@ -101,9 +111,11 @@ import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
|||||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||||
import com.umeng.message.UmengNotificationClickHandler;
|
import com.umeng.message.UmengNotificationClickHandler;
|
||||||
import com.umeng.message.entity.UMessage;
|
import com.umeng.message.entity.UMessage;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
|
||||||
import com.vividsolutions.jts.geom.MultiPoint;
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
import com.vividsolutions.jts.geom.Point;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
import org.locationtech.jts.geom.MultiPoint;
|
||||||
|
import org.locationtech.jts.geom.Point;
|
||||||
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@@ -114,11 +126,13 @@ import java.text.DateFormat;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 寻宝的Fragment
|
* 寻宝的Fragment
|
||||||
@@ -134,19 +148,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
private FrameLayout frameLayout;
|
private FrameLayout frameLayout;
|
||||||
private GatherGetFragment gatherGetFragment;
|
private GatherGetFragment gatherGetFragment;
|
||||||
private String centerEncode;
|
private String centerEncode;
|
||||||
private List<Removable> removables;
|
private List<Removable> removables; //存储网络数据的marker数据(线,面,点)
|
||||||
private List<Removable> removableScreenMarker;
|
private List<Removable> removablesLocality; // 存储本地数据的marker数据(线,面,点)
|
||||||
private List<Removable> removablesLocality;
|
private List<Removable> removableScreenMarker; // 存储屏幕数据的marker数据(线,面,点)
|
||||||
|
private final int MARKER_BIG = 4;
|
||||||
/*
|
/*
|
||||||
* bitmapDescriptor1
|
* bitmapDescriptor1
|
||||||
*/
|
*/
|
||||||
//private BitmapDescriptor bitmapDescriptor1, bitmapDescriptor2, bitmapDescriptor3, bitmapDescriptor4, bitmapDescriptor5;
|
//private BitmapDescriptor bitmapDescriptor1, bitmapDescriptor2, bitmapDescriptor3, bitmapDescriptor4, bitmapDescriptor5;
|
||||||
private Marker bigMarker;
|
private Marker bigMarker;
|
||||||
private List<Integer> upload;
|
private List<Integer> upload;
|
||||||
private final int MARKER_DOT = 3;
|
|
||||||
private final int MARKER_LINE = 2;
|
|
||||||
private final int MARKER_FACE = 1;
|
|
||||||
private final int MARKER_BIG = 4;
|
|
||||||
private HashMap<String, List<Marker>> removableHashMap;
|
private HashMap<String, List<Marker>> removableHashMap;
|
||||||
private ArrayList<LatLng> latList;
|
private ArrayList<LatLng> latList;
|
||||||
private ArrayList<PoiEntity> poiEntityArrayList;
|
private ArrayList<PoiEntity> poiEntityArrayList;
|
||||||
@@ -169,6 +180,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
private TextView tvTenantGaps;
|
private TextView tvTenantGaps;
|
||||||
|
private TencentMarkerUtils tencentMarkerUtils;
|
||||||
|
private ImageView imgAutoMatchRoad; // 自动匹配道路
|
||||||
|
private ImageView ivNaviDistance; // 按距离自动导航
|
||||||
|
|
||||||
public static TreasureFragment newInstance(Bundle bundle) {
|
public static TreasureFragment newInstance(Bundle bundle) {
|
||||||
TreasureFragment fragment = new TreasureFragment();
|
TreasureFragment fragment = new TreasureFragment();
|
||||||
@@ -185,6 +199,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.initView();
|
super.initView();
|
||||||
|
tencentMarkerUtils = new TencentMarkerUtils();
|
||||||
sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
|
sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
|
||||||
sharedEdit = sharedPreferences.edit();
|
sharedEdit = sharedPreferences.edit();
|
||||||
//fragment 管理器
|
//fragment 管理器
|
||||||
@@ -292,6 +307,129 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
tencentMap.setOnMarkerClickListener(Constant.markerClickListener);
|
tencentMap.setOnMarkerClickListener(Constant.markerClickListener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
imgAutoMatchRoad = findViewById(R.id.iv_auto_match_road);
|
||||||
|
// 如果当前用户的level为1或2、3,自动采集功能才会开放
|
||||||
|
if (Constant.LEVEL == 1||Constant.LEVEL==2||Constant.LEVEL==3) {
|
||||||
|
imgAutoMatchRoad.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
imgAutoMatchRoad.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent autoMatchIntent = new Intent(getContext(), AutoTakePictureActivity.class);
|
||||||
|
startActivity(autoMatchIntent);
|
||||||
|
// // 设置亮度和摄像机刷新率
|
||||||
|
// CustomDialog.show((AppCompatActivity) getActivity(), R.layout.camera_setting_pre, new CustomDialog.OnBindView() {
|
||||||
|
// @Override
|
||||||
|
// public void onBind(CustomDialog dialog, View v) {
|
||||||
|
// SharedPreferences sharedPreferences = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE);
|
||||||
|
// int brightness = sharedPreferences.getInt("brightness", 40);
|
||||||
|
// EditText edtBrightness = v.findViewById(R.id.edt_camera_setting_brightness);
|
||||||
|
// edtBrightness.setText(brightness+"");
|
||||||
|
//
|
||||||
|
// int framness = sharedPreferences.getInt("framness", 30);
|
||||||
|
// EditText edtFramness = v.findViewById(R.id.edt_camera_setting_framness);
|
||||||
|
// edtFramness.setText(framness+"");
|
||||||
|
//
|
||||||
|
// Button btnConfirm = v.findViewById(R.id.btn_camera_setting_confirm);
|
||||||
|
// btnConfirm.setOnClickListener(new View.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(View v) {
|
||||||
|
// SharedPreferences.Editor editor = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE).edit();
|
||||||
|
// if (!edtBrightness.getText().toString().isEmpty()) {
|
||||||
|
// int b = Integer.parseInt(edtBrightness.getText().toString());
|
||||||
|
// editor.putInt("brightness", b);
|
||||||
|
// }
|
||||||
|
// if (!edtFramness.getText().toString().isEmpty()) {
|
||||||
|
// int f = Integer.parseInt(edtFramness.getText().toString());
|
||||||
|
// editor.putInt("framness", f);
|
||||||
|
// }
|
||||||
|
// editor.commit();
|
||||||
|
// Toast.makeText(getActivity(), "设置完成", Toast.LENGTH_SHORT).show();
|
||||||
|
//
|
||||||
|
// Intent autoMatchIntent = new Intent(getContext(), AutoTakePictureActivity.class);
|
||||||
|
// startActivity(autoMatchIntent);
|
||||||
|
// dialog.doDismiss();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }).setFullScreen(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ivNaviDistance = findViewById(R.id.img_navi_distance);
|
||||||
|
|
||||||
|
ivNaviDistance.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Constant.NAV_NEAREST_POI = !view.isSelected();
|
||||||
|
view.setSelected(Constant.NAV_NEAREST_POI);
|
||||||
|
// 如果是被选中,则发送导航到最近POI的指令
|
||||||
|
if (Constant.NAV_NEAREST_POI) {
|
||||||
|
SystemTTS.getInstance(getContext()).playText("开始自动规划");
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
handler.postDelayed(autoNaviRunnable, 2000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SystemTTS.getInstance(getContext()).playText("停止自动规划");
|
||||||
|
handler.removeCallbacks(autoNaviRunnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导航到最近的POIEntity
|
||||||
|
* */
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
|
private void navi2NearestPoiEntity() {
|
||||||
|
if (removables == null || removables.isEmpty()) {
|
||||||
|
SystemTTS.getInstance(getContext()).playText("无法获取任务数据");
|
||||||
|
ivNaviDistance.setSelected(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Geometry currentGeometry = GeometryTools.createGeometry(new double[]{Constant.currentLocation.getLongitude(), Constant.currentLocation.getLatitude()});
|
||||||
|
Removable minRemoveable = removables.stream().filter(new Predicate<Removable>() {
|
||||||
|
@Override
|
||||||
|
public boolean test(Removable removable) {
|
||||||
|
if (removable instanceof Marker) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).min((removable, t1) -> {
|
||||||
|
Marker marker1 = (Marker) removable;
|
||||||
|
Marker marker2 = (Marker) t1;
|
||||||
|
// 判断距离用户当前位置的距离
|
||||||
|
JobSearchBean.BodyBean.ListBean bean1 = (JobSearchBean.BodyBean.ListBean) marker1.getTag();
|
||||||
|
JobSearchBean.BodyBean.ListBean bean2 = (JobSearchBean.BodyBean.ListBean) marker2.getTag();
|
||||||
|
// 转换geo
|
||||||
|
Geometry geometry1 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean1.getGeo()));
|
||||||
|
Geometry geometry2 = GeometryTools.createGeometry(Geohash.getInstance().decode(bean2.getGeo()));
|
||||||
|
if (currentGeometry.distance(geometry1)>currentGeometry.distance(geometry2)) {
|
||||||
|
return 1;
|
||||||
|
} else if (currentGeometry.distance(geometry1)<currentGeometry.distance(geometry2)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}).get();
|
||||||
|
JobSearchBean.BodyBean.ListBean bean = (JobSearchBean.BodyBean.ListBean)((Marker)minRemoveable).getTag();
|
||||||
|
Coordinate endPoint = GeometryTools.createGeometry(Geohash.getInstance().decode(bean.getGeo())).getCoordinates()[0];
|
||||||
|
ToastUtils.Message(getActivity(), "自动导航到"+bean.getName());
|
||||||
|
// 跳转到对应的导航界面
|
||||||
|
if (Constant.currentNaviType == null) {
|
||||||
|
NaviUtils.getInstance().selectNaviType((AppCompatActivity) getActivity(), new NaviUtils.SelectNaviTypeListener() {
|
||||||
|
@Override
|
||||||
|
public void selectNaviType(Constant.NAV_TYPE nav_type) {
|
||||||
|
// 显示导航类型选择的对话框
|
||||||
|
Constant.currentNaviType = nav_type;
|
||||||
|
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(endPoint.getY(), endPoint.getX()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 已选择导航方式
|
||||||
|
NaviUtils.getInstance().startNav(getActivity(), new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), new LatLng(endPoint.getY(), endPoint.getX()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initUM() {
|
private void initUM() {
|
||||||
@@ -346,10 +484,35 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
dismissLoadingDialog();
|
dismissLoadingDialog();
|
||||||
removableHashMap.clear();
|
removableHashMap.clear();
|
||||||
if (Constant.USHERED != null) {
|
if (Constant.USHERED != null) {
|
||||||
initThread(); // 刷新筛选的本地数据
|
// 刷新筛选的本地数据
|
||||||
|
tencentMarkerUtils.initLocalMarker(getActivity(), tencentMap, removablesLocality, removableHashMap, new TencentMarkerUtils.MarkerInitCallback<PoiEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<PoiEntity> listData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (Constant.currentLocation != null) {
|
if (Constant.currentLocation != null) { //筛选从服务器获取到的数据
|
||||||
initList(Constant.currentLocation); // 刷新筛选的网络数据
|
tencentMarkerUtils.initNetMarkerList(getActivity(), Constant.currentLocation, tencentMap, removables,null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<JobSearchBean.BodyBean.ListBean> listData) {
|
||||||
|
latList.clear();
|
||||||
|
for (Map.Entry<String, List<Marker>> entry : removableHashMap.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
LatLng lng = GeometryTools.createLatLng(key);
|
||||||
|
latList.add(lng);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 服务返回的目前已上报但未上传照片的数据列表
|
||||||
|
upload = uploadByNet;
|
||||||
|
if (upload != null) {
|
||||||
|
ivSubmit.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
ivSubmit.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.Message(getActivity(), "未开启定位服务");
|
ToastUtils.Message(getActivity(), "未开启定位服务");
|
||||||
}
|
}
|
||||||
@@ -564,306 +727,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络删选接口
|
|
||||||
*
|
|
||||||
* @param tencentLocation location
|
|
||||||
*/
|
|
||||||
private void initList(TencentLocation tencentLocation) {
|
|
||||||
int task_type = Constant.TASK_TYPE;
|
|
||||||
int limit_type = Constant.LIMIT_TYPE;
|
|
||||||
int taskStatus = Constant.TASK_STARTUP;
|
|
||||||
if (taskStatus == 1) {
|
|
||||||
Message obtain = Message.obtain();
|
|
||||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
|
||||||
obtain.obj = null;
|
|
||||||
EventBus.getDefault().post(obtain);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//获取中心点位置
|
|
||||||
LatLng mapCenterPoint = getMapCenterPoint();
|
|
||||||
if (mapCenterPoint != null) {
|
|
||||||
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
|
|
||||||
}
|
|
||||||
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
|
||||||
OkGo.getInstance().cancelTag(this);
|
|
||||||
Log.d("TAG", "initList: " + Constant.USHERED);
|
|
||||||
// 请求方式和请求url
|
|
||||||
HttpParams httpParams = new HttpParams();
|
|
||||||
httpParams.put("userGeo", userEncode);
|
|
||||||
httpParams.put("centerGeo", centerEncode);
|
|
||||||
httpParams.put("pageSize", Constant.NUMBER);
|
|
||||||
httpParams.put("pageNum", 1);
|
|
||||||
httpParams.put("type", task_type);
|
|
||||||
httpParams.put("isExclusive", limit_type);
|
|
||||||
if (taskStatus == 2) {
|
|
||||||
if (Constant.USHERED != null) {
|
|
||||||
httpParams.put("received", Constant.USHERED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showLoadingDialog();
|
|
||||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
|
||||||
.time(30)
|
|
||||||
.Builder(getActivity())
|
|
||||||
.url(HttpInterface.TASK_LIST)
|
|
||||||
.cls(JobSearchBean.class)
|
|
||||||
.params(httpParams)
|
|
||||||
.token(Constant.ACCESS_TOKEN);
|
|
||||||
okGoBuilder.getRequest(new Callback<JobSearchBean>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(JobSearchBean response, int id) {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
if (response.getCode() == 200) {
|
|
||||||
JobSearchBean.BodyBean body = response.getBody();
|
|
||||||
if (body != null) {
|
|
||||||
upload = response.getBody().getUpload();
|
|
||||||
if (upload != null) {
|
|
||||||
ivSubmit.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
ivSubmit.setEnabled(false);
|
|
||||||
}
|
|
||||||
Log.d("TAG", "onSuccess: " + response.getBody().toString());
|
|
||||||
for (int i = 0; i < removables.size(); i++) {
|
|
||||||
removables.get(i).remove();
|
|
||||||
}
|
|
||||||
removables.clear();
|
|
||||||
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
|
|
||||||
String encodeStr = list.get(i).getGeo();
|
|
||||||
// 解密geo
|
|
||||||
String geo = Geohash.getInstance().decode(encodeStr);
|
|
||||||
Log.d("TAG", "onSuccess: " + geo);
|
|
||||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
|
||||||
LatLng latLng = null;
|
|
||||||
switch (geometry.getGeometryType()) {
|
|
||||||
case "LineString": //线
|
|
||||||
case "MultiLineString"://多线
|
|
||||||
BitmapDescriptor bitmapLine = null;
|
|
||||||
if (listBean.getType() == 3) {//poi录像
|
|
||||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
|
||||||
} else if (listBean.getType() == 4) {//道路录像
|
|
||||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
|
||||||
}
|
|
||||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
|
||||||
// 构造 PolylineOptions
|
|
||||||
PolylineOptions polylineOptions = new PolylineOptions()
|
|
||||||
.addAll(latLineString)
|
|
||||||
// 折线设置圆形线头
|
|
||||||
.lineCap(true)
|
|
||||||
// 折线的颜色为绿色
|
|
||||||
.color(Color.parseColor("#0096FF"))
|
|
||||||
// 折线宽度为5像素
|
|
||||||
.width(28)
|
|
||||||
// 还可以添加描边颜色
|
|
||||||
//.borderColor(0xffff0000)
|
|
||||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
|
||||||
//.borderWidth(1);
|
|
||||||
.arrow(true)
|
|
||||||
.arrowSpacing(80)
|
|
||||||
.arrowTexture(bitmapLine);
|
|
||||||
// 绘制折线
|
|
||||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
|
||||||
if (polyline != null) {
|
|
||||||
polyline.setZIndex(MARKER_LINE);
|
|
||||||
removables.add(polyline);
|
|
||||||
if (latLineString != null && latLineString.size() > 0) {
|
|
||||||
latLng = latLineString.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "Point": //点
|
|
||||||
latLng = GeometryTools.createLatLng(geo);
|
|
||||||
break;
|
|
||||||
case "Polygon": //面
|
|
||||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
|
||||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
|
||||||
//连接封闭图形的点
|
|
||||||
addAll(latPolygon).
|
|
||||||
//填充颜色为红色
|
|
||||||
fillColor(Color.parseColor("#97E0E7EC")).
|
|
||||||
//边线颜色为黑色
|
|
||||||
strokeColor(0xff000000).
|
|
||||||
//边线宽度15像素
|
|
||||||
strokeWidth(5));
|
|
||||||
if (polygon != null) {
|
|
||||||
polygon.setZIndex(MARKER_FACE);
|
|
||||||
removables.add(polygon);
|
|
||||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
|
||||||
double x = centroid.getX();
|
|
||||||
double y = centroid.getY();
|
|
||||||
latLng = new LatLng();
|
|
||||||
latLng.setLatitude(y);
|
|
||||||
latLng.setLongitude(x);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (list.get(i).getType()) {
|
|
||||||
case 1://poi
|
|
||||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
|
||||||
//poiDescriptor.getForager().setScale(50);
|
|
||||||
assert latLng != null;
|
|
||||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
|
||||||
.anchor(0.5f, 1.0f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
if (poiMarker != null) {
|
|
||||||
if (listBean != null) {
|
|
||||||
poiMarker.setTag(listBean);
|
|
||||||
}
|
|
||||||
poiMarker.setZIndex(MARKER_DOT);
|
|
||||||
removables.add(poiMarker);
|
|
||||||
String poiGeo = initGeo(latLng);
|
|
||||||
geoMarker(poiGeo, poiMarker);
|
|
||||||
poiMarker.setClickable(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2://充电站
|
|
||||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
|
||||||
assert latLng != null;
|
|
||||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
|
||||||
.anchor(0.5f, 1.0f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
if (stationMarker != null) {
|
|
||||||
if (listBean != null) {
|
|
||||||
stationMarker.setTag(listBean);
|
|
||||||
}
|
|
||||||
stationMarker.setZIndex(MARKER_DOT);
|
|
||||||
removables.add(stationMarker);
|
|
||||||
String stationGeo = initGeo(latLng);
|
|
||||||
geoMarker(stationGeo, stationMarker);
|
|
||||||
stationMarker.setClickable(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3://poi录像
|
|
||||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
|
||||||
assert latLng != null;
|
|
||||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
|
||||||
.anchor(0.5f, 1.0f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
if (poiVideoMarker != null) {
|
|
||||||
if (listBean != null) {
|
|
||||||
poiVideoMarker.setTag(listBean);
|
|
||||||
}
|
|
||||||
poiVideoMarker.setZIndex(MARKER_DOT);
|
|
||||||
removables.add(poiVideoMarker);
|
|
||||||
String poiVideoGeo = initGeo(latLng);
|
|
||||||
geoMarker(poiVideoGeo, poiVideoMarker);
|
|
||||||
poiVideoMarker.setClickable(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4://道路录像
|
|
||||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
|
||||||
assert latLng != null;
|
|
||||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
|
||||||
.anchor(0.5f, 1.0f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
if (roadMarker != null) {
|
|
||||||
if (listBean != null) {
|
|
||||||
roadMarker.setTag(listBean);
|
|
||||||
}
|
|
||||||
roadMarker.setZIndex(MARKER_DOT);
|
|
||||||
removables.add(roadMarker);
|
|
||||||
String roadGeo = initGeo(latLng);
|
|
||||||
geoMarker(roadGeo, roadMarker);
|
|
||||||
roadMarker.setClickable(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 5://其他
|
|
||||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
|
||||||
assert latLng != null;
|
|
||||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
|
||||||
.anchor(0.5f, 1.0f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
if (otherMarker != null) {
|
|
||||||
if (listBean != null) {
|
|
||||||
otherMarker.setTag(listBean);
|
|
||||||
}
|
|
||||||
otherMarker.setZIndex(MARKER_DOT);
|
|
||||||
removables.add(otherMarker);
|
|
||||||
String otherGeo = initGeo(latLng);
|
|
||||||
geoMarker(otherGeo, otherMarker);
|
|
||||||
otherMarker.setClickable(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 6://面状任务
|
|
||||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
|
||||||
assert latLng != null;
|
|
||||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
|
||||||
.anchor(0.5f, 1.0f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
if (planarMarker != null) {
|
|
||||||
if (listBean != null) {
|
|
||||||
planarMarker.setTag(listBean);
|
|
||||||
}
|
|
||||||
planarMarker.setZIndex(MARKER_DOT);
|
|
||||||
removables.add(planarMarker);
|
|
||||||
String planarGeo = initGeo(latLng);
|
|
||||||
geoMarker(planarGeo, planarMarker);
|
|
||||||
planarMarker.setClickable(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
latList.clear();
|
|
||||||
for (Map.Entry<String, List<Marker>> entry : removableHashMap.entrySet()) {
|
|
||||||
String key = entry.getKey();
|
|
||||||
LatLng lng = GeometryTools.createLatLng(key);
|
|
||||||
latList.add(lng);
|
|
||||||
}
|
|
||||||
Message obtain = Message.obtain();
|
|
||||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
|
||||||
obtain.obj = response;
|
|
||||||
EventBus.getDefault().post(obtain);
|
|
||||||
} else if (response.getCode() == 230) {
|
|
||||||
FlushTokenUtil.flushToken(getActivity());
|
|
||||||
} else {
|
|
||||||
ToastUtils.Message(getActivity(), response.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e, int id) {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
String message = e.getMessage();
|
|
||||||
assert message != null;
|
|
||||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
|
||||||
ToastUtils.Message(getActivity(), "请求超时");
|
|
||||||
} else {
|
|
||||||
ToastUtils.Message(getActivity(), message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* geo 坐标点转成
|
|
||||||
*
|
|
||||||
* @param latLng lat
|
|
||||||
*/
|
|
||||||
public String initGeo(LatLng latLng) {
|
|
||||||
return GeometryTools.createGeometry(latLng).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void geoMarker(String geo, Marker marker) {
|
|
||||||
if (!removableHashMap.containsKey(geo)) {
|
|
||||||
List<Marker> markers = new ArrayList<>();
|
|
||||||
markers.add(marker);
|
|
||||||
removableHashMap.put(geo, markers);
|
|
||||||
} else {
|
|
||||||
List<Marker> markers = removableHashMap.get(geo);
|
|
||||||
assert markers != null;
|
|
||||||
markers.add(marker);
|
|
||||||
removableHashMap.put(geo, markers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* marker 选中的状态
|
* marker 选中的状态
|
||||||
*
|
*
|
||||||
@@ -927,7 +790,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
// 绘制折线
|
// 绘制折线
|
||||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||||
if (polyline != null) {
|
if (polyline != null) {
|
||||||
polyline.setZIndex(MARKER_LINE);
|
polyline.setZIndex(TencentMarkerUtils.MARKER_LINE);
|
||||||
removableScreenMarker.add(polyline);
|
removableScreenMarker.add(polyline);
|
||||||
if (latLineString != null && latLineString.size() > 0) {
|
if (latLineString != null && latLineString.size() > 0) {
|
||||||
latLng = latLineString.get(0);
|
latLng = latLineString.get(0);
|
||||||
@@ -946,9 +809,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
//边线宽度15像素
|
//边线宽度15像素
|
||||||
strokeWidth(25));
|
strokeWidth(25));
|
||||||
if (polygon != null) {
|
if (polygon != null) {
|
||||||
polygon.setZIndex(MARKER_FACE);
|
polygon.setZIndex(TencentMarkerUtils.MARKER_FACE);
|
||||||
removableScreenMarker.add(polygon);
|
removableScreenMarker.add(polygon);
|
||||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
org.locationtech.jts.geom.Point centroid = geometry.getCentroid();
|
||||||
double x = centroid.getX();
|
double x = centroid.getX();
|
||||||
double y = centroid.getY();
|
double y = centroid.getY();
|
||||||
latLng = new LatLng();
|
latLng = new LatLng();
|
||||||
@@ -1000,297 +863,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*本地数据库数据*/
|
private Runnable autoNaviRunnable = new Runnable() {
|
||||||
private void initThread() {
|
@Override
|
||||||
int taskStatus = Constant.TASK_STARTUP;
|
public void run() {
|
||||||
int type = Constant.TASK_TYPE;
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
int limit = Constant.LIMIT_TYPE;
|
navi2NearestPoiEntity();
|
||||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
|
|
||||||
if (poiDatabase == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
List<PoiEntity> allTaskStatus = poiDatabase.getPoiDao().getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
|
||||||
if (getActivity() != null) {
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (int i = 0; i < removablesLocality.size(); i++) {
|
|
||||||
removablesLocality.get(i).remove();
|
|
||||||
}
|
|
||||||
removablesLocality.clear();
|
|
||||||
for (int i = 0; i < allTaskStatus.size(); i++) {
|
|
||||||
PoiEntity poiEntity = allTaskStatus.get(i);
|
|
||||||
String geoWkt = allTaskStatus.get(i).getGeoWkt();
|
|
||||||
LatLng latLng = null;
|
|
||||||
Log.d("TAG", "onSuccess: " + geoWkt);
|
|
||||||
if (geoWkt != null) {
|
|
||||||
String geo = Geohash.getInstance().decode(geoWkt);//解密geo
|
|
||||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
|
||||||
switch (geometry.getGeometryType()) {
|
|
||||||
case "Point": //点
|
|
||||||
latLng = GeometryTools.createLatLng(geo);
|
|
||||||
break;
|
|
||||||
case "LineString": //线
|
|
||||||
case "MultiLineString"://多线
|
|
||||||
BitmapDescriptor bitmapLine = null;
|
|
||||||
int color = 0;
|
|
||||||
if (poiEntity.getType() == 3) {//poi录像
|
|
||||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
|
||||||
} else if (poiEntity.getType() == 4) {//道路录像
|
|
||||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
|
||||||
}
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
color = Color.parseColor("#FFE70C");
|
|
||||||
} else {
|
|
||||||
color = Color.parseColor("#BDBDBD");
|
|
||||||
}
|
|
||||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
|
||||||
// 构造 PolylineOnions
|
|
||||||
PolylineOptions polylineOptions = new PolylineOptions()
|
|
||||||
.addAll(latLineString)
|
|
||||||
// 折线设置圆形线头
|
|
||||||
.lineCap(true)
|
|
||||||
.color(color)
|
|
||||||
// 折线宽度为5像素
|
|
||||||
.width(28)
|
|
||||||
.arrow(true)
|
|
||||||
.arrowSpacing(80)
|
|
||||||
.arrowTexture(bitmapLine);
|
|
||||||
// 绘制折线
|
|
||||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
|
||||||
if (polyline != null) {
|
|
||||||
polyline.setZIndex(MARKER_LINE);
|
|
||||||
removablesLocality.add(polyline);
|
|
||||||
if (latLineString != null && latLineString.size() > 0) {
|
|
||||||
latLng = latLineString.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "Polygon": //面
|
|
||||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
|
||||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
|
||||||
addAll(latPolygon).//填充颜色为浅蓝色
|
|
||||||
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
|
||||||
strokeColor(0xff00ff00).//边线宽度15像素
|
|
||||||
strokeWidth(5));
|
|
||||||
if (polygon != null) {
|
|
||||||
polygon.setZIndex(MARKER_FACE);
|
|
||||||
removablesLocality.add(polygon);
|
|
||||||
Point centroid = geometry.getCentroid();
|
|
||||||
double x = centroid.getX();
|
|
||||||
double y = centroid.getY();
|
|
||||||
latLng = new LatLng();
|
|
||||||
latLng.setLatitude(y);
|
|
||||||
latLng.setLongitude(x);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
String detail = allTaskStatus.get(i).getDetail();
|
|
||||||
if (detail != null) {
|
|
||||||
String geo = Geohash.getInstance().decode(detail);//解密geo
|
|
||||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
|
||||||
switch (geometry.getGeometryType()) {
|
|
||||||
case "Point": //点
|
|
||||||
latLng = GeometryTools.createLatLng(geo);
|
|
||||||
break;
|
|
||||||
case "LineString": //线
|
|
||||||
case "MultiLineString"://多线
|
|
||||||
BitmapDescriptor bitmapLine = null;
|
|
||||||
int color = 0;
|
|
||||||
if (poiEntity.getType() == 3) {//poi录像
|
|
||||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
|
||||||
} else if (poiEntity.getType() == 4) {//道路录像
|
|
||||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
|
||||||
}
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
color = Color.parseColor("#FFE70C");
|
|
||||||
} else {
|
|
||||||
color = Color.parseColor("#BDBDBD");
|
|
||||||
}
|
|
||||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
|
||||||
// 构造 PolylineOnions
|
|
||||||
PolylineOptions polylineOptions = new PolylineOptions()
|
|
||||||
.addAll(latLineString)
|
|
||||||
// 折线设置圆形线头
|
|
||||||
.lineCap(true)
|
|
||||||
.color(color)
|
|
||||||
// 折线宽度为5像素
|
|
||||||
.width(28)
|
|
||||||
.arrow(true)
|
|
||||||
.arrowSpacing(80)
|
|
||||||
.arrowTexture(bitmapLine);
|
|
||||||
// 绘制折线
|
|
||||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
|
||||||
if (polyline != null) {
|
|
||||||
polyline.setZIndex(MARKER_LINE);
|
|
||||||
removablesLocality.add(polyline);
|
|
||||||
if (latLineString != null && latLineString.size() > 0) {
|
|
||||||
latLng = latLineString.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "Polygon": //面
|
|
||||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
|
||||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
|
||||||
addAll(latPolygon).//填充颜色为浅蓝色
|
|
||||||
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
|
||||||
strokeColor(0xff00ff00).//边线宽度15像素
|
|
||||||
strokeWidth(5));
|
|
||||||
if (polygon != null) {
|
|
||||||
polygon.setZIndex(MARKER_FACE);
|
|
||||||
removablesLocality.add(polygon);
|
|
||||||
Point centroid = geometry.getCentroid();
|
|
||||||
double x = centroid.getX();
|
|
||||||
double y = centroid.getY();
|
|
||||||
latLng = new LatLng();
|
|
||||||
latLng.setLatitude(y);
|
|
||||||
latLng.setLongitude(x);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
|
||||||
latLng = new LatLng(Double.parseDouble(allTaskStatus.get(i).getY()), Double.parseDouble(allTaskStatus.get(i).getX()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (poiEntity.getType()) {
|
|
||||||
case 1://poi
|
|
||||||
BitmapDescriptor poiDescriptor = null;
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
|
||||||
} else {
|
|
||||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
|
||||||
}
|
|
||||||
assert latLng != null;
|
|
||||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor)
|
|
||||||
.flat(true)
|
|
||||||
.anchor(0.5f, 1f)
|
|
||||||
.clockwise(false));
|
|
||||||
poiMarker.setClickable(true);
|
|
||||||
poiMarker.setZIndex(MARKER_DOT);
|
|
||||||
poiMarker.setTitle(poiEntity.getName() + "");
|
|
||||||
poiMarker.setTag(poiEntity);
|
|
||||||
removablesLocality.add(poiMarker);
|
|
||||||
String poiGeo = initGeo(latLng);
|
|
||||||
geoMarker(poiGeo, poiMarker);
|
|
||||||
break;
|
|
||||||
case 2://充电站
|
|
||||||
BitmapDescriptor chargeDescriptor = null;
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
|
||||||
} else {
|
|
||||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
|
||||||
}
|
|
||||||
assert latLng != null;
|
|
||||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor)
|
|
||||||
.flat(true)
|
|
||||||
.anchor(0.5f, 1f)
|
|
||||||
.clockwise(false));
|
|
||||||
stationMarker.setClickable(true);
|
|
||||||
stationMarker.setZIndex(MARKER_DOT);
|
|
||||||
stationMarker.setTitle(poiEntity.getName() + "");
|
|
||||||
stationMarker.setTag(poiEntity);
|
|
||||||
removablesLocality.add(stationMarker);
|
|
||||||
String stationGeo = initGeo(latLng);
|
|
||||||
geoMarker(stationGeo, stationMarker);
|
|
||||||
break;
|
|
||||||
case 3://poi录像
|
|
||||||
BitmapDescriptor poiVideoDescriptor = null;
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
|
||||||
} else {
|
|
||||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoivideo);
|
|
||||||
}
|
|
||||||
assert latLng != null;
|
|
||||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor)
|
|
||||||
.anchor(0.5f, 1f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
poiVideoMarker.setClickable(true);
|
|
||||||
poiVideoMarker.setZIndex(MARKER_DOT);
|
|
||||||
poiVideoMarker.setTitle(poiEntity.getName() + "");
|
|
||||||
poiVideoMarker.setTag(poiEntity);
|
|
||||||
removablesLocality.add(poiVideoMarker);
|
|
||||||
String poiVideoGeo = initGeo(latLng);
|
|
||||||
geoMarker(poiVideoGeo, poiVideoMarker);
|
|
||||||
break;
|
|
||||||
case 4://道路录像
|
|
||||||
BitmapDescriptor roadDescriptor = null;
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
|
||||||
} else {
|
|
||||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
|
||||||
}
|
|
||||||
assert latLng != null;
|
|
||||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor)
|
|
||||||
.anchor(0.5f, 1f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
roadMarker.setClickable(true);
|
|
||||||
roadMarker.setZIndex(MARKER_DOT);
|
|
||||||
roadMarker.setTitle(poiEntity.getName() + "");
|
|
||||||
roadMarker.setTag(poiEntity);
|
|
||||||
removablesLocality.add(roadMarker);
|
|
||||||
String roadGeo = initGeo(latLng);
|
|
||||||
geoMarker(roadGeo, roadMarker);
|
|
||||||
break;
|
|
||||||
case 5://其他
|
|
||||||
BitmapDescriptor otherDescriptor = null;
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
|
||||||
} else {
|
|
||||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
|
||||||
}
|
|
||||||
assert latLng != null;
|
|
||||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor)
|
|
||||||
.anchor(0.5f, 1f)
|
|
||||||
.flat(true)
|
|
||||||
.clockwise(false));
|
|
||||||
otherMarker.setClickable(true);
|
|
||||||
otherMarker.setZIndex(MARKER_DOT);
|
|
||||||
otherMarker.setTitle(poiEntity.getName() + "");
|
|
||||||
otherMarker.setTag(poiEntity);
|
|
||||||
removablesLocality.add(otherMarker);
|
|
||||||
String otherGeo = initGeo(latLng);
|
|
||||||
geoMarker(otherGeo, otherMarker);
|
|
||||||
break;
|
|
||||||
case 6://面状任务
|
|
||||||
BitmapDescriptor Descriptor = null;
|
|
||||||
if (poiEntity.getTaskStatus() == 1) {
|
|
||||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
|
||||||
} else {
|
|
||||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayfacet);
|
|
||||||
}
|
|
||||||
assert latLng != null;
|
|
||||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor)
|
|
||||||
.anchor(0.5f, 1f)
|
|
||||||
.clockwise(false)
|
|
||||||
.flat(true));
|
|
||||||
planarMarker.setClickable(true);
|
|
||||||
planarMarker.setZIndex(MARKER_DOT);
|
|
||||||
planarMarker.setTitle(poiEntity.getName() + "");
|
|
||||||
planarMarker.setTag(poiEntity);
|
|
||||||
removablesLocality.add(planarMarker);
|
|
||||||
String planarGeo = initGeo(latLng);
|
|
||||||
geoMarker(planarGeo, planarMarker);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Message obtain = Message.obtain();
|
|
||||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
|
||||||
obtain.obj = allTaskStatus;
|
|
||||||
EventBus.getDefault().post(obtain);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).start();
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onEvent(Message data) {
|
public void onEvent(Message data) {
|
||||||
@@ -1356,6 +936,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
removableScreenMarker.get(i).remove();
|
removableScreenMarker.get(i).remove();
|
||||||
}
|
}
|
||||||
removableScreenMarker.clear();
|
removableScreenMarker.clear();
|
||||||
|
|
||||||
|
// 抽屉隐藏,如果当前自动规划按钮被选中
|
||||||
|
if (ivNaviDistance.isSelected()) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
handler.postDelayed(autoNaviRunnable, 3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (data.what == Constant.MAIN_BUTTON_VISITABLE) {//控制主界面各个按钮显隐状态的what值
|
} else if (data.what == Constant.MAIN_BUTTON_VISITABLE) {//控制主界面各个按钮显隐状态的what值
|
||||||
setMainButtonVisitable((Integer) data.obj);
|
setMainButtonVisitable((Integer) data.obj);
|
||||||
@@ -1973,7 +1560,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
point.set(minX, minY);
|
point.set(minX, minY);
|
||||||
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
|
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
|
||||||
poiEntityArrayList = new ArrayList<>();
|
poiEntityArrayList = new ArrayList<>();
|
||||||
com.vividsolutions.jts.geom.Polygon polygon = GeometryTools.createPolygon(lngArrayList);
|
org.locationtech.jts.geom.Polygon polygon = GeometryTools.createPolygon(lngArrayList);
|
||||||
//多点
|
//多点
|
||||||
MultiPoint multiPoint = GeometryTools.createMultiPoint(latList);
|
MultiPoint multiPoint = GeometryTools.createMultiPoint(latList);
|
||||||
//拿到覆蓋點
|
//拿到覆蓋點
|
||||||
@@ -2124,11 +1711,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*获取屏幕中心点位置*/
|
|
||||||
public LatLng getMapCenterPoint() {
|
|
||||||
return tencentMap.getCameraPosition().target;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*自定义dialog*/
|
/*自定义dialog*/
|
||||||
public void customDialog(List<PoiEntity> list, Marker marker) {
|
public void customDialog(List<PoiEntity> list, Marker marker) {
|
||||||
AlertDialog dialog = builder.create();
|
AlertDialog dialog = builder.create();
|
||||||
@@ -2251,4 +1833,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void geoMarker(String geo, Marker marker) {
|
||||||
|
if (!removableHashMap.containsKey(geo)) {
|
||||||
|
List<Marker> markers = new ArrayList<>();
|
||||||
|
markers.add(marker);
|
||||||
|
removableHashMap.put(geo, markers);
|
||||||
|
} else {
|
||||||
|
List<Marker> markers = removableHashMap.get(geo);
|
||||||
|
assert markers != null;
|
||||||
|
markers.add(marker);
|
||||||
|
removableHashMap.put(geo, markers);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,10 @@ public abstract class DialogCallback<T> extends JsonCallback<T> {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response<T> response) { }
|
public void onSuccess(Response<T> response) { }
|
||||||
|
|
||||||
|
public DialogCallback() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
public DialogCallback( Class<T> tClass) {
|
public DialogCallback( Class<T> tClass) {
|
||||||
super(tClass);
|
super(tClass);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
package com.navinfo.outdoor.http;
|
package com.navinfo.outdoor.http;
|
||||||
|
|
||||||
public class HttpInterface {
|
public class HttpInterface {
|
||||||
public static final String IP2 = "http://172.23.139.129:9999/m4";//测试接口
|
// public static final String IP = "http://172.23.138.133:9999/m4";//测试接口-IP
|
||||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//测试接口-外网
|
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网
|
||||||
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
public static final String IP2 = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||||
|
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||||
public static final String USER_PATH = "/user/";//我的
|
public static final String USER_PATH = "/user/";//我的
|
||||||
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
||||||
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
|
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
|
||||||
public static final String PRICE_PATH = "/price/";//提现
|
public static final String PRICE_PATH = "/price/";//提现
|
||||||
public static final String TASK_PATH = "/task/";//任务
|
public static final String TASK_PATH = "/task/";//任务
|
||||||
|
public static final String UPDATE_PHONE_NUM_PATH = "/user/user/{userId}/updateUserPhone"; // 修改手机号
|
||||||
|
|
||||||
/**
|
/**
|
||||||
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
|
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
|
||||||
@@ -64,7 +66,7 @@ public class HttpInterface {
|
|||||||
///m4/user/user/register
|
///m4/user/user/register
|
||||||
public static String USER_REGISTER = IP + USER_PATH + "user/register";//注册接口
|
public static String USER_REGISTER = IP + USER_PATH + "user/register";//注册接口
|
||||||
///m4/user/ phone/message
|
///m4/user/ phone/message
|
||||||
public static String USER_MESSAGE = IP + USER_PATH + "phone/message";//获取验证码 type 1:注册获取 2:更新
|
public static String USER_MESSAGE = IP + USER_PATH + "phone/message";//获取验证码 type 1:注册获取 2:更新 3: 修改手机号
|
||||||
///m4/user/user/forgetPassword
|
///m4/user/user/forgetPassword
|
||||||
public static String USER_FORGET_PASSWORD = IP + USER_PATH + "user/forgetPassword";//忘记密码
|
public static String USER_FORGET_PASSWORD = IP + USER_PATH + "user/forgetPassword";//忘记密码
|
||||||
|
|
||||||
@@ -134,6 +136,10 @@ public class HttpInterface {
|
|||||||
public static String SUBMIT_POLYGON_TASK = null;//面状任务开始采集
|
public static String SUBMIT_POLYGON_TASK = null;//面状任务开始采集
|
||||||
//dtxbmaps.navinfo.com/dtxb_test/m4/msgList/InfoPush/28/push?type=0
|
//dtxbmaps.navinfo.com/dtxb_test/m4/msgList/InfoPush/28/push?type=0
|
||||||
public static String MESSAGE_INFO_PUSH = null;//消息通知
|
public static String MESSAGE_INFO_PUSH = null;//消息通知
|
||||||
|
public static String UPDATE_PHONE_NUM_URL = null;//消息通知
|
||||||
|
public static String CREATE_UPLOAD_TASK = null;//创建断点续传任务
|
||||||
|
public static String UPLOAD_SPLITE_TASK = null;//执行断点续传
|
||||||
|
public static String UPLOAD_TASK_FINISH = null;//断点续传完成
|
||||||
|
|
||||||
public static String CONTACT_US = "";//联系我们
|
public static String CONTACT_US = "";//联系我们
|
||||||
public static String ABOUT_MAP = "";//关于 -关于地图寻宝
|
public static String ABOUT_MAP = "";//关于 -关于地图寻宝
|
||||||
@@ -234,5 +240,9 @@ public class HttpInterface {
|
|||||||
UNRECEIVED_POLYGON_TASK = IP + TASK_PATH + "task/" + userId + "/unReceivedTask";//所有類型结束领取
|
UNRECEIVED_POLYGON_TASK = IP + TASK_PATH + "task/" + userId + "/unReceivedTask";//所有類型结束领取
|
||||||
COMPLETE = IP + TASK_PATH + "polygonTask/" + userId + "/complete";//面状任务结束领取
|
COMPLETE = IP + TASK_PATH + "polygonTask/" + userId + "/complete";//面状任务结束领取
|
||||||
SUBMIT_POLYGON_TASK = IP + TASK_PATH + "polygonTask/" + userId + "/submitPolygontask";//面状任务开始采集
|
SUBMIT_POLYGON_TASK = IP + TASK_PATH + "polygonTask/" + userId + "/submitPolygontask";//面状任务开始采集
|
||||||
|
UPDATE_PHONE_NUM_URL = IP + UPDATE_PHONE_NUM_PATH.replace("{userId}", userId);// 修改手机号
|
||||||
|
CREATE_UPLOAD_TASK = IP + TASK_PATH + "task/"+ userId+"/createUploadTask";// 创建断点续传任务
|
||||||
|
UPLOAD_SPLITE_TASK = IP + TASK_PATH + "task/"+ userId+"/uploadSplitTask";// 执行断点续传
|
||||||
|
UPLOAD_TASK_FINISH = IP + TASK_PATH + "task/"+ userId+"/uploadTaskFinish";// 断点续传完成
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.navinfo.outdoor.room;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.OnConflictStrategy;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.bean.LocationRecorder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问数据库操作的接口
|
||||||
|
*/
|
||||||
|
@Dao
|
||||||
|
public interface LocationRecorderDao {
|
||||||
|
/*
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
@Query("SELECT * FROM LocationRecorder")
|
||||||
|
List<LocationRecorder> getAllLocationRecorder();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM LocationRecorder where time >= :startTime and time<=:endTime order by time")
|
||||||
|
List<LocationRecorder> getLocationRecorderByTime(long startTime, long endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
void insertLocationRecorder(LocationRecorder... locationRecorders);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*/
|
||||||
|
@Update
|
||||||
|
void updateLocationRecorder(LocationRecorder... locationRecorders);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Delete
|
||||||
|
void deleteLocationRecorder(LocationRecorder... locationRecorders);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件删除
|
||||||
|
*/
|
||||||
|
@Query("DELETE FROM LocationRecorder where time >= :startTime and time<=:endTime ")
|
||||||
|
void deleteForTime(long startTime, long endTime);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部删除
|
||||||
|
*/
|
||||||
|
@Query("DELETE FROM LocationRecorder")
|
||||||
|
void deleteAllLocationRecorder();
|
||||||
|
}
|
||||||
@@ -33,6 +33,8 @@ public interface PoiDao {
|
|||||||
// @Query("SELECT * FROM poi WHERE taskStatus=:taskStatus and type=:type and (:isExclusive=-1 or isExclusive=:isExclusive) ")
|
// @Query("SELECT * FROM poi WHERE taskStatus=:taskStatus and type=:type and (:isExclusive=-1 or isExclusive=:isExclusive) ")
|
||||||
List<PoiEntity> getAllTaskStatus(int taskStatus, int taskStatus1, int type, int type1, int isExclusive, int isExclusive1);
|
List<PoiEntity> getAllTaskStatus(int taskStatus, int taskStatus1, int type, int type1, int isExclusive, int isExclusive1);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM poi WHERE taskStatus=:taskStatus and type=:type")
|
||||||
|
List<PoiEntity> getPoiEntityByTaskStatus(int taskStatus, int type);
|
||||||
|
|
||||||
@Query("SELECT * FROM poi where id=:id")
|
@Query("SELECT * FROM poi where id=:id")
|
||||||
PoiEntity getPoiEntity(String id);
|
PoiEntity getPoiEntity(String id);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import androidx.room.migration.Migration;
|
|||||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||||
|
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.bean.LocationRecorder;
|
||||||
import com.navinfo.outdoor.util.SdkFolderCreate;
|
import com.navinfo.outdoor.util.SdkFolderCreate;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -27,7 +28,7 @@ import java.io.File;
|
|||||||
* 如果需要在主线程调用则使用allowMainThreadQueries进行说明。
|
* 如果需要在主线程调用则使用allowMainThreadQueries进行说明。
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Database(entities = {PoiEntity.class,ChargingPileEntity.class}, version = 2, exportSchema = false)
|
@Database(entities = {PoiEntity.class,ChargingPileEntity.class, LocationRecorder.class}, version = 3, exportSchema = false)
|
||||||
public abstract class PoiDatabase extends RoomDatabase {
|
public abstract class PoiDatabase extends RoomDatabase {
|
||||||
private static final String DB_NAME = "navinfo.db";
|
private static final String DB_NAME = "navinfo.db";
|
||||||
private static volatile PoiDatabase instance;
|
private static volatile PoiDatabase instance;
|
||||||
@@ -50,6 +51,7 @@ public abstract class PoiDatabase extends RoomDatabase {
|
|||||||
getDbName=dbFolder.getAbsolutePath()+"/"+DB_NAME;
|
getDbName=dbFolder.getAbsolutePath()+"/"+DB_NAME;
|
||||||
return Room.databaseBuilder(context, PoiDatabase.class, Constant.POI_DAO+"/"+DB_NAME)
|
return Room.databaseBuilder(context, PoiDatabase.class, Constant.POI_DAO+"/"+DB_NAME)
|
||||||
.addMigrations(migration_1_2)
|
.addMigrations(migration_1_2)
|
||||||
|
.addMigrations(migration_2_3)
|
||||||
//.fallbackToDestructiveMigration()//数据库更新时删除数据重新创建 改动特别大的时候在用
|
//.fallbackToDestructiveMigration()//数据库更新时删除数据重新创建 改动特别大的时候在用
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
@@ -65,23 +67,20 @@ public abstract class PoiDatabase extends RoomDatabase {
|
|||||||
private static Migration migration_2_3 = new Migration(2, 3) {
|
private static Migration migration_2_3 = new Migration(2, 3) {
|
||||||
@Override
|
@Override
|
||||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
database.execSQL("ALTER TABLE poi ADD stage TEXT DEFAULT ''");
|
database.execSQL("CREATE TABLE LocationRecorder (" +
|
||||||
}
|
"time INTEGER PRIMARY KEY NOT NULL ," +
|
||||||
};
|
"tencentLocationX REAL NOT NULL ," +
|
||||||
private static Migration migration_3_4 = new Migration(3, 4) {
|
"tencentLocationY REAL NOT NULL ," +
|
||||||
@Override
|
"gpsLocationX REAL NOT NULL ," +
|
||||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
"gpsLocationY REAL NOT NULL ," +
|
||||||
database.execSQL("ALTER TABLE poi ADD views INTEGER NOT NULL DEFAULT 0");
|
"rssi INTEGER NOT NULL ," +
|
||||||
}
|
"bearing REAL NOT NULL," +
|
||||||
};
|
"satelliteCount INTEGER NOT NULL ," +
|
||||||
private static Migration migration_4_5 = new Migration(4, 5) {
|
"imgFileName TEXT)");//添加轨迹记录功能
|
||||||
@Override
|
|
||||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
|
||||||
database.execSQL("ALTER TABLE poi ADD partner INTEGER NOT NULL DEFAULT 0");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public abstract PoiDao getPoiDao();//其他信息
|
public abstract PoiDao getPoiDao();//其他信息
|
||||||
public abstract ChargingPileDao getChargingPileDao();//充电桩
|
public abstract ChargingPileDao getChargingPileDao();//充电桩
|
||||||
|
public abstract LocationRecorderDao getRecorderDao();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,6 +138,10 @@ public class PoiEntity implements Serializable {
|
|||||||
|
|
||||||
public void setTaskStatus(int taskStatus) {
|
public void setTaskStatus(int taskStatus) {
|
||||||
this.taskStatus = taskStatus;
|
this.taskStatus = taskStatus;
|
||||||
|
if (this.taskStatus==100) { // 当数据上传成功后,重置其bodyId和taskId
|
||||||
|
setBodyId(0);
|
||||||
|
setTaskId(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|||||||
@@ -417,12 +417,14 @@ public class AWMp4ParserHelper {
|
|||||||
if (strings != null) {
|
if (strings != null) {
|
||||||
for (int i = 0; i < strings.size(); i++) {
|
for (int i = 0; i < strings.size(); i++) {
|
||||||
String[] split = strings.get(i).split(",");
|
String[] split = strings.get(i).split(",");
|
||||||
LatLng latLng = new LatLng();
|
if (split.length>3) {
|
||||||
latLng.setLatitude(Double.valueOf(split[2]));
|
LatLng latLng = new LatLng();
|
||||||
latLng.setLongitude(Double.valueOf(split[3]));
|
latLng.setLatitude(Double.valueOf(split[2]));
|
||||||
latLags.add(latLng);
|
latLng.setLongitude(Double.valueOf(split[3]));
|
||||||
|
latLags.add(latLng);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (strings.size() == 1) {
|
if (latLags.size() == 1) {
|
||||||
LatLng latLng = latLags.get(0);
|
LatLng latLng = latLags.get(0);
|
||||||
latLags.add(latLng);
|
latLags.add(latLng);
|
||||||
}
|
}
|
||||||
|
|||||||
352
app/src/main/java/com/navinfo/outdoor/util/DataSaveUtils.java
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.github.lazylibrary.util.FileUtils;
|
||||||
|
import com.github.lazylibrary.util.MD5;
|
||||||
|
import com.github.lazylibrary.util.ZipUtil;
|
||||||
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
|
import com.hjq.permissions.Permission;
|
||||||
|
import com.hjq.permissions.XXPermissions;
|
||||||
|
import com.kongzue.dialog.v3.TipDialog;
|
||||||
|
import com.kongzue.dialog.v3.WaitDialog;
|
||||||
|
import com.lzy.okgo.OkGo;
|
||||||
|
import com.lzy.okgo.model.HttpParams;
|
||||||
|
import com.lzy.okgo.model.Response;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.api.UserApplication;
|
||||||
|
import com.navinfo.outdoor.bean.CommonRequestSend;
|
||||||
|
import com.navinfo.outdoor.bean.CommonResponse;
|
||||||
|
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||||
|
import com.navinfo.outdoor.http.Callback;
|
||||||
|
import com.navinfo.outdoor.http.DialogCallback;
|
||||||
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
|
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||||
|
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||||
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
|
import com.umeng.commonsdk.debug.UMLog;
|
||||||
|
import com.umeng.umcrash.UMCrash;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableEmitter;
|
||||||
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.ObservableSource;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.Single;
|
||||||
|
import io.reactivex.SingleObserver;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.functions.Action;
|
||||||
|
import io.reactivex.functions.Consumer;
|
||||||
|
import io.reactivex.functions.Function;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
|
public class DataSaveUtils {
|
||||||
|
private static DataSaveUtils instance;
|
||||||
|
|
||||||
|
public static DataSaveUtils getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new DataSaveUtils();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface UploadCallback {
|
||||||
|
public void onStart();
|
||||||
|
public void onFinish();
|
||||||
|
public void onError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Single<List<Map.Entry<Integer, File>>> getUploadSpliteFilesObservble(Activity mContext, PoiEntity poiEntity, List<File> poiPicList) {
|
||||||
|
int auditId = poiEntity.getBodyId();
|
||||||
|
File zipFile = new File(poiPicList.get(0).getParentFile(), auditId+".zip");
|
||||||
|
return Observable.create(new ObservableOnSubscribe<File>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<File> emitter) throws Exception {
|
||||||
|
if (!zipFile.exists()) {
|
||||||
|
// 开始压缩文件
|
||||||
|
ZipUtil.zipFiles(poiPicList, zipFile, "", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
emitter.onNext(zipFile);
|
||||||
|
emitter.onComplete();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(Schedulers.computation())
|
||||||
|
// 切分数据,发送开始上传请求
|
||||||
|
.map(new Function<File, Map<Integer, File>>() {
|
||||||
|
@Override
|
||||||
|
public Map<Integer, File> apply(File file) throws Exception {
|
||||||
|
// 每次执行上传都会切分数据,因为都会执行第一步,向服务器请求需要上传的分包数据
|
||||||
|
List<File> splitFiles = FileSpliteMergeUtils.splitFile(file, Constant.DEFAULT_CUT_SIZE);
|
||||||
|
List<Long> chunkSizeList = new ArrayList<>();
|
||||||
|
for (File f: splitFiles) {
|
||||||
|
chunkSizeList.add(f.length());
|
||||||
|
}
|
||||||
|
CommonResponse<String> response = createUploadTask(mContext, auditId, file.length(), chunkSizeList);
|
||||||
|
if (response!=null) {
|
||||||
|
// 请求成功,获取需要上传的分包index
|
||||||
|
String body = response.getBody();
|
||||||
|
if (response.getCode() == 213) { // 该数据已经上传成功,自动切换该数据为已上传状态
|
||||||
|
poiEntity.setTaskStatus(100);
|
||||||
|
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
ToastUtils.Message(mContext, "数据:"+poiEntity.getName()+"已成功上传!");
|
||||||
|
}
|
||||||
|
if (body==null) {
|
||||||
|
throw new Exception(response.getMessage());
|
||||||
|
}
|
||||||
|
if (body.isEmpty()) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
String[] needUploadStrIndex = body.split(",");
|
||||||
|
// 批量转换String为int
|
||||||
|
int[] needUploadIndex = new int[needUploadStrIndex.length];
|
||||||
|
for (int i = 0; i < needUploadStrIndex.length; i++) {
|
||||||
|
needUploadIndex[i] = Integer.parseInt(needUploadStrIndex[i]);
|
||||||
|
}
|
||||||
|
// 根据返回的index,将需要上传的切分包数据流转到下一个流程
|
||||||
|
Map<Integer, File> needUploadFileMap = new HashMap<>();
|
||||||
|
for (int index: needUploadIndex) {
|
||||||
|
if (index<splitFiles.size()) {
|
||||||
|
needUploadFileMap.put(index, splitFiles.get(index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 遍历已存在的切割文件,如果不需要上传,则删除该分包数据
|
||||||
|
for (int i = 0; i < splitFiles.size(); i++) {
|
||||||
|
if (!needUploadFileMap.keySet().contains(i)) {
|
||||||
|
splitFiles.get(i).delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return needUploadFileMap;
|
||||||
|
} else {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.flatMap(new Function<Map<Integer, File>, ObservableSource<Map.Entry<Integer, File>>>() {
|
||||||
|
@Override
|
||||||
|
public ObservableSource<Map.Entry<Integer, File>> apply(Map<Integer, File> filesMap) throws Exception {
|
||||||
|
// 将每个切分的文件file作为发送者重新发送出去
|
||||||
|
return Observable.fromIterable(filesMap.entrySet());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.doOnNext(new Consumer<Map.Entry<Integer, File>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Map.Entry<Integer, File> fileEntry) throws Exception {
|
||||||
|
// 执行上传流程
|
||||||
|
CommonResponse response = uploadSplitTask(mContext, auditId, fileEntry.getKey(), fileEntry.getValue());
|
||||||
|
if (response.getCode() != 200) {
|
||||||
|
throw new Exception(response.getMessage());
|
||||||
|
} else {
|
||||||
|
UMLog.mutlInfo(3, "已上传分包"+fileEntry.getKey());
|
||||||
|
// 上传成功,则删除该分包数据
|
||||||
|
if (fileEntry.getValue().exists()) {
|
||||||
|
fileEntry.getValue().delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.toList()
|
||||||
|
.observeOn(Schedulers.io())
|
||||||
|
// 调用执行成功的接口
|
||||||
|
.doOnSuccess(new Consumer<List<Map.Entry<Integer, File>>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(List<Map.Entry<Integer, File>> entries) throws Exception {
|
||||||
|
// 最终成功,调用finish接口
|
||||||
|
CommonResponse response = uploadTaskFinish(mContext, auditId);
|
||||||
|
if (response.getCode() == 200) { // 更新成功,再次更新本地数据库
|
||||||
|
poiEntity.setTaskStatus(100);
|
||||||
|
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
// 同时删除关联的照片文件和压缩包文件
|
||||||
|
if (zipFile.exists()) {
|
||||||
|
zipFile.delete();
|
||||||
|
}
|
||||||
|
if (poiPicList!=null&&!poiPicList.isEmpty()) {
|
||||||
|
for (File picFile: poiPicList
|
||||||
|
) {
|
||||||
|
picFile.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Exception("数据:" + poiEntity.getName() + " 上传失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量上传文件
|
||||||
|
public void uploadFiles(Activity mContext, PoiEntity poiEntity, List<File> poiPicList, UploadCallback callback) {
|
||||||
|
getUploadSpliteFilesObservble(mContext, poiEntity, poiPicList)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new SingleObserver<List<Map.Entry<Integer, File>>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
callback.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<Map.Entry<Integer, File>> entries) {
|
||||||
|
ToastUtils.Message(mContext, "分包数据上传完成!");
|
||||||
|
Message obtain1 = Message.obtain();
|
||||||
|
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
||||||
|
// 提醒用户数据上传完成
|
||||||
|
obtain1.obj = "数据:" + poiEntity.getName() + " 上传成功";
|
||||||
|
EventBus.getDefault().post(obtain1);
|
||||||
|
callback.onFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
ToastUtils.Message(mContext, e.getMessage());
|
||||||
|
Message obtain1 = Message.obtain();
|
||||||
|
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
||||||
|
// 提醒用户数据上传完成
|
||||||
|
obtain1.obj = e.getMessage();
|
||||||
|
EventBus.getDefault().post(obtain1);
|
||||||
|
callback.onError();
|
||||||
|
callback.onFinish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建分包上传任务
|
||||||
|
* */
|
||||||
|
private CommonResponse createUploadTask(Activity mContext, int auditId, long fileSize, List<Long> chunkSize) {
|
||||||
|
HttpParams httpParams = new HttpParams();
|
||||||
|
httpParams.put("auditId", auditId);
|
||||||
|
httpParams.put("fileSize", fileSize);
|
||||||
|
httpParams.put("chunkSize", list2Str(chunkSize));
|
||||||
|
CommonRequestSend commonRequestSend = new CommonRequestSend<CommonResponse<String>>();
|
||||||
|
CommonResponse response = commonRequestSend.getMethodCommonSync(mContext, HttpInterface.CREATE_UPLOAD_TASK, httpParams, Constant.DEFAULT_TIME_OUT, new CommonResponse<String>().getClass());
|
||||||
|
if (response!=null) {
|
||||||
|
if (response.getCode() == 200) {
|
||||||
|
return response;
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(mContext, response.getMessage());
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传分包数据
|
||||||
|
* */
|
||||||
|
private CommonResponse uploadSplitTask(Activity mContext, int auditId, int chunkIndex, File splitFile) {
|
||||||
|
HttpParams httpParams = new HttpParams();
|
||||||
|
httpParams.put("auditId", auditId);
|
||||||
|
httpParams.put("chunkIndex", chunkIndex);
|
||||||
|
httpParams.put("md5", MD5.md5sum(splitFile.getAbsolutePath()).toLowerCase());
|
||||||
|
httpParams.put("file", splitFile);
|
||||||
|
|
||||||
|
// List<File> fileList = new ArrayList<>();
|
||||||
|
// fileList.add(splitFile);
|
||||||
|
CommonRequestSend commonRequestSend = new CommonRequestSend<CommonResponse<String>>();
|
||||||
|
CommonResponse response = commonRequestSend.postMethodCommonSync(mContext, HttpInterface.UPLOAD_SPLITE_TASK, httpParams, Constant.DEFAULT_TIME_OUT, null, new CommonResponse<String>().getClass());
|
||||||
|
if (response!=null) {
|
||||||
|
if (response.getCode() == 200) {
|
||||||
|
return response;
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(mContext, response.getMessage());
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 分包数据上传完成
|
||||||
|
* */
|
||||||
|
private CommonResponse uploadTaskFinish(Activity mContext, int auditId) {
|
||||||
|
HttpParams httpParams = new HttpParams();
|
||||||
|
httpParams.put("auditId", auditId);
|
||||||
|
CommonRequestSend commonRequestSend = new CommonRequestSend<CommonResponse<String>>();
|
||||||
|
CommonResponse response = commonRequestSend.getMethodCommonSync(mContext, HttpInterface.UPLOAD_TASK_FINISH, httpParams, Constant.DEFAULT_TIME_OUT, new CommonResponse<String>().getClass());
|
||||||
|
if (response!=null) {
|
||||||
|
if (response.getCode() == 200) {
|
||||||
|
return response;
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(mContext, response.getMessage());
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable savePoiEntity(Context mContext, PoiEntity poiEntity) {
|
||||||
|
return getPermission(mContext)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.map(new Function() {
|
||||||
|
@Override
|
||||||
|
public PoiEntity apply(Object o) {
|
||||||
|
return poiEntity;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 判断当前POI状态,根据状态处理随后的流程
|
||||||
|
.map(new Function<PoiEntity, PoiEntity>() {
|
||||||
|
@Override
|
||||||
|
public PoiEntity apply(PoiEntity entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Observable getPermission(Context mContext) {
|
||||||
|
return Observable.create(
|
||||||
|
new ObservableOnSubscribe<Object>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<Object> emitter) throws Exception {
|
||||||
|
XXPermissions.with(mContext)
|
||||||
|
//读写权限
|
||||||
|
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||||
|
.request(new OnPermissionCallback() {
|
||||||
|
@Override
|
||||||
|
public void onGranted(List<String> permissions, boolean all) {
|
||||||
|
if (all) {
|
||||||
|
emitter.onNext("permission Ok");
|
||||||
|
} else {
|
||||||
|
emitter.onError(new Throwable("未获取文件访问权限,请确认!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDenied(List<String> permissions, boolean never) {
|
||||||
|
if (never) {
|
||||||
|
emitter.onError(new Throwable("未获取文件访问权限,请确认!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String list2Str(List chunkSize) {
|
||||||
|
StringBuilder result = new StringBuilder("");
|
||||||
|
for (Object chunk: chunkSize) {
|
||||||
|
result.append(chunk).append(",");
|
||||||
|
}
|
||||||
|
if (result.length()>0) {
|
||||||
|
return result.substring(0, result.length()-1);
|
||||||
|
}
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package com.navinfo.outdoor.util
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import com.navinfo.outdoor.api.Constant
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileNotFoundException
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.RandomAccessFile
|
||||||
|
import java.lang.Exception
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiaoZhongKai
|
||||||
|
* @Date: 2021/7/28 19:42
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
object FileSpliteMergeUtils {
|
||||||
|
const val TAG = "FileUtils"
|
||||||
|
//默认切割文件的大小
|
||||||
|
// private const val DEFAULT_CUT_SIZE: Long = 5*1024*1024//5MB
|
||||||
|
private const val DEFAULT_CUT_SIZE: Long = Constant.DEFAULT_CUT_SIZE//5MB
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分割文件
|
||||||
|
* [sourceFile] 需要分割的源文件
|
||||||
|
* [cutSize] 每个文件的大小
|
||||||
|
* @return 分段文件集合
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun splitFile(sourceFile: File,cutSize: Long = DEFAULT_CUT_SIZE): List<File>{
|
||||||
|
//分段片文件集合
|
||||||
|
val singleFileList = mutableListOf<File>()
|
||||||
|
|
||||||
|
val totalLength = sourceFile.length()
|
||||||
|
//分段数量
|
||||||
|
val count = if(totalLength % cutSize == 0L) totalLength/cutSize else totalLength/cutSize +1
|
||||||
|
Log.d(TAG,"split file count:$count")
|
||||||
|
val mRandomAccFile = RandomAccessFile(sourceFile,"r")
|
||||||
|
try {
|
||||||
|
// val length = mRandomAccFile.length()
|
||||||
|
// val singleSize = length/count//源文件分割后每个文件的大小
|
||||||
|
var offSet = 0L
|
||||||
|
|
||||||
|
for (i in 0 until count){//最后一个文件单独处理,因为它的大小可能不等于singleSize
|
||||||
|
val begin = offSet
|
||||||
|
// 如果当前index对应的数据没有超过文件大小,则使用cutSize,否则使用文件实际剩余大小
|
||||||
|
var end = begin + cutSize
|
||||||
|
if (totalLength<=end) {
|
||||||
|
end = totalLength;
|
||||||
|
}
|
||||||
|
val file = createSingleFile(sourceFile,i)
|
||||||
|
offSet = writeFile(mRandomAccFile,file,begin,end)
|
||||||
|
singleFileList.add(file)
|
||||||
|
}
|
||||||
|
// if (length - offSet > 0){//最后一个文件
|
||||||
|
// val file = createSingleFile(sourceFile,count-1)
|
||||||
|
// writeFile(mRandomAccFile,file,offSet,length)
|
||||||
|
// singleFileList.add(file)
|
||||||
|
// }
|
||||||
|
|
||||||
|
}catch (e: FileNotFoundException){
|
||||||
|
e.printStackTrace()
|
||||||
|
}catch (e: IOException){
|
||||||
|
e.printStackTrace()
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
mRandomAccFile.close()
|
||||||
|
}catch (e: IOException){
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return singleFileList
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createSingleFile(sourceFile: File,index: Long): File{
|
||||||
|
val path = sourceFile.absolutePath.substringBeforeLast(".")
|
||||||
|
// val suffix = sourceFile.name.substringAfterLast(".")
|
||||||
|
val suffix = "tmp";
|
||||||
|
val file = File("${path}_${index}.${suffix}")
|
||||||
|
if (file.exists()){
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
Log.d(TAG,"sourceFilePath:${sourceFile.absolutePath}")
|
||||||
|
file.createNewFile()
|
||||||
|
Log.d(TAG,"single file path:${file.absolutePath}")
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun writeFile(inFile: RandomAccessFile,single: File,begin: Long,end: Long): Long{
|
||||||
|
var endPointer = 0L
|
||||||
|
val out = RandomAccessFile(single,"rw")
|
||||||
|
var index = 0
|
||||||
|
try {
|
||||||
|
val byte = ByteArray(1024)
|
||||||
|
inFile.seek(begin)
|
||||||
|
while (inFile.read(byte).also { index = it } != -1 && inFile.filePointer <= end){
|
||||||
|
out.write(byte,0,index)
|
||||||
|
}
|
||||||
|
endPointer = inFile.filePointer
|
||||||
|
}catch (e: Exception){
|
||||||
|
e.printStackTrace()
|
||||||
|
}finally {
|
||||||
|
out.close()
|
||||||
|
}
|
||||||
|
return endPointer - index // 减去最后一次读取的字节数,因为while循环中会先读取文件,导致filePointer字段向后移动index,但是后面的判断条件导致循环跳出,所以要将下次读取的offset向前移动
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并文件
|
||||||
|
* [files] 需要合并的文件集合
|
||||||
|
* [outputFilePath] 输出文件的路径 eg:D:/test
|
||||||
|
* [outputFileName] 输出文件的名称 eg:crawler.json
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun mergeFile(files: List<File>,outputFilePath: String,outputFileName: String){
|
||||||
|
|
||||||
|
val parentFile = File(outputFilePath)
|
||||||
|
val targetFile = File(outputFilePath+File.separator+outputFileName)
|
||||||
|
if (!parentFile.exists()){
|
||||||
|
parentFile.mkdirs()
|
||||||
|
}
|
||||||
|
if (!targetFile.exists()){
|
||||||
|
targetFile.createNewFile()
|
||||||
|
}
|
||||||
|
|
||||||
|
val outRaf = RandomAccessFile(targetFile,"rw")
|
||||||
|
try {
|
||||||
|
files.forEach { file ->
|
||||||
|
val reader = RandomAccessFile(file,"r")
|
||||||
|
val byte = ByteArray(1024)
|
||||||
|
var index = 0
|
||||||
|
while (reader.read(byte).also { index = it } != -1){
|
||||||
|
outRaf.write(byte,0,index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
files.forEach {
|
||||||
|
if (it.exists()){
|
||||||
|
it.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.d(TAG,"merge output file path:${targetFile.absolutePath}")
|
||||||
|
}catch (e: IOException){
|
||||||
|
e.printStackTrace()
|
||||||
|
}catch (e: FileNotFoundException){
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
outRaf.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import android.content.Intent;
|
|||||||
import android.location.Address;
|
import android.location.Address;
|
||||||
import android.location.Criteria;
|
import android.location.Criteria;
|
||||||
import android.location.Geocoder;
|
import android.location.Geocoder;
|
||||||
|
import android.location.GnssStatus;
|
||||||
import android.location.GpsSatellite;
|
import android.location.GpsSatellite;
|
||||||
import android.location.GpsStatus;
|
import android.location.GpsStatus;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
@@ -18,6 +19,8 @@ import android.provider.Settings;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -52,7 +55,7 @@ public class GPSUtils {
|
|||||||
// getLocationData(location);
|
// getLocationData(location);
|
||||||
mLocation = mLocationManager.getLastKnownLocation(bestProvider);
|
mLocation = mLocationManager.getLastKnownLocation(bestProvider);
|
||||||
// 监听状态
|
// 监听状态
|
||||||
mLocationManager.addGpsStatusListener(listener);
|
mLocationManager.registerGnssStatusCallback(listener);
|
||||||
// 绑定监听,有4个参数
|
// 绑定监听,有4个参数
|
||||||
// 参数1,设备:有GPS_PROVIDER和NETWORK_PROVIDER两种
|
// 参数1,设备:有GPS_PROVIDER和NETWORK_PROVIDER两种
|
||||||
// 参数2,位置信息更新周期,单位毫秒
|
// 参数2,位置信息更新周期,单位毫秒
|
||||||
@@ -130,6 +133,10 @@ public class GPSUtils {
|
|||||||
|
|
||||||
//位置信息变化时触发
|
//位置信息变化时触发
|
||||||
public void onLocationChanged(Location location) {
|
public void onLocationChanged(Location location) {
|
||||||
|
if (mContext == null) {
|
||||||
|
mLocationManager.removeUpdates(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
mLocation = location;
|
mLocation = location;
|
||||||
Log.i(TAG, "时间:" + location.getTime());
|
Log.i(TAG, "时间:" + location.getTime());
|
||||||
Log.i(TAG, "经度:" + location.getLongitude());
|
Log.i(TAG, "经度:" + location.getLongitude());
|
||||||
@@ -183,39 +190,35 @@ public class GPSUtils {
|
|||||||
|
|
||||||
|
|
||||||
// 状态监听
|
// 状态监听
|
||||||
GpsStatus.Listener listener = new GpsStatus.Listener() {
|
GnssStatus.Callback listener = new GnssStatus.Callback() {
|
||||||
public void onGpsStatusChanged(int event) {
|
@Override
|
||||||
switch (event) {
|
public void onStarted() {
|
||||||
// 第一次定位
|
super.onStarted();
|
||||||
case GpsStatus.GPS_EVENT_FIRST_FIX:
|
Log.i(TAG, "定位启动");
|
||||||
Log.i(TAG, "第一次定位");
|
}
|
||||||
break;
|
|
||||||
// 卫星状态改变
|
@Override
|
||||||
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
|
public void onStopped() {
|
||||||
Log.i(TAG, "卫星状态改变");
|
super.onStopped();
|
||||||
GpsStatus gpsStatus = mLocationManager.getGpsStatus(null);
|
Log.i(TAG, "定位结束");
|
||||||
// 获取卫星颗数的默认最大值
|
}
|
||||||
int maxSatellites = gpsStatus.getMaxSatellites();
|
|
||||||
// 创建一个迭代器保存所有卫星
|
@Override
|
||||||
Iterator<GpsSatellite> iters = gpsStatus.getSatellites()
|
public void onFirstFix(int ttffMillis) {
|
||||||
.iterator();
|
super.onFirstFix(ttffMillis);
|
||||||
int count = 0;
|
Log.i(TAG, "第一次定位");
|
||||||
while (iters.hasNext() && count <= maxSatellites) {
|
}
|
||||||
GpsSatellite s = iters.next();
|
|
||||||
count++;
|
@Override
|
||||||
}
|
public void onSatelliteStatusChanged(@NonNull GnssStatus status) {
|
||||||
if (onClickGPSStatus != null) {
|
super.onSatelliteStatusChanged(status);
|
||||||
onClickGPSStatus.onGpsCount(count);
|
if (mContext == null) {
|
||||||
}
|
mLocationManager.unregisterGnssStatusCallback(this);
|
||||||
break;
|
return;
|
||||||
//定位启动
|
}
|
||||||
case GpsStatus.GPS_EVENT_STARTED:
|
Log.i(TAG, "卫星状态改变");
|
||||||
Log.i(TAG, "定位启动");
|
if (onClickGPSStatus != null) {
|
||||||
break;
|
onClickGPSStatus.onGpsCount(status.getSatelliteCount());
|
||||||
//定位结束
|
|
||||||
case GpsStatus.GPS_EVENT_STOPPED:
|
|
||||||
Log.i(TAG, "定位结束");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -229,4 +232,8 @@ public class GPSUtils {
|
|||||||
void onGpsCount(int count);
|
void onGpsCount(int count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void unRegisterAllListener() {
|
||||||
|
mLocationManager.unregisterGnssStatusCallback(listener);
|
||||||
|
mLocationManager.removeUpdates(locationListener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.navinfo.outdoor.util;
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
|
|||||||
@@ -3,17 +3,18 @@ package com.navinfo.outdoor.util;
|
|||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.activity.MyCoordinate;
|
||||||
import com.navinfo.outdoor.room.PoiEntity;
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
import org.locationtech.jts.geom.GeometryFactory;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import org.locationtech.jts.geom.LineString;
|
||||||
import com.vividsolutions.jts.geom.MultiLineString;
|
import org.locationtech.jts.geom.MultiLineString;
|
||||||
import com.vividsolutions.jts.geom.MultiPoint;
|
import org.locationtech.jts.geom.MultiPoint;
|
||||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
import org.locationtech.jts.geom.MultiPolygon;
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import org.locationtech.jts.geom.Polygon;
|
||||||
import com.vividsolutions.jts.io.WKTReader;
|
import org.locationtech.jts.io.WKTReader;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -263,8 +264,8 @@ public class GeometryTools {
|
|||||||
/**
|
/**
|
||||||
* 创建点
|
* 创建点
|
||||||
*/
|
*/
|
||||||
public com.vividsolutions.jts.geom.Point createPoint(Coordinate chord) {
|
public org.locationtech.jts.geom.Point createPoint(Coordinate chord) {
|
||||||
com.vividsolutions.jts.geom.Point point = null;
|
org.locationtech.jts.geom.Point point = null;
|
||||||
GeometryFactory factory = new GeometryFactory();
|
GeometryFactory factory = new GeometryFactory();
|
||||||
point = factory.createPoint(chord);
|
point = factory.createPoint(chord);
|
||||||
return point;
|
return point;
|
||||||
@@ -286,7 +287,7 @@ public class GeometryTools {
|
|||||||
try {
|
try {
|
||||||
geometers = reader.read(geometry);
|
geometers = reader.read(geometry);
|
||||||
if (geometers != null) {
|
if (geometers != null) {
|
||||||
com.vividsolutions.jts.geom.Point point = geometers.getInteriorPoint();
|
org.locationtech.jts.geom.Point point = geometers.getInteriorPoint();
|
||||||
LatLng geoInteriorPoint = new LatLng(point.getY(), point.getX());
|
LatLng geoInteriorPoint = new LatLng(point.getY(), point.getX());
|
||||||
if (geometers.getGeometryType().equalsIgnoreCase("Point")) {
|
if (geometers.getGeometryType().equalsIgnoreCase("Point")) {
|
||||||
Coordinate coordinate = geometers.getCoordinate();
|
Coordinate coordinate = geometers.getCoordinate();
|
||||||
@@ -570,6 +571,42 @@ public class GeometryTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取线型
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static LineString getLineStringByPointList(List<org.locationtech.jts.geom.Point> list) {
|
||||||
|
|
||||||
|
if (list != null && list.size() > 1) {
|
||||||
|
int size = list.size();
|
||||||
|
Coordinate[] coors = new Coordinate[size];
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
org.locationtech.jts.geom.Point point = list.get(i);
|
||||||
|
coors[i] = new Coordinate(point.getX(), point.getY());
|
||||||
|
}
|
||||||
|
return getLineStrinGeo(coors);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取线型
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static LineString getLineStringByMyCoordinate(List<MyCoordinate> list) {
|
||||||
|
|
||||||
|
if (list != null && list.size() > 1) {
|
||||||
|
int size = list.size();
|
||||||
|
Coordinate[] coors = new Coordinate[size];
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
coors[i] = new Coordinate(list.get(i).getX(), list.get(i).getY());
|
||||||
|
}
|
||||||
|
return getLineStrinGeo(coors);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取线型
|
* 获取线型
|
||||||
* @param coors
|
* @param coors
|
||||||
@@ -941,7 +978,7 @@ public class GeometryTools {
|
|||||||
if (wkts == null || wkts.size() == 0 || LatLng == null) {
|
if (wkts == null || wkts.size() == 0 || LatLng == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
com.vividsolutions.jts.geom.Point point = createPoint(new Coordinate(LatLng.getLongitude(), LatLng.getLatitude()));
|
org.locationtech.jts.geom.Point point = createPoint(new Coordinate(LatLng.getLongitude(), LatLng.getLatitude()));
|
||||||
for (int i = 0; i < wkts.size(); i++) {
|
for (int i = 0; i < wkts.size(); i++) {
|
||||||
Geometry geometry = createGeometry(wkts.get(i));
|
Geometry geometry = createGeometry(wkts.get(i));
|
||||||
if (geometry != null && geometry.getGeometryType().equals("Polygon")) {
|
if (geometry != null && geometry.getGeometryType().equals("Polygon")) {
|
||||||
@@ -1187,4 +1224,5 @@ public class GeometryTools {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
public class LogFileNameGenerate extends DateFileNameGenerator {
|
||||||
|
ThreadLocal<SimpleDateFormat> mLocalDateFormat = new ThreadLocal<SimpleDateFormat>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SimpleDateFormat initialValue() {
|
||||||
|
return new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFileNameChangeable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a file name which represent a specific date.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String generateFileName(int logLevel, long timestamp) {
|
||||||
|
SimpleDateFormat sdf = mLocalDateFormat.get();
|
||||||
|
sdf.setTimeZone(TimeZone.getDefault());
|
||||||
|
return "default-"+sdf.format(new Date(timestamp));
|
||||||
|
}
|
||||||
|
}
|
||||||
697
app/src/main/java/com/navinfo/outdoor/util/NaviUtils.java
Normal file
@@ -0,0 +1,697 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.kongzue.dialog.v3.CustomDialog;
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.activity.NaviCarActivity;
|
||||||
|
import com.navinfo.outdoor.activity.NaviRideActivity;
|
||||||
|
import com.navinfo.outdoor.activity.NaviWalkActivity;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.tencent.map.navi.CalcRouteCallback;
|
||||||
|
import com.tencent.map.navi.INaviView;
|
||||||
|
import com.tencent.map.navi.TencentNaviCallback;
|
||||||
|
import com.tencent.map.navi.TencentNaviManager;
|
||||||
|
import com.tencent.map.navi.TencentRideNaviListener;
|
||||||
|
import com.tencent.map.navi.TencentRouteSearchCallback;
|
||||||
|
import com.tencent.map.navi.TencentWalkNaviListener;
|
||||||
|
import com.tencent.map.navi.car.CarNaviView;
|
||||||
|
import com.tencent.map.navi.car.CarRouteSearchOptions;
|
||||||
|
import com.tencent.map.navi.car.TencentCarNaviManager;
|
||||||
|
import com.tencent.map.navi.data.AttachedLocation;
|
||||||
|
import com.tencent.map.navi.data.CalcRouteResult;
|
||||||
|
import com.tencent.map.navi.data.IdleRangeInfo;
|
||||||
|
import com.tencent.map.navi.data.NaviPoi;
|
||||||
|
import com.tencent.map.navi.data.NaviTts;
|
||||||
|
import com.tencent.map.navi.data.NavigationData;
|
||||||
|
import com.tencent.map.navi.data.ParallelRoadStatus;
|
||||||
|
import com.tencent.map.navi.data.RouteColors;
|
||||||
|
import com.tencent.map.navi.data.RouteData;
|
||||||
|
import com.tencent.map.navi.data.TrafficItem;
|
||||||
|
import com.tencent.map.navi.ride.RideNaviView;
|
||||||
|
import com.tencent.map.navi.ride.RideRouteSearchOptions;
|
||||||
|
import com.tencent.map.navi.ride.TencentRideNaviManager;
|
||||||
|
import com.tencent.map.navi.ui.car.CarNaviInfoPanel;
|
||||||
|
import com.tencent.map.navi.walk.TencentWalkNaviManager;
|
||||||
|
import com.tencent.map.navi.walk.WalkNaviView;
|
||||||
|
import com.tencent.map.ui.NaviView;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLngBounds;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class NaviUtils {
|
||||||
|
private static NaviUtils instance;
|
||||||
|
private Context mContext;
|
||||||
|
private TencentMap tencentMap;
|
||||||
|
private TencentNaviManager naviManager = null;
|
||||||
|
public static NaviUtils getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new NaviUtils();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectNaviType(AppCompatActivity mContext, SelectNaviTypeListener selectNaviTypeListener) {
|
||||||
|
CustomDialog selectNaviTypeDialog = CustomDialog.build(mContext, R.layout.dialog_select_navi_type, new CustomDialog.OnBindView() {
|
||||||
|
@Override
|
||||||
|
public void onBind(CustomDialog dialog, View v) {
|
||||||
|
RadioGroup rgNaviType = v.findViewById(R.id.rg_navi_type);
|
||||||
|
RadioButton rbtnCar = v.findViewById(R.id.navi_type_car);
|
||||||
|
RadioButton rbtnRide = v.findViewById(R.id.navi_type_ride);
|
||||||
|
RadioButton rbtnWalk = v.findViewById(R.id.navi_type_walk);
|
||||||
|
if (Constant.currentNaviType == Constant.NAV_TYPE.CAR) {
|
||||||
|
rbtnCar.setChecked(true);
|
||||||
|
} else if (Constant.currentNaviType == Constant.NAV_TYPE.RIDE) {
|
||||||
|
rbtnRide.setChecked(true);
|
||||||
|
} else if (Constant.currentNaviType == Constant.NAV_TYPE.WALK) {
|
||||||
|
rbtnWalk.setChecked(true);
|
||||||
|
}
|
||||||
|
TextView tvConfirm = v.findViewById(R.id.btn_navi_type_select_confirm);
|
||||||
|
TextView tvCancel = v.findViewById(R.id.btn_navi_type_select_cancel);
|
||||||
|
tvCancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (dialog.isShow) {
|
||||||
|
dialog.doDismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tvConfirm.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (!rbtnCar.isChecked()&&!rbtnRide.isChecked()&&!rbtnWalk.isChecked()) {
|
||||||
|
ToastUtils.Message(mContext, "请选择导航方式!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (rbtnCar.isChecked()) {
|
||||||
|
Constant.currentNaviType = Constant.NAV_TYPE.CAR;
|
||||||
|
} else if (rbtnRide.isChecked()) {
|
||||||
|
Constant.currentNaviType = Constant.NAV_TYPE.RIDE;
|
||||||
|
} else if (rbtnWalk.isChecked()) {
|
||||||
|
Constant.currentNaviType = Constant.NAV_TYPE.WALK;
|
||||||
|
}
|
||||||
|
if (Constant.currentNaviType!=null) {
|
||||||
|
selectNaviTypeListener.selectNaviType(Constant.currentNaviType);
|
||||||
|
}
|
||||||
|
if (dialog.isShow) {
|
||||||
|
dialog.doDismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setCancelable(false);
|
||||||
|
selectNaviTypeDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TencentNaviManager obitainnaviManager(Activity mContext, Constant.NAV_TYPE nav_type, NaviView naviView) {
|
||||||
|
if (nav_type == Constant.NAV_TYPE.CAR) { // 驾车
|
||||||
|
CarNaviView carNaviView = (CarNaviView) naviView;
|
||||||
|
naviManager = new TencentCarNaviManager(mContext);
|
||||||
|
carNaviView.setVisibility(View.VISIBLE);
|
||||||
|
naviManager.addNaviView(carNaviView);
|
||||||
|
CarNaviInfoPanel carNaviInfoPanel = carNaviView.showNaviInfoPanel();
|
||||||
|
carNaviInfoPanel.setOnNaviInfoListener(new CarNaviInfoPanel.OnNaviInfoListener() {
|
||||||
|
@Override
|
||||||
|
public void onBackClick() {
|
||||||
|
((TencentCarNaviManager)naviManager).stopNavi();
|
||||||
|
SystemTTS.getInstance(mContext).playText("结束导航");
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
((TencentCarNaviManager)naviManager).addTencentNaviCallback(new TencentNaviCallback() {
|
||||||
|
@Override
|
||||||
|
public void onStartNavi() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopNavi() {
|
||||||
|
NaviTts naviTts = new NaviTts();
|
||||||
|
naviTts.setText("结束导航");
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOffRoute() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecalculateRouteSuccess(int i, ArrayList<RouteData> arrayList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecalculateRouteSuccessInFence(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecalculateRouteFailure(int i, int i1, String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecalculateSuccess(CalcRouteResult calcRouteResult) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecalculateFailure(CalcRouteResult calcRouteResult) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecalculateRouteStarted(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecalculateRouteCanceled() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArrivedDestination() {
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPassedWayPoint(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateRoadType(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateParallelRoadStatus(ParallelRoadStatus parallelRoadStatus) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateAttachedLocation(AttachedLocation attachedLocation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFollowRouteClick(String s, ArrayList<LatLng> arrayList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int onVoiceBroadcast(NaviTts naviTts) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnterIdleSection(IdleRangeInfo idleRangeInfo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (nav_type == Constant.NAV_TYPE.RIDE) { // 骑行
|
||||||
|
RideNaviView rideNaviView = (RideNaviView) naviView;
|
||||||
|
naviManager = new TencentRideNaviManager(mContext);
|
||||||
|
rideNaviView.setVisibility(View.VISIBLE);
|
||||||
|
((TencentRideNaviManager)naviManager).addTencentNaviListener(rideNaviView);
|
||||||
|
CarNaviInfoPanel carNaviInfoPanel = rideNaviView.showNaviInfoPanel();
|
||||||
|
carNaviInfoPanel.setOnNaviInfoListener(new CarNaviInfoPanel.OnNaviInfoListener() {
|
||||||
|
@Override
|
||||||
|
public void onBackClick() {
|
||||||
|
((TencentRideNaviManager)naviManager).stopNavi();
|
||||||
|
SystemTTS.getInstance(mContext).playText("结束导航");
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
((TencentRideNaviManager) naviManager).addTencentNaviListener(new TencentRideNaviListener() {
|
||||||
|
@Override
|
||||||
|
public void onRecalculateRouteSuccess(ArrayList<RouteData> arrayList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDirectionUpdateBySensor(float v) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartNavi() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopNavi() {
|
||||||
|
NaviTts naviTts = new NaviTts();
|
||||||
|
naviTts.setText("结束导航");
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOffRoute() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int onVoiceBroadcast(NaviTts naviTts) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArrivedDestination() {
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateAttachedLocation(AttachedLocation attachedLocation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsRssiChanged(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateNavigationData(NavigationData navigationData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsWeakNotify() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsStrongNotify() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsStatusChanged(boolean b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateCurrentRoute(RouteData routeData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeRes(boolean b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
WalkNaviView walkNaviView = (WalkNaviView) naviView;
|
||||||
|
naviManager = new TencentRideNaviManager(mContext);
|
||||||
|
walkNaviView.setVisibility(View.VISIBLE);
|
||||||
|
((TencentWalkNaviManager)naviManager).addTencentNaviListener(walkNaviView);
|
||||||
|
CarNaviInfoPanel carNaviInfoPanel = walkNaviView.showNaviInfoPanel();
|
||||||
|
carNaviInfoPanel.setOnNaviInfoListener(new CarNaviInfoPanel.OnNaviInfoListener() {
|
||||||
|
@Override
|
||||||
|
public void onBackClick() {
|
||||||
|
((TencentWalkNaviManager)naviManager).stopNavi();
|
||||||
|
SystemTTS.getInstance(mContext).playText("结束导航");
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
((TencentWalkNaviManager) naviManager).addTencentNaviListener(new TencentWalkNaviListener() {
|
||||||
|
@Override
|
||||||
|
public void onRecalculateRouteSuccess(ArrayList<RouteData> arrayList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDirectionUpdateBySensor(float v) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartNavi() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopNavi() {
|
||||||
|
NaviTts naviTts = new NaviTts();
|
||||||
|
naviTts.setText("结束导航");
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOffRoute() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int onVoiceBroadcast(NaviTts naviTts) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArrivedDestination() {
|
||||||
|
mContext.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateAttachedLocation(AttachedLocation attachedLocation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsRssiChanged(int i) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateNavigationData(NavigationData navigationData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsWeakNotify() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsStrongNotify() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGpsStatusChanged(boolean b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateCurrentRoute(RouteData routeData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeRes(boolean b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (tencentMap == null) {
|
||||||
|
tencentMap = naviView.getMap();
|
||||||
|
}
|
||||||
|
if (this.mContext == null) {
|
||||||
|
this.mContext = mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开启语音播报
|
||||||
|
naviManager.setInternalTtsEnabled(true);
|
||||||
|
naviManager.setIsDefaultRes(true);
|
||||||
|
naviManager.setUseExtraLocationData(true);
|
||||||
|
return naviManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取路径规划
|
||||||
|
* */
|
||||||
|
public void searchRoute(Constant.NAV_TYPE nav_type, TencentNaviManager naviManager,
|
||||||
|
NaviPoi start, NaviPoi end) throws Exception {
|
||||||
|
if (nav_type == Constant.NAV_TYPE.CAR) { // 驾车模式
|
||||||
|
TencentCarNaviManager carNaviManager = (TencentCarNaviManager)naviManager;
|
||||||
|
CarRouteSearchOptions options = CarRouteSearchOptions.create();
|
||||||
|
carNaviManager.searchRoute(start, end, new ArrayList<>(), options, routeSearchCallback);
|
||||||
|
} else if (nav_type == Constant.NAV_TYPE.RIDE) { // 骑行模式
|
||||||
|
TencentRideNaviManager rideNaviManager = (TencentRideNaviManager)naviManager;
|
||||||
|
RideRouteSearchOptions options = RideRouteSearchOptions.create();
|
||||||
|
rideNaviManager.searchRoute(start, end, options, routeSearchCallback);
|
||||||
|
} else { // 步行模式
|
||||||
|
TencentWalkNaviManager walkNaviManager = (TencentWalkNaviManager) naviManager;
|
||||||
|
walkNaviManager.searchRoute(start, end, routeSearchCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅进行路径规划,无需导航
|
||||||
|
* */
|
||||||
|
public TencentNaviManager searchRouteOnly(Activity mContext, Constant.NAV_TYPE nav_type, NaviPoi start, NaviPoi end, TencentRouteSearchCallback routeSearchCallback) throws Exception {
|
||||||
|
TencentNaviManager naviManager = null;
|
||||||
|
if (nav_type == Constant.NAV_TYPE.CAR) {
|
||||||
|
naviManager = new TencentCarNaviManager(mContext);
|
||||||
|
CarRouteSearchOptions options = CarRouteSearchOptions.create();
|
||||||
|
((TencentCarNaviManager)naviManager).searchRoute(start, end, new ArrayList<>(), options, routeSearchCallback);
|
||||||
|
} else if (nav_type == Constant.NAV_TYPE.RIDE) {
|
||||||
|
naviManager = new TencentRideNaviManager(mContext);
|
||||||
|
RideRouteSearchOptions options = RideRouteSearchOptions.create();
|
||||||
|
((TencentRideNaviManager)naviManager).searchRoute(start, end, options, routeSearchCallback);
|
||||||
|
} else {
|
||||||
|
naviManager = new TencentWalkNaviManager(mContext);
|
||||||
|
((TencentWalkNaviManager)naviManager).searchRoute(start, end, routeSearchCallback);
|
||||||
|
}
|
||||||
|
return naviManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 算路回调
|
||||||
|
*/
|
||||||
|
private TencentRouteSearchCallback routeSearchCallback = new TencentRouteSearchCallback() {
|
||||||
|
@Override
|
||||||
|
public void onRouteSearchFailure(int i, String s) {
|
||||||
|
//i错误码提示:1001为网络错误,1002为无网络,2001为返回数据无效(或空),2002为起终点参数错误,2003为途经点参数错误,2004为吸附失败,2005为算路失败,2999为服务器内部错误
|
||||||
|
Log.e("route","error:"+i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRouteSearchSuccess(ArrayList<RouteData> arrayList) {
|
||||||
|
// 添加道路Route到地图,默认选取第一条
|
||||||
|
addRoutes(arrayList.get(0), tencentMap);
|
||||||
|
zoomToRoute(mContext, arrayList.get(0), tencentMap);
|
||||||
|
try {
|
||||||
|
// 自动开始导航
|
||||||
|
if (Constant.currentNaviType == Constant.NAV_TYPE.CAR) {
|
||||||
|
((TencentCarNaviManager)naviManager).startNavi(0);
|
||||||
|
// ((TencentCarNaviManager)naviManager).startSimulateNavi(0);
|
||||||
|
} else if (Constant.currentNaviType == Constant.NAV_TYPE.RIDE) {
|
||||||
|
((TencentRideNaviManager)naviManager).startNavi(0);
|
||||||
|
// ((TencentRideNaviManager)naviManager).startSimulateNavi(0);
|
||||||
|
} else {
|
||||||
|
((TencentWalkNaviManager)naviManager).startNavi(0);
|
||||||
|
// ((TencentWalkNaviManager)naviManager).startSimulateNavi(0);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// addMarkerStart(start.getLatitude(),start.getLongitude());
|
||||||
|
// addMarkerDestination(dest.getLatitude(),dest.getLongitude());
|
||||||
|
// addMarkerPass(wayPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCalcRouteSuccess(CalcRouteResult calcRouteResult) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCalcRouteFailure(CalcRouteResult calcRouteResult) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void addMarkerStart(double latitude, double longitude) {
|
||||||
|
LatLng startPoint = new LatLng(latitude, longitude);
|
||||||
|
tencentMap.addMarker(new MarkerOptions(startPoint)
|
||||||
|
.icon(BitmapDescriptorFactory.fromAsset("navi_marker_start.png"))
|
||||||
|
.anchor(0.5f, 1));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMarkerDestination(double latitude, double longitude) {
|
||||||
|
|
||||||
|
LatLng destinationPoint = new LatLng(latitude, longitude);
|
||||||
|
tencentMap.addMarker(new MarkerOptions(destinationPoint)
|
||||||
|
.icon(BitmapDescriptorFactory.fromAsset("navi_marker_end.png"))
|
||||||
|
.anchor(0.5f, 1));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMarkerPass(ArrayList<NaviPoi> wayPoints) {
|
||||||
|
|
||||||
|
for (NaviPoi wayPoint : wayPoints) {
|
||||||
|
LatLng destinationPoint = new LatLng(wayPoint.getLatitude(), wayPoint.getLongitude());
|
||||||
|
tencentMap.addMarker(new MarkerOptions(destinationPoint)
|
||||||
|
.icon(BitmapDescriptorFactory.fromAsset("navi_marker_pass.png"))
|
||||||
|
.anchor(0.5f, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Polyline addRoutes(RouteData routeData, TencentMap map) {
|
||||||
|
ArrayList<TrafficItem> traffics = getTrafficItemsFromList(routeData.getTrafficIndexList());
|
||||||
|
List<LatLng> mRoutePoints = routeData.getRoutePoints();
|
||||||
|
// 点的个数
|
||||||
|
int pointSize = mRoutePoints.size();
|
||||||
|
// 路段总数 三个index是一个路况单元,分别为:路况级别,起点,终点
|
||||||
|
int trafficSize = traffics.size();
|
||||||
|
// 路段index所对应的颜色值数组
|
||||||
|
int[] trafficColors = new int[pointSize];
|
||||||
|
// 路段index数组
|
||||||
|
int[] trafficColorsIndex = new int[pointSize];
|
||||||
|
int pointStart = 0;
|
||||||
|
int pointEnd = 0;
|
||||||
|
int trafficColor = 0;
|
||||||
|
int index = 0;
|
||||||
|
for (int j = 0; j < trafficSize; j++) {
|
||||||
|
pointStart = traffics.get(j).getFromIndex();
|
||||||
|
// 规避错乱数据
|
||||||
|
if (pointStart < pointEnd) {
|
||||||
|
pointStart = pointEnd;
|
||||||
|
}
|
||||||
|
pointEnd = traffics.get(j).getToIndex();
|
||||||
|
trafficColor = getTrafficColorByCode(traffics.get(j).getTraffic());
|
||||||
|
|
||||||
|
for (int k = pointStart; k < pointEnd || k == pointSize - 1; k++) {
|
||||||
|
trafficColors[index] = trafficColor;
|
||||||
|
trafficColorsIndex[index] = index;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PolylineOptions options = new PolylineOptions()
|
||||||
|
.addAll(routeData.getRoutePoints())
|
||||||
|
.width(15)
|
||||||
|
.arrow(true)
|
||||||
|
.colors(trafficColors, trafficColorsIndex)
|
||||||
|
.zIndex(10);
|
||||||
|
if (map == null) {
|
||||||
|
map = tencentMap;
|
||||||
|
}
|
||||||
|
Polyline polyline = map.addPolyline(options);
|
||||||
|
return polyline;
|
||||||
|
}
|
||||||
|
public void zoomToRoute(Context mContext, RouteData routeData, TencentMap map) {
|
||||||
|
int marginLeft = mContext.getResources().getDimensionPixelSize(R.dimen.navigation_line_margin_left);
|
||||||
|
int marginTop = mContext.getResources().getDimensionPixelSize(R.dimen.navigation_line_margin_top);
|
||||||
|
int marginRight = mContext.getResources().getDimensionPixelSize(R.dimen.navigation_line_margin_right);
|
||||||
|
int marginBottom = mContext.getResources().getDimensionPixelSize(R.dimen.navigation_line_margin_bottom);
|
||||||
|
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||||
|
|
||||||
|
builder.include(routeData.getRoutePoints());
|
||||||
|
LatLngBounds bounds = builder.build();
|
||||||
|
if (map == null) {
|
||||||
|
map = tencentMap;
|
||||||
|
}
|
||||||
|
map.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(bounds, marginLeft, marginRight, marginTop, marginBottom));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private int getTrafficColorByCode(int type) {
|
||||||
|
int color = 0xFFFFFFFF;
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
// 路况标签-畅通
|
||||||
|
// 绿色
|
||||||
|
color = RouteColors.COLOR_MAIN_DAY_SMOOTH;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// 路况标签-缓慢
|
||||||
|
// 黄色
|
||||||
|
color = RouteColors.COLOR_MAIN_DAY_SLOW;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 路况标签-拥堵
|
||||||
|
// 红色
|
||||||
|
color = RouteColors.COLOR_MAIN_DAY_VERY_SLOW;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 路况标签-无路况
|
||||||
|
color = RouteColors.COLOR_MAIN_DAY_UNKNOWN;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
// 路况标签-特别拥堵(猪肝红)
|
||||||
|
color = RouteColors.COLOR_MAIN_DAY_JAM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<TrafficItem> getTrafficItemsFromList(ArrayList<Integer> indexList) {
|
||||||
|
ArrayList<TrafficItem> trafficItems = new ArrayList<>();
|
||||||
|
for (int i = 0; i < indexList.size(); i = i + 3) {
|
||||||
|
TrafficItem item = new TrafficItem();
|
||||||
|
item.setTraffic(indexList.get(i));
|
||||||
|
item.setFromIndex(indexList.get(i + 1));
|
||||||
|
item.setToIndex(indexList.get(i + 2));
|
||||||
|
trafficItems.add(item);
|
||||||
|
}
|
||||||
|
return trafficItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopNavi() {
|
||||||
|
if (naviManager!=null&&naviManager.isNavigating()) {
|
||||||
|
if (Constant.currentNaviType == Constant.NAV_TYPE.CAR) {
|
||||||
|
((TencentCarNaviManager)naviManager).stopNavi();
|
||||||
|
} else if (Constant.currentNaviType == Constant.NAV_TYPE.RIDE) {
|
||||||
|
((TencentRideNaviManager)naviManager).stopNavi();
|
||||||
|
} else if (Constant.currentNaviType == Constant.NAV_TYPE.WALK) {
|
||||||
|
((TencentWalkNaviManager)naviManager).stopNavi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始路径规划
|
||||||
|
* */
|
||||||
|
public void startNav(Activity mContext, LatLng startLatlng, LatLng endLatlng) {
|
||||||
|
if (Constant.currentLocation == null) {
|
||||||
|
ToastUtils.Message(mContext, "无法获取当前位置,请检查是否授权应用获取位置权限!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (startLatlng == null || endLatlng == null) {
|
||||||
|
ToastUtils.Message(mContext, "无法获取个人位置或数据位置信息,请重新打开此数据尝试!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 跳转到指定的Activity
|
||||||
|
Class toClass = null;
|
||||||
|
if (Constant.currentNaviType == Constant.NAV_TYPE.CAR) {
|
||||||
|
toClass = NaviCarActivity.class;
|
||||||
|
} else if (Constant.currentNaviType == Constant.NAV_TYPE.RIDE) {
|
||||||
|
toClass = NaviRideActivity.class;
|
||||||
|
} else {
|
||||||
|
toClass = NaviWalkActivity.class;
|
||||||
|
}
|
||||||
|
Intent naviIntent = new Intent(mContext, toClass);
|
||||||
|
// 使用当前数据起点作为导航的终点,规划路径
|
||||||
|
naviIntent.putExtra("start", startLatlng);
|
||||||
|
naviIntent.putExtra("end", endLatlng);
|
||||||
|
mContext.startActivity(naviIntent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TencentNaviManager getNaviManager() {
|
||||||
|
if (naviManager!=null) {
|
||||||
|
return naviManager;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public interface SelectNaviTypeListener {
|
||||||
|
void selectNaviType(Constant.NAV_TYPE nav_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import android.os.Message;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.github.lazylibrary.util.ToastUtils;
|
||||||
import com.github.lazylibrary.util.ZipUtil;
|
import com.github.lazylibrary.util.ZipUtil;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.lzy.okgo.OkGo;
|
import com.lzy.okgo.OkGo;
|
||||||
@@ -21,6 +22,7 @@ import com.navinfo.outdoor.room.ChargingPileEntity;
|
|||||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||||
import com.navinfo.outdoor.room.PoiDatabase;
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
import com.navinfo.outdoor.room.PoiEntity;
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
|
import com.umeng.commonsdk.debug.UMLog;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
@@ -30,7 +32,18 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableSource;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.Single;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.functions.Consumer;
|
||||||
|
import io.reactivex.functions.Function;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -40,8 +53,9 @@ public class PoiSaveUtils {
|
|||||||
private Activity mContext;
|
private Activity mContext;
|
||||||
private Gson gson;
|
private Gson gson;
|
||||||
private static PoiSaveUtils instance;
|
private static PoiSaveUtils instance;
|
||||||
private int anInt = 0;
|
private int anInt = 0; // 上传成功的个数
|
||||||
private int bInt = 0;
|
private int bInt = 0; // 上传失败的个数
|
||||||
|
private int uploadCount = 0; // 上传的总个数
|
||||||
|
|
||||||
public static PoiSaveUtils getInstance(Activity mContext) {
|
public static PoiSaveUtils getInstance(Activity mContext) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
@@ -59,76 +73,243 @@ public class PoiSaveUtils {
|
|||||||
* 批量上传数据到服务端
|
* 批量上传数据到服务端
|
||||||
*/
|
*/
|
||||||
public void uploadPoiEntityBatch(List<PoiEntity> poiEntityList) {
|
public void uploadPoiEntityBatch(List<PoiEntity> poiEntityList) {
|
||||||
if (poiEntityList != null) {
|
if (poiEntityList != null&&!poiEntityList.isEmpty()) {
|
||||||
new Thread(new Runnable() {
|
// 因为道路任务和POI录像任务需要分包提交,因此和其他要素分开,分别放在两个管道里
|
||||||
@Override
|
List<PoiEntity> chargePoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||||
public void run() {
|
List<PoiEntity> spliteFilePoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||||
anInt = 0;
|
List<PoiEntity> otherPoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||||
bInt = 0;
|
for (PoiEntity poiEntity: poiEntityList) {
|
||||||
Log.d("PoiSaveUtils", "开始上传");
|
if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||||
for (int i = 0; i < poiEntityList.size(); i++) {
|
continue;
|
||||||
PoiEntity poiEntity = poiEntityList.get(i);
|
}
|
||||||
Log.d("PoiSaveUtils", "poiEntity.getType():"+poiEntity.getType());
|
if (poiEntity.getType()==2) {
|
||||||
if (poiEntity.getType() == 2) { // 如果是充电站数据,首先检查子充电桩的状态
|
chargePoiEntityList.add(poiEntity);
|
||||||
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
} else if (poiEntity.getType() == 3 || poiEntity.getType() == 4) {
|
||||||
if (saveChargingPileByChargingStation(poiEntity)) {
|
spliteFilePoiEntityList.add(poiEntity);
|
||||||
if (savePoiNet(poiEntity) == 200) { // 网络保存-冗余操作
|
} else {
|
||||||
// 开始上传流程
|
otherPoiEntityList.add(poiEntity);
|
||||||
if (saveChargingPileUploadChargingStation(poiEntity)) {
|
}
|
||||||
uploadPoiNet(poiEntity);
|
}
|
||||||
}else {
|
|
||||||
poiEntity.setChecked(false);
|
Observable chargePoiObserable = Observable.fromIterable(chargePoiEntityList)
|
||||||
poiEntity.setWork_type(0);
|
.subscribeOn(Schedulers.io())
|
||||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
.doOnNext(new Consumer<PoiEntity>() {
|
||||||
}
|
@Override
|
||||||
|
public void accept(PoiEntity poiEntity) throws Exception {
|
||||||
|
Constant.submitIdSet.add(poiEntity.getId()); // 记录全局的正在提交的数据
|
||||||
|
if (savePoiNet(poiEntity) == 200&&saveChargingPileByChargingStation(poiEntity)) { // 网络保存成功
|
||||||
|
if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
|
}
|
||||||
|
if (savePoiNet(poiEntity) == 200) { // 网络保存-冗余操作
|
||||||
|
// 开始上传流程
|
||||||
|
if (saveChargingPileUploadChargingStation(poiEntity)) {
|
||||||
|
uploadPoiNet(poiEntity);
|
||||||
}else {
|
}else {
|
||||||
|
bInt++;
|
||||||
poiEntity.setChecked(false);
|
poiEntity.setChecked(false);
|
||||||
poiEntity.setWork_type(0);
|
poiEntity.setWork_type(0);
|
||||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
bInt++;
|
||||||
|
poiEntity.setChecked(false);
|
||||||
|
poiEntity.setWork_type(0);
|
||||||
|
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
bInt++;
|
||||||
poiEntity.setChecked(false);
|
poiEntity.setChecked(false);
|
||||||
poiEntity.setWork_type(0);
|
poiEntity.setWork_type(0);
|
||||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
}
|
}
|
||||||
} else {//其他类型
|
}
|
||||||
|
})
|
||||||
|
.onErrorResumeNext(Observable.empty());
|
||||||
|
// 处理普通数据
|
||||||
|
Observable otherObserable = Observable.fromIterable(otherPoiEntityList)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.doOnNext(new Consumer<PoiEntity>() {
|
||||||
|
@Override
|
||||||
|
public void accept(PoiEntity poiEntity) throws Exception {
|
||||||
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
||||||
//走上传流程:
|
//走上传流程:
|
||||||
uploadPoiNet(poiEntity);
|
uploadPoiNet(poiEntity);
|
||||||
}else {
|
}else {
|
||||||
|
bInt++;
|
||||||
poiEntity.setChecked(false);
|
poiEntity.setChecked(false);
|
||||||
poiEntity.setWork_type(0);
|
poiEntity.setWork_type(0);
|
||||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
mContext.runOnUiThread(new Runnable() {
|
.onErrorResumeNext(Observable.empty());
|
||||||
|
// 处理需要分包上传数据的POI录像和道路数据
|
||||||
|
Observable spliteFileObserable = Observable.fromIterable(spliteFilePoiEntityList)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.doOnNext(new Consumer<PoiEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void accept(PoiEntity poiEntity) throws Exception {
|
||||||
|
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
||||||
|
//走上传流程:
|
||||||
|
if (poiEntity == null) {
|
||||||
|
bInt++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int bodyId = poiEntity.getBodyId();
|
||||||
|
if (bodyId == 0) {
|
||||||
|
bInt++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
bInt++;
|
||||||
|
poiEntity.setChecked(false);
|
||||||
|
poiEntity.setWork_type(0);
|
||||||
|
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.concatMap(new Function<PoiEntity, ObservableSource<?>>() {
|
||||||
|
@Override
|
||||||
|
public ObservableSource<?> apply(PoiEntity poiEntity) throws Exception {
|
||||||
|
List<File> photoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||||
|
if (photoFileList == null||photoFileList.isEmpty()) {
|
||||||
|
bInt++;
|
||||||
|
return Observable.empty();
|
||||||
|
}
|
||||||
|
return DataSaveUtils.getInstance().getUploadSpliteFilesObservble(mContext, poiEntity, photoFileList)
|
||||||
|
.toObservable();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.doOnNext(new Consumer<Object>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Object o) throws Exception {
|
||||||
|
anInt++;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.doOnError(new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
bInt++;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.onErrorResumeNext(Observable.empty());
|
||||||
|
Observable.concat(
|
||||||
|
otherObserable, spliteFileObserable, chargePoiObserable
|
||||||
|
).subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.onErrorResumeNext(Observable.empty())
|
||||||
|
.subscribe(new Observer() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
anInt = 0;
|
||||||
|
bInt = 0;
|
||||||
|
uploadCount = chargePoiEntityList.size()+spliteFilePoiEntityList.size()+otherPoiEntityList.size();
|
||||||
|
Log.d("PoiSaveUtils", "开始上传");
|
||||||
|
ToastUtils.showToast(mContext, "开始批量上传数据,本次共需上传"+uploadCount+"条数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(Object o) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
ToastUtils.showToast(mContext, e.getMessage());
|
||||||
|
Constant.isPresent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
Message obtain = Message.obtain();
|
Message obtain = Message.obtain();
|
||||||
obtain.what = Constant.STAY_SUBMIT_ITEM;
|
obtain.what = Constant.STAY_SUBMIT_ITEM;
|
||||||
obtain.obj = true;
|
obtain.obj = true;
|
||||||
EventBus.getDefault().post(obtain);
|
EventBus.getDefault().post(obtain);
|
||||||
if (anInt + bInt > 0) {
|
Message obtain1 = Message.obtain();
|
||||||
Message obtain1 = Message.obtain();
|
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
||||||
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
obtain1.obj = "批量提交数据,共选中"+uploadCount+"条数据,成功:" + anInt + "条, 失败:" + bInt+"条";
|
||||||
obtain1.obj = "批量提交 成功:" + anInt + ", 失败:" + bInt;
|
EventBus.getDefault().post(obtain1);
|
||||||
EventBus.getDefault().post(obtain1);
|
Constant.isPresent = true;
|
||||||
} else {
|
|
||||||
Message obtain1 = Message.obtain();
|
|
||||||
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
|
||||||
obtain1.obj = "批量提交 失败";
|
|
||||||
EventBus.getDefault().post(obtain1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
|
|
||||||
|
// new Thread(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// anInt = 0;
|
||||||
|
// bInt = 0;
|
||||||
|
// Log.d("PoiSaveUtils", "开始上传");
|
||||||
|
// for (int i = 0; i < poiEntityList.size(); i++) {
|
||||||
|
// PoiEntity poiEntity = poiEntityList.get(i);
|
||||||
|
// Log.d("PoiSaveUtils", "poiEntity.getType():"+poiEntity.getType());
|
||||||
|
// if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if (poiEntity.getType() == 2) { // 如果是充电站数据,首先检查子充电桩的状态
|
||||||
|
// Constant.submitIdSet.add(poiEntity.getId()); // 记录全局的正在提交的数据
|
||||||
|
// if (savePoiNet(poiEntity) == 200&&saveChargingPileByChargingStation(poiEntity)) { // 网络保存成功
|
||||||
|
// Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
|
// if (savePoiNet(poiEntity) == 200) { // 网络保存-冗余操作
|
||||||
|
// // 开始上传流程
|
||||||
|
// if (saveChargingPileUploadChargingStation(poiEntity)) {
|
||||||
|
// uploadPoiNet(poiEntity);
|
||||||
|
// }else {
|
||||||
|
// bInt++;
|
||||||
|
// poiEntity.setChecked(false);
|
||||||
|
// poiEntity.setWork_type(0);
|
||||||
|
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
// bInt++;
|
||||||
|
// poiEntity.setChecked(false);
|
||||||
|
// poiEntity.setWork_type(0);
|
||||||
|
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// bInt++;
|
||||||
|
// poiEntity.setChecked(false);
|
||||||
|
// poiEntity.setWork_type(0);
|
||||||
|
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
// Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
|
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||||
|
// }
|
||||||
|
// } else {//其他类型
|
||||||
|
// if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
||||||
|
// //走上传流程:
|
||||||
|
// uploadPoiNet(poiEntity);
|
||||||
|
// }else {
|
||||||
|
// bInt++;
|
||||||
|
// poiEntity.setChecked(false);
|
||||||
|
// poiEntity.setWork_type(0);
|
||||||
|
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||||
|
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendUploadMessage(int count, int success, int fail) {
|
||||||
|
if (success+fail == count) { // 成功和失败的个数与数据总数相同
|
||||||
|
Message obtain = Message.obtain();
|
||||||
|
obtain.what = Constant.STAY_SUBMIT_ITEM;
|
||||||
|
obtain.obj = true;
|
||||||
|
EventBus.getDefault().post(obtain);
|
||||||
|
}
|
||||||
|
Message obtain1 = Message.obtain();
|
||||||
|
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
||||||
|
obtain1.obj = "批量提交数据,共选中"+count+"条数据,成功:" + anInt + "条, 失败:" + bInt+"条";
|
||||||
|
EventBus.getDefault().post(obtain1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 保存数据到服务
|
* 保存数据到服务
|
||||||
*/
|
*/
|
||||||
@@ -216,6 +397,10 @@ public class PoiSaveUtils {
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public interface UploadListener {
|
||||||
|
// public void uploadCallback();
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最终上传POI数据到服务
|
* 最终上传POI数据到服务
|
||||||
*/
|
*/
|
||||||
@@ -252,24 +437,42 @@ public class PoiSaveUtils {
|
|||||||
bInt++;
|
bInt++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
// 需要上传的文件都存在,开始调用分片上传接口上传附件数据
|
||||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
DataSaveUtils.getInstance().uploadFiles(mContext, poiEntity, videoFileList, new DataSaveUtils.UploadCallback() {
|
||||||
photoFile.add(fileZip);
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
anInt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
// 上传失败
|
||||||
|
bInt++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||||
|
// ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||||
|
// photoFile.add(fileZip);
|
||||||
} else {
|
} else {
|
||||||
bInt++;
|
bInt++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (photoFile.size() > 0) {
|
// if (photoFile.size() > 0) {
|
||||||
long zipTrueSize = ZipUtils.getZipTrueSize(photoFile.get(0).getAbsolutePath());
|
// long zipTrueSize = ZipUtils.getZipTrueSize(photoFile.get(0).getAbsolutePath());
|
||||||
if (zipTrueSize > 0) {
|
// if (zipTrueSize > 0) {
|
||||||
initList(HttpInterface.POI_VIDEO_UPLOAD_PIC, photoFile, poiEntity);
|
// initList(HttpInterface.POI_VIDEO_UPLOAD_PIC, photoFile, poiEntity);
|
||||||
} else {
|
// } else {
|
||||||
for (int i = 0; i < photoFile.size(); i++) {
|
// for (int i = 0; i < photoFile.size(); i++) {
|
||||||
photoFile.get(i).delete();
|
// photoFile.get(i).delete();
|
||||||
}
|
// }
|
||||||
bInt++;
|
// bInt++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else if (poiEntity.getType() == 4) {
|
} else if (poiEntity.getType() == 4) {
|
||||||
List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||||
if (videoFileList != null && !videoFileList.isEmpty()) {
|
if (videoFileList != null && !videoFileList.isEmpty()) {
|
||||||
@@ -278,27 +481,48 @@ public class PoiSaveUtils {
|
|||||||
bInt++;
|
bInt++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
// 需要上传的文件都存在,开始调用分片上传接口上传附件数据
|
||||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
DataSaveUtils.getInstance().uploadFiles(mContext, poiEntity, videoFileList, new DataSaveUtils.UploadCallback() {
|
||||||
photoFile.add(fileZip);
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
anInt++;
|
||||||
|
Log.d("TAGSS", "uploadPoiNet: 成功" + anInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
// 上传失败
|
||||||
|
bInt++;
|
||||||
|
Log.d("TAGSS", poiEntity.getBodyId()+"uploadPoiNet: 失败" + bInt);
|
||||||
|
UMLog.aq(1, poiEntity.getBodyId()+"uploadPoiNet: 失败", "文件上传失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||||
|
// ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||||
|
// photoFile.add(fileZip);
|
||||||
} else {
|
} else {
|
||||||
Log.d("TAGSS", "videoFileList: 失败" + bInt);
|
Log.d("TAGSS", "videoFileList: 失败" + bInt);
|
||||||
bInt++;
|
bInt++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (photoFile.size() > 0) {
|
// if (photoFile.size() > 0) {
|
||||||
long zipTrueSize = ZipUtils.getZipTrueSize(photoFile.get(0).getAbsolutePath());
|
// long zipTrueSize = ZipUtils.getZipTrueSize(photoFile.get(0).getAbsolutePath());
|
||||||
if (zipTrueSize > 0) {
|
// if (zipTrueSize > 0) {
|
||||||
initList(HttpInterface.ROAD_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
// initList(HttpInterface.ROAD_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
||||||
} else {
|
// } else {
|
||||||
Log.d("TAGSS", "photoFile: 失败" + bInt);
|
// Log.d("TAGSS", "photoFile: 失败" + bInt);
|
||||||
for (int i = 0; i < photoFile.size(); i++) {
|
// for (int i = 0; i < photoFile.size(); i++) {
|
||||||
photoFile.get(i).delete();
|
// photoFile.get(i).delete();
|
||||||
}
|
// }
|
||||||
bInt++;
|
// bInt++;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else if (poiEntity.getType() == 5) {
|
} else if (poiEntity.getType() == 5) {
|
||||||
initList(HttpInterface.OTHER_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
initList(HttpInterface.OTHER_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
||||||
}
|
}
|
||||||
@@ -309,7 +533,7 @@ public class PoiSaveUtils {
|
|||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("auditId", poiEntity.getBodyId());
|
httpParams.put("auditId", poiEntity.getBodyId());
|
||||||
Response execute = OkGoBuilder.getInstance()
|
Response execute = OkGoBuilder.getInstance()
|
||||||
.time(0)
|
.time(600)
|
||||||
.Builder(mContext)
|
.Builder(mContext)
|
||||||
.url(url)
|
.url(url)
|
||||||
.params(httpParams)
|
.params(httpParams)
|
||||||
@@ -434,8 +658,8 @@ public class PoiSaveUtils {
|
|||||||
if (execute.code() != 200) {
|
if (execute.code() != 200) {
|
||||||
return execute.code();
|
return execute.code();
|
||||||
}
|
}
|
||||||
if (execute.body().string() != null) {
|
String string = execute.body().string();
|
||||||
String string = execute.body().string();
|
if (string != null) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
ChargingPileSaveBean chargingPileSaveBean = gson.fromJson(string, ChargingPileSaveBean.class);
|
ChargingPileSaveBean chargingPileSaveBean = gson.fromJson(string, ChargingPileSaveBean.class);
|
||||||
if (chargingPileSaveBean.getCode() != 200) {
|
if (chargingPileSaveBean.getCode() != 200) {
|
||||||
@@ -497,7 +721,7 @@ public class PoiSaveUtils {
|
|||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||||
Response execute = OkGoBuilder.getInstance()
|
Response execute = OkGoBuilder.getInstance()
|
||||||
.time(0)
|
.time(600)
|
||||||
.Builder(mContext)
|
.Builder(mContext)
|
||||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||||
.token(Constant.ACCESS_TOKEN)
|
.token(Constant.ACCESS_TOKEN)
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ public class PreserveUtils {
|
|||||||
|
|
||||||
// 充电站数据已经保存在服务上,批量保存充电桩数据
|
// 充电站数据已经保存在服务上,批量保存充电桩数据
|
||||||
saveChargingPileByChargingStation(mContext, poiEntity);
|
saveChargingPileByChargingStation(mContext, poiEntity);
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
mContext.runOnUiThread(new Runnable() {
|
mContext.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -299,14 +300,17 @@ public class PreserveUtils {
|
|||||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
||||||
EventBus.getDefault().post(obtain1);
|
EventBus.getDefault().post(obtain1);
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
}
|
}
|
||||||
} else if (chargingStationBean.getCode() == 230) {
|
} else if (chargingStationBean.getCode() == 230) {
|
||||||
FlushTokenUtil.flushToken(mContext);
|
FlushTokenUtil.flushToken(mContext);
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
} else {
|
} else {
|
||||||
Message obtain1 = Message.obtain();
|
Message obtain1 = Message.obtain();
|
||||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
||||||
EventBus.getDefault().post(obtain1);
|
EventBus.getDefault().post(obtain1);
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,6 +320,7 @@ public class PreserveUtils {
|
|||||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败";
|
||||||
EventBus.getDefault().post(obtain1);
|
EventBus.getDefault().post(obtain1);
|
||||||
|
Constant.submitIdSet.remove(poiEntity.getId());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ import android.speech.tts.TextToSpeech;
|
|||||||
import android.speech.tts.UtteranceProgressListener;
|
import android.speech.tts.UtteranceProgressListener;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.elvishew.xlog.XLog;
|
||||||
|
import com.github.lazylibrary.util.ToastUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
public class SystemTTS extends UtteranceProgressListener implements TTS, TextToSpeech.OnUtteranceCompletedListener {
|
public class SystemTTS extends UtteranceProgressListener implements TTS, TextToSpeech.OnUtteranceCompletedListener {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private static SystemTTS singleton;
|
private static SystemTTS singleton;
|
||||||
@@ -33,23 +35,32 @@ public class SystemTTS extends UtteranceProgressListener implements TTS, TextToS
|
|||||||
textToSpeech = new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {
|
textToSpeech = new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onInit(int i) {
|
public void onInit(int i) {
|
||||||
|
if (i == TextToSpeech.SUCCESS) {
|
||||||
|
//系统语音初始化成功
|
||||||
|
XLog.v("tts初始化成功");
|
||||||
|
int result = textToSpeech.setLanguage(Locale.getDefault());
|
||||||
|
XLog.v("tts设置Language结果:"+result);
|
||||||
|
textToSpeech.setPitch(1.0f);// 设置音调,值越大声音越尖(女生),值越小则变成男声,1.0是常规
|
||||||
|
textToSpeech.setSpeechRate(1.0f);
|
||||||
|
textToSpeech.setOnUtteranceProgressListener(SystemTTS.this);
|
||||||
|
textToSpeech.setOnUtteranceCompletedListener(SystemTTS.this);
|
||||||
|
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
|
||||||
|
//系统不支持中文播报
|
||||||
|
isSuccess = false;
|
||||||
|
ToastUtils.showToast(context, "系统不支持中文播报!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
XLog.v("tts初始化结果:"+i);
|
||||||
|
ToastUtils.showToast(context, "tts初始化失败!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//系统语音初始化成功
|
|
||||||
int result = textToSpeech.setLanguage(Locale.getDefault());
|
|
||||||
textToSpeech.setPitch(1.0f);// 设置音调,值越大声音越尖(女生),值越小则变成男声,1.0是常规
|
|
||||||
textToSpeech.setSpeechRate(1.0f);
|
|
||||||
textToSpeech.setOnUtteranceProgressListener(SystemTTS.this);
|
|
||||||
textToSpeech.setOnUtteranceCompletedListener(SystemTTS.this);
|
|
||||||
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
|
|
||||||
//系统不支持中文播报
|
|
||||||
isSuccess = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playText(String playText) {
|
public void playText(String playText) {
|
||||||
// if (!isSuccess) {
|
// if (!isSuccess) {
|
||||||
|
// ToastUtils.showToast(this.mContext, playText);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
Set<Locale> availableLanguages = textToSpeech.getAvailableLanguages();
|
Set<Locale> availableLanguages = textToSpeech.getAvailableLanguages();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TalentLocationUtils implements TencentLocationListener{
|
public class TalentLocationUtils implements TencentLocationListener {
|
||||||
private TencentLocationManager locationManager;
|
private TencentLocationManager locationManager;
|
||||||
private TencentLocationRequest locationRequest;
|
private TencentLocationRequest locationRequest;
|
||||||
private List<LocationSource.OnLocationChangedListener> locationChangedListenerList;
|
private List<LocationSource.OnLocationChangedListener> locationChangedListenerList;
|
||||||
@@ -38,7 +38,7 @@ public class TalentLocationUtils implements TencentLocationListener{
|
|||||||
private void init(Context mContext) {
|
private void init(Context mContext) {
|
||||||
locationChangedListenerList = new ArrayList<>();
|
locationChangedListenerList = new ArrayList<>();
|
||||||
//用于访问腾讯定位服务的类, 周期性向客户端提供位置更新
|
//用于访问腾讯定位服务的类, 周期性向客户端提供位置更新
|
||||||
locationManager = TencentLocationManager.getInstance(mContext);
|
locationManager = TencentLocationManager.getInstance(mContext, null);
|
||||||
//设置坐标系
|
//设置坐标系
|
||||||
locationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
|
locationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
|
||||||
//创建定位请求
|
//创建定位请求
|
||||||
@@ -46,7 +46,7 @@ public class TalentLocationUtils implements TencentLocationListener{
|
|||||||
locationRequest.setInterval(1000); // 每1秒返回一次地址数据
|
locationRequest.setInterval(1000); // 每1秒返回一次地址数据
|
||||||
locationRequest.setAllowDirection(true);
|
locationRequest.setAllowDirection(true);
|
||||||
locationRequest.setAllowGPS(true);
|
locationRequest.setAllowGPS(true);
|
||||||
locationRequest.setIndoorLocationMode(true);
|
// locationRequest.setIndoorLocationMode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startLocation(Context mContext) { // 启动定位服务
|
public void startLocation(Context mContext) { // 启动定位服务
|
||||||
@@ -54,7 +54,7 @@ public class TalentLocationUtils implements TencentLocationListener{
|
|||||||
this.init(mContext);
|
this.init(mContext);
|
||||||
}
|
}
|
||||||
if (!isLocationStart) {
|
if (!isLocationStart) {
|
||||||
int err = locationManager.requestLocationUpdates(locationRequest, this, Looper.myLooper());
|
int err = locationManager.requestLocationUpdates(locationRequest, this, Looper.myLooper(), 0);
|
||||||
isLocationStart = true;
|
isLocationStart = true;
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -138,6 +138,16 @@ public class TalentLocationUtils implements TencentLocationListener{
|
|||||||
Log.v("State changed", s + "===" + s1);
|
Log.v("State changed", s + "===" + s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGnssInfoChanged(Object o) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNmeaMsgChanged(String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public List<LocationSource.OnLocationChangedListener> getLocationChangedListenerList() {
|
public List<LocationSource.OnLocationChangedListener> getLocationChangedListenerList() {
|
||||||
return locationChangedListenerList;
|
return locationChangedListenerList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,646 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.lzy.okgo.OkGo;
|
||||||
|
import com.lzy.okgo.model.HttpParams;
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||||
|
import com.navinfo.outdoor.http.Callback;
|
||||||
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
|
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||||
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
|
import com.tencent.map.geolocation.TencentLocation;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.Polygon;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.PolygonOptions;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||||
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||||
|
import org.locationtech.jts.geom.Point;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理marker的公共类
|
||||||
|
* */
|
||||||
|
public class TencentMarkerUtils {
|
||||||
|
public static final int MARKER_DOT = 3;
|
||||||
|
public static final int MARKER_LINE = 2;
|
||||||
|
public static final int MARKER_FACE = 1;
|
||||||
|
public static final int MARKER_BIG = 4;
|
||||||
|
// 根据当前位置和屏幕中心点位置,获取marker列表数据
|
||||||
|
/**
|
||||||
|
* 网络删选接口
|
||||||
|
*
|
||||||
|
* @param tencentLocation location 用户当前位置
|
||||||
|
*/
|
||||||
|
public void initNetMarkerList(Activity mContext, TencentLocation tencentLocation, TencentMap tencentMap, List<Removable> removables, String taskTypeStr, String taskStatusStr, Map<String, List<Marker>> removableHashMap, int pageSize, MarkerInitCallback callback) {
|
||||||
|
int task_type = Constant.TASK_TYPE;
|
||||||
|
if (taskTypeStr != null) {
|
||||||
|
task_type = Integer.parseInt(taskTypeStr);
|
||||||
|
}
|
||||||
|
int limit_type = Constant.LIMIT_TYPE;
|
||||||
|
int taskStatus = Constant.TASK_STARTUP;
|
||||||
|
if (taskTypeStr!=null) {
|
||||||
|
taskStatus = Integer.parseInt(taskStatusStr);
|
||||||
|
}
|
||||||
|
if (taskStatus == 1) {
|
||||||
|
Message obtain = Message.obtain();
|
||||||
|
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||||
|
obtain.obj = null;
|
||||||
|
EventBus.getDefault().post(obtain);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LatLng mapCenterPoint = tencentMap.getCameraPosition().target;
|
||||||
|
if (mapCenterPoint == null) {
|
||||||
|
mapCenterPoint = new LatLng(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取中心点位置
|
||||||
|
String centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
|
||||||
|
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||||
|
OkGo.getInstance().cancelTag(this);
|
||||||
|
Log.d("TAG", "initList: " + Constant.USHERED);
|
||||||
|
// 请求方式和请求url
|
||||||
|
HttpParams httpParams = new HttpParams();
|
||||||
|
httpParams.put("userGeo", userEncode);
|
||||||
|
httpParams.put("centerGeo", centerEncode);
|
||||||
|
if (pageSize>0) {
|
||||||
|
httpParams.put("pageSize", pageSize);
|
||||||
|
} else {
|
||||||
|
httpParams.put("pageSize", Constant.NUMBER);
|
||||||
|
}
|
||||||
|
httpParams.put("pageNum", 1);
|
||||||
|
httpParams.put("type", task_type);
|
||||||
|
httpParams.put("isExclusive", limit_type);
|
||||||
|
if (taskStatus == 2) {
|
||||||
|
if (Constant.USHERED != null) {
|
||||||
|
httpParams.put("received", Constant.USHERED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||||
|
.time(30)
|
||||||
|
.Builder(mContext)
|
||||||
|
.url(HttpInterface.TASK_LIST)
|
||||||
|
.cls(JobSearchBean.class)
|
||||||
|
.params(httpParams)
|
||||||
|
.token(Constant.ACCESS_TOKEN);
|
||||||
|
okGoBuilder.getRequest(new Callback<JobSearchBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(JobSearchBean response, int id) {
|
||||||
|
if (response.getCode() == 200) {
|
||||||
|
JobSearchBean.BodyBean body = response.getBody();
|
||||||
|
if (body != null) {
|
||||||
|
Log.d("TAG", "onSuccess: " + response.getBody().toString());
|
||||||
|
for (int i = 0; i < removables.size(); i++) {
|
||||||
|
removables.get(i).remove();
|
||||||
|
}
|
||||||
|
removables.clear();
|
||||||
|
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
|
||||||
|
String encodeStr = list.get(i).getGeo();
|
||||||
|
// 解密geo
|
||||||
|
String geo = Geohash.getInstance().decode(encodeStr);
|
||||||
|
Log.d("TAG", "onSuccess: " + geo);
|
||||||
|
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||||
|
LatLng latLng = null;
|
||||||
|
switch (geometry.getGeometryType()) {
|
||||||
|
case "LineString": //线
|
||||||
|
case "MultiLineString"://多线
|
||||||
|
BitmapDescriptor bitmapLine = null;
|
||||||
|
if (listBean.getType() == 3) {//poi录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||||
|
} else if (listBean.getType() == 4) {//道路录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||||
|
}
|
||||||
|
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||||
|
// 构造 PolylineOptions
|
||||||
|
PolylineOptions polylineOptions = new PolylineOptions()
|
||||||
|
.addAll(latLineString)
|
||||||
|
// 折线设置圆形线头
|
||||||
|
.lineCap(true)
|
||||||
|
// 折线的颜色为绿色
|
||||||
|
.color(Color.parseColor("#0096FF"))
|
||||||
|
// 折线宽度为5像素
|
||||||
|
.width(28)
|
||||||
|
// 还可以添加描边颜色
|
||||||
|
//.borderColor(0xffff0000)
|
||||||
|
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||||
|
//.borderWidth(1);
|
||||||
|
.arrow(true)
|
||||||
|
.arrowSpacing(80)
|
||||||
|
.arrowTexture(bitmapLine);
|
||||||
|
// 绘制折线
|
||||||
|
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||||
|
if (polyline != null) {
|
||||||
|
polyline.setZIndex(MARKER_LINE);
|
||||||
|
removables.add(polyline);
|
||||||
|
if (latLineString != null && latLineString.size() > 0) {
|
||||||
|
latLng = latLineString.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Point": //点
|
||||||
|
latLng = GeometryTools.createLatLng(geo);
|
||||||
|
break;
|
||||||
|
case "Polygon": //面
|
||||||
|
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||||
|
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||||
|
//连接封闭图形的点
|
||||||
|
addAll(latPolygon).
|
||||||
|
//填充颜色为红色
|
||||||
|
fillColor(Color.parseColor("#97E0E7EC")).
|
||||||
|
//边线颜色为黑色
|
||||||
|
strokeColor(0xff000000).
|
||||||
|
//边线宽度15像素
|
||||||
|
strokeWidth(5));
|
||||||
|
if (polygon != null) {
|
||||||
|
polygon.setZIndex(MARKER_FACE);
|
||||||
|
removables.add(polygon);
|
||||||
|
org.locationtech.jts.geom.Point centroid = geometry.getCentroid();
|
||||||
|
double x = centroid.getX();
|
||||||
|
double y = centroid.getY();
|
||||||
|
latLng = new LatLng();
|
||||||
|
latLng.setLatitude(y);
|
||||||
|
latLng.setLongitude(x);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (list.get(i).getType()) {
|
||||||
|
case 1://poi
|
||||||
|
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
||||||
|
//poiDescriptor.getForager().setScale(50);
|
||||||
|
assert latLng != null;
|
||||||
|
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||||
|
.anchor(0.5f, 1.0f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
if (poiMarker != null) {
|
||||||
|
if (listBean != null) {
|
||||||
|
poiMarker.setTag(listBean);
|
||||||
|
}
|
||||||
|
poiMarker.setZIndex(MARKER_DOT);
|
||||||
|
removables.add(poiMarker);
|
||||||
|
String poiGeo = initGeo(latLng);
|
||||||
|
geoMarker(poiGeo, poiMarker, removableHashMap);
|
||||||
|
poiMarker.setClickable(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2://充电站
|
||||||
|
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||||
|
assert latLng != null;
|
||||||
|
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||||
|
.anchor(0.5f, 1.0f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
if (stationMarker != null) {
|
||||||
|
if (listBean != null) {
|
||||||
|
stationMarker.setTag(listBean);
|
||||||
|
}
|
||||||
|
stationMarker.setZIndex(MARKER_DOT);
|
||||||
|
removables.add(stationMarker);
|
||||||
|
String stationGeo = initGeo(latLng);
|
||||||
|
geoMarker(stationGeo, stationMarker, removableHashMap);
|
||||||
|
stationMarker.setClickable(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3://poi录像
|
||||||
|
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
||||||
|
assert latLng != null;
|
||||||
|
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||||
|
.anchor(0.5f, 1.0f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
if (poiVideoMarker != null) {
|
||||||
|
if (listBean != null) {
|
||||||
|
poiVideoMarker.setTag(listBean);
|
||||||
|
}
|
||||||
|
poiVideoMarker.setZIndex(MARKER_DOT);
|
||||||
|
removables.add(poiVideoMarker);
|
||||||
|
String poiVideoGeo = initGeo(latLng);
|
||||||
|
geoMarker(poiVideoGeo, poiVideoMarker, removableHashMap);
|
||||||
|
poiVideoMarker.setClickable(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4://道路录像
|
||||||
|
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||||
|
assert latLng != null;
|
||||||
|
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||||
|
.anchor(0.5f, 1.0f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
if (roadMarker != null) {
|
||||||
|
if (listBean != null) {
|
||||||
|
roadMarker.setTag(listBean);
|
||||||
|
}
|
||||||
|
roadMarker.setZIndex(MARKER_DOT);
|
||||||
|
removables.add(roadMarker);
|
||||||
|
String roadGeo = initGeo(latLng);
|
||||||
|
geoMarker(roadGeo, roadMarker, removableHashMap);
|
||||||
|
roadMarker.setClickable(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5://其他
|
||||||
|
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
||||||
|
assert latLng != null;
|
||||||
|
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||||
|
.anchor(0.5f, 1.0f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
if (otherMarker != null) {
|
||||||
|
if (listBean != null) {
|
||||||
|
otherMarker.setTag(listBean);
|
||||||
|
}
|
||||||
|
otherMarker.setZIndex(MARKER_DOT);
|
||||||
|
removables.add(otherMarker);
|
||||||
|
String otherGeo = initGeo(latLng);
|
||||||
|
geoMarker(otherGeo, otherMarker, removableHashMap);
|
||||||
|
otherMarker.setClickable(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6://面状任务
|
||||||
|
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
||||||
|
assert latLng != null;
|
||||||
|
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||||
|
.anchor(0.5f, 1.0f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
if (planarMarker != null) {
|
||||||
|
if (listBean != null) {
|
||||||
|
planarMarker.setTag(listBean);
|
||||||
|
}
|
||||||
|
planarMarker.setZIndex(MARKER_DOT);
|
||||||
|
removables.add(planarMarker);
|
||||||
|
String planarGeo = initGeo(latLng);
|
||||||
|
geoMarker(planarGeo, planarMarker, removableHashMap);
|
||||||
|
planarMarker.setClickable(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback.onMarkerInit(removableHashMap, response.getBody().getUpload(), list);
|
||||||
|
Message obtain = Message.obtain();
|
||||||
|
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||||
|
obtain.obj = response;
|
||||||
|
EventBus.getDefault().post(obtain);
|
||||||
|
}
|
||||||
|
} else if (response.getCode() == 230) {
|
||||||
|
FlushTokenUtil.flushToken(mContext);
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(mContext, response.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e, int id) {
|
||||||
|
String message = e.getMessage();
|
||||||
|
assert message != null;
|
||||||
|
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||||
|
ToastUtils.Message(mContext, "请求超时");
|
||||||
|
} else {
|
||||||
|
ToastUtils.Message(mContext, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*本地数据库数据*/
|
||||||
|
public void initLocalMarker(Activity mContext, TencentMap tencentMap, List<Removable> removablesLocality, Map<String, List<Marker>> removableHashMap, MarkerInitCallback callback) {
|
||||||
|
int taskStatus = Constant.TASK_STARTUP;
|
||||||
|
int type = Constant.TASK_TYPE;
|
||||||
|
int limit = Constant.LIMIT_TYPE;
|
||||||
|
PoiDatabase poiDatabase = PoiDatabase.getInstance(mContext);
|
||||||
|
if (poiDatabase == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<PoiEntity> allTaskStatus = poiDatabase.getPoiDao().getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
||||||
|
if (mContext != null) {
|
||||||
|
mContext.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (int i = 0; i < removablesLocality.size(); i++) {
|
||||||
|
removablesLocality.get(i).remove();
|
||||||
|
}
|
||||||
|
removablesLocality.clear();
|
||||||
|
for (int i = 0; i < allTaskStatus.size(); i++) {
|
||||||
|
PoiEntity poiEntity = allTaskStatus.get(i);
|
||||||
|
String geoWkt = allTaskStatus.get(i).getGeoWkt();
|
||||||
|
LatLng latLng = null;
|
||||||
|
Log.d("TAG", "onSuccess: " + geoWkt);
|
||||||
|
if (geoWkt != null) {
|
||||||
|
String geo = Geohash.getInstance().decode(geoWkt);//解密geo
|
||||||
|
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||||
|
switch (geometry.getGeometryType()) {
|
||||||
|
case "Point": //点
|
||||||
|
latLng = GeometryTools.createLatLng(geo);
|
||||||
|
break;
|
||||||
|
case "LineString": //线
|
||||||
|
case "MultiLineString"://多线
|
||||||
|
BitmapDescriptor bitmapLine = null;
|
||||||
|
int color = 0;
|
||||||
|
if (poiEntity.getType() == 3) {//poi录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||||
|
} else if (poiEntity.getType() == 4) {//道路录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||||
|
}
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
color = Color.parseColor("#FFE70C");
|
||||||
|
} else {
|
||||||
|
color = Color.parseColor("#BDBDBD");
|
||||||
|
}
|
||||||
|
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||||
|
// 构造 PolylineOnions
|
||||||
|
PolylineOptions polylineOptions = new PolylineOptions()
|
||||||
|
.addAll(latLineString)
|
||||||
|
// 折线设置圆形线头
|
||||||
|
.lineCap(true)
|
||||||
|
.color(color)
|
||||||
|
// 折线宽度为5像素
|
||||||
|
.width(28)
|
||||||
|
.arrow(true)
|
||||||
|
.arrowSpacing(80)
|
||||||
|
.arrowTexture(bitmapLine);
|
||||||
|
// 绘制折线
|
||||||
|
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||||
|
if (polyline != null) {
|
||||||
|
polyline.setZIndex(MARKER_LINE);
|
||||||
|
removablesLocality.add(polyline);
|
||||||
|
if (latLineString != null && latLineString.size() > 0) {
|
||||||
|
latLng = latLineString.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Polygon": //面
|
||||||
|
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||||
|
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
||||||
|
addAll(latPolygon).//填充颜色为浅蓝色
|
||||||
|
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
||||||
|
strokeColor(0xff00ff00).//边线宽度15像素
|
||||||
|
strokeWidth(5));
|
||||||
|
if (polygon != null) {
|
||||||
|
polygon.setZIndex(MARKER_FACE);
|
||||||
|
removablesLocality.add(polygon);
|
||||||
|
Point centroid = geometry.getCentroid();
|
||||||
|
double x = centroid.getX();
|
||||||
|
double y = centroid.getY();
|
||||||
|
latLng = new LatLng();
|
||||||
|
latLng.setLatitude(y);
|
||||||
|
latLng.setLongitude(x);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String detail = allTaskStatus.get(i).getDetail();
|
||||||
|
if (detail != null) {
|
||||||
|
String geo = Geohash.getInstance().decode(detail);//解密geo
|
||||||
|
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||||
|
switch (geometry.getGeometryType()) {
|
||||||
|
case "Point": //点
|
||||||
|
latLng = GeometryTools.createLatLng(geo);
|
||||||
|
break;
|
||||||
|
case "LineString": //线
|
||||||
|
case "MultiLineString"://多线
|
||||||
|
BitmapDescriptor bitmapLine = null;
|
||||||
|
int color = 0;
|
||||||
|
if (poiEntity.getType() == 3) {//poi录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||||
|
} else if (poiEntity.getType() == 4) {//道路录像
|
||||||
|
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||||
|
}
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
color = Color.parseColor("#FFE70C");
|
||||||
|
} else {
|
||||||
|
color = Color.parseColor("#BDBDBD");
|
||||||
|
}
|
||||||
|
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||||
|
// 构造 PolylineOnions
|
||||||
|
PolylineOptions polylineOptions = new PolylineOptions()
|
||||||
|
.addAll(latLineString)
|
||||||
|
// 折线设置圆形线头
|
||||||
|
.lineCap(true)
|
||||||
|
.color(color)
|
||||||
|
// 折线宽度为5像素
|
||||||
|
.width(28)
|
||||||
|
.arrow(true)
|
||||||
|
.arrowSpacing(80)
|
||||||
|
.arrowTexture(bitmapLine);
|
||||||
|
// 绘制折线
|
||||||
|
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||||
|
if (polyline != null) {
|
||||||
|
polyline.setZIndex(MARKER_LINE);
|
||||||
|
removablesLocality.add(polyline);
|
||||||
|
if (latLineString != null && latLineString.size() > 0) {
|
||||||
|
latLng = latLineString.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Polygon": //面
|
||||||
|
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||||
|
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
||||||
|
addAll(latPolygon).//填充颜色为浅蓝色
|
||||||
|
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
||||||
|
strokeColor(0xff00ff00).//边线宽度15像素
|
||||||
|
strokeWidth(5));
|
||||||
|
if (polygon != null) {
|
||||||
|
polygon.setZIndex(MARKER_FACE);
|
||||||
|
removablesLocality.add(polygon);
|
||||||
|
Point centroid = geometry.getCentroid();
|
||||||
|
double x = centroid.getX();
|
||||||
|
double y = centroid.getY();
|
||||||
|
latLng = new LatLng();
|
||||||
|
latLng.setLatitude(y);
|
||||||
|
latLng.setLongitude(x);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
||||||
|
latLng = new LatLng(Double.parseDouble(allTaskStatus.get(i).getY()), Double.parseDouble(allTaskStatus.get(i).getX()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (poiEntity.getType()) {
|
||||||
|
case 1://poi
|
||||||
|
BitmapDescriptor poiDescriptor = null;
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
||||||
|
} else {
|
||||||
|
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||||
|
}
|
||||||
|
assert latLng != null;
|
||||||
|
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor)
|
||||||
|
.flat(true)
|
||||||
|
.anchor(0.5f, 1f)
|
||||||
|
.clockwise(false));
|
||||||
|
poiMarker.setClickable(true);
|
||||||
|
poiMarker.setZIndex(MARKER_DOT);
|
||||||
|
poiMarker.setTitle(poiEntity.getName() + "");
|
||||||
|
poiMarker.setTag(poiEntity);
|
||||||
|
removablesLocality.add(poiMarker);
|
||||||
|
String poiGeo = initGeo(latLng);
|
||||||
|
geoMarker(poiGeo, poiMarker, removableHashMap);
|
||||||
|
break;
|
||||||
|
case 2://充电站
|
||||||
|
BitmapDescriptor chargeDescriptor = null;
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||||
|
} else {
|
||||||
|
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||||
|
}
|
||||||
|
assert latLng != null;
|
||||||
|
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor)
|
||||||
|
.flat(true)
|
||||||
|
.anchor(0.5f, 1f)
|
||||||
|
.clockwise(false));
|
||||||
|
stationMarker.setClickable(true);
|
||||||
|
stationMarker.setZIndex(MARKER_DOT);
|
||||||
|
stationMarker.setTitle(poiEntity.getName() + "");
|
||||||
|
stationMarker.setTag(poiEntity);
|
||||||
|
removablesLocality.add(stationMarker);
|
||||||
|
String stationGeo = initGeo(latLng);
|
||||||
|
geoMarker(stationGeo, stationMarker, removableHashMap);
|
||||||
|
break;
|
||||||
|
case 3://poi录像
|
||||||
|
BitmapDescriptor poiVideoDescriptor = null;
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
||||||
|
} else {
|
||||||
|
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoivideo);
|
||||||
|
}
|
||||||
|
assert latLng != null;
|
||||||
|
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor)
|
||||||
|
.anchor(0.5f, 1f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
poiVideoMarker.setClickable(true);
|
||||||
|
poiVideoMarker.setZIndex(MARKER_DOT);
|
||||||
|
poiVideoMarker.setTitle(poiEntity.getName() + "");
|
||||||
|
poiVideoMarker.setTag(poiEntity);
|
||||||
|
removablesLocality.add(poiVideoMarker);
|
||||||
|
String poiVideoGeo = initGeo(latLng);
|
||||||
|
geoMarker(poiVideoGeo, poiVideoMarker, removableHashMap);
|
||||||
|
break;
|
||||||
|
case 4://道路录像
|
||||||
|
BitmapDescriptor roadDescriptor = null;
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||||
|
} else {
|
||||||
|
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||||
|
}
|
||||||
|
assert latLng != null;
|
||||||
|
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor)
|
||||||
|
.anchor(0.5f, 1f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
roadMarker.setClickable(true);
|
||||||
|
roadMarker.setZIndex(MARKER_DOT);
|
||||||
|
roadMarker.setTitle(poiEntity.getName() + "");
|
||||||
|
roadMarker.setTag(poiEntity);
|
||||||
|
removablesLocality.add(roadMarker);
|
||||||
|
String roadGeo = initGeo(latLng);
|
||||||
|
geoMarker(roadGeo, roadMarker, removableHashMap);
|
||||||
|
break;
|
||||||
|
case 5://其他
|
||||||
|
BitmapDescriptor otherDescriptor = null;
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
||||||
|
} else {
|
||||||
|
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||||
|
}
|
||||||
|
assert latLng != null;
|
||||||
|
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor)
|
||||||
|
.anchor(0.5f, 1f)
|
||||||
|
.flat(true)
|
||||||
|
.clockwise(false));
|
||||||
|
otherMarker.setClickable(true);
|
||||||
|
otherMarker.setZIndex(MARKER_DOT);
|
||||||
|
otherMarker.setTitle(poiEntity.getName() + "");
|
||||||
|
otherMarker.setTag(poiEntity);
|
||||||
|
removablesLocality.add(otherMarker);
|
||||||
|
String otherGeo = initGeo(latLng);
|
||||||
|
geoMarker(otherGeo, otherMarker, removableHashMap);
|
||||||
|
break;
|
||||||
|
case 6://面状任务
|
||||||
|
BitmapDescriptor Descriptor = null;
|
||||||
|
if (poiEntity.getTaskStatus() == 1) {
|
||||||
|
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
||||||
|
} else {
|
||||||
|
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayfacet);
|
||||||
|
}
|
||||||
|
assert latLng != null;
|
||||||
|
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor)
|
||||||
|
.anchor(0.5f, 1f)
|
||||||
|
.clockwise(false)
|
||||||
|
.flat(true));
|
||||||
|
planarMarker.setClickable(true);
|
||||||
|
planarMarker.setZIndex(MARKER_DOT);
|
||||||
|
planarMarker.setTitle(poiEntity.getName() + "");
|
||||||
|
planarMarker.setTag(poiEntity);
|
||||||
|
removablesLocality.add(planarMarker);
|
||||||
|
String planarGeo = initGeo(latLng);
|
||||||
|
geoMarker(planarGeo, planarMarker, removableHashMap);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback.onMarkerInit(removableHashMap, null, allTaskStatus);
|
||||||
|
Message obtain = Message.obtain();
|
||||||
|
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||||
|
obtain.obj = allTaskStatus;
|
||||||
|
EventBus.getDefault().post(obtain);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* geo 坐标点转成
|
||||||
|
*
|
||||||
|
* @param latLng lat
|
||||||
|
*/
|
||||||
|
private String initGeo(LatLng latLng) {
|
||||||
|
return GeometryTools.createGeometry(latLng).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void geoMarker(String geo, Marker marker, Map<String, List<Marker>> removableHashMap) {
|
||||||
|
if (!removableHashMap.containsKey(geo)) {
|
||||||
|
List<Marker> markers = new ArrayList<>();
|
||||||
|
markers.add(marker);
|
||||||
|
removableHashMap.put(geo, markers);
|
||||||
|
} else {
|
||||||
|
List<Marker> markers = removableHashMap.get(geo);
|
||||||
|
assert markers != null;
|
||||||
|
markers.add(marker);
|
||||||
|
removableHashMap.put(geo, markers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface MarkerInitCallback<T> {
|
||||||
|
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet/*服务器返回的该用户需要上传的数据列表*/, List<T> listData);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
public class ToastUtils {
|
public class ToastUtils {
|
||||||
public static void Message(Activity context, String message) {
|
public static void Message(Activity context, String message) {
|
||||||
if (context!=null){
|
if (context!=null&&message!=null){
|
||||||
context.runOnUiThread(new Runnable() {
|
context.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -525,7 +525,7 @@ public class UploadUtils {
|
|||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||||
Response execute = OkGoBuilder.getInstance()
|
Response execute = OkGoBuilder.getInstance()
|
||||||
.time(0)
|
.time(600)
|
||||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||||
.params(httpParams)
|
.params(httpParams)
|
||||||
.token(Constant.ACCESS_TOKEN)
|
.token(Constant.ACCESS_TOKEN)
|
||||||
|
|||||||
14
app/src/main/res/color/rbtn_text_color_selector.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:color="#FFEB3B"/> <!-- pressed 看下的颜色-->
|
||||||
|
<item android:state_focused="true"
|
||||||
|
android:color="#FFEB3B"/> <!-- focused -->
|
||||||
|
<item android:state_selected="true"
|
||||||
|
android:color="#FFEB3B"/> <!-- focused -->
|
||||||
|
<item android:state_checked="true"
|
||||||
|
android:color="#FFEB3B"/> <!-- focused -->
|
||||||
|
<item android:state_enabled="false"
|
||||||
|
android:color="@color/colorGrays"/> <!-- focused -->
|
||||||
|
<item android:color="@color/white"/> <!-- default 默认颜色 -->
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="@color/colorGray" android:state_checked="true" />
|
||||||
|
<item android:color="@color/colorGray" android:state_selected="true" />
|
||||||
|
<item android:color="@color/colorGray" android:state_pressed="true" />
|
||||||
|
<item android:color="@color/colorGray" android:state_enabled="false"/>
|
||||||
|
<item android:color="@color/colorPrimaryBlue" />
|
||||||
|
</selector>
|
||||||
BIN
app/src/main/res/drawable-hdpi/locaiton_auto_pictures.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
14
app/src/main/res/drawable/btn_stroke_corners_bg.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners
|
||||||
|
android:radius="@dimen/default_corner_radius" />
|
||||||
|
<padding
|
||||||
|
android:bottom="@dimen/default_widget_padding"
|
||||||
|
android:left="@dimen/default_widget_padding"
|
||||||
|
android:right="@dimen/default_widget_padding"
|
||||||
|
android:top="@dimen/default_widget_padding" />
|
||||||
|
<stroke
|
||||||
|
android:width="0.5dp"
|
||||||
|
android:color="@color/colorPrimaryBlue" />
|
||||||
|
</shape>
|
||||||
14
app/src/main/res/drawable/btn_stroke_corners_bg_disable.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners
|
||||||
|
android:radius="@dimen/default_corner_radius" />
|
||||||
|
<padding
|
||||||
|
android:bottom="@dimen/default_widget_padding"
|
||||||
|
android:left="@dimen/default_widget_padding"
|
||||||
|
android:right="@dimen/default_widget_padding"
|
||||||
|
android:top="@dimen/default_widget_padding" />
|
||||||
|
<stroke
|
||||||
|
android:width="0.5dp"
|
||||||
|
android:color="@color/colorGray" />
|
||||||
|
</shape>
|
||||||
6
app/src/main/res/drawable/round_bg_gray.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="@color/colorGrays"/>
|
||||||
|
</shape>
|
||||||
6
app/src/main/res/drawable/round_bg_white.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="@color/white"/>
|
||||||
|
</shape>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@drawable/btn_stroke_corners_bg_disable" android:state_checked="true" />
|
||||||
|
<item android:drawable="@drawable/btn_stroke_corners_bg_disable" android:state_selected="true" />
|
||||||
|
<item android:drawable="@drawable/btn_stroke_corners_bg_disable" android:state_pressed="true" />
|
||||||
|
<item android:drawable="@drawable/btn_stroke_corners_bg_disable" android:state_enabled="false"/>
|
||||||
|
<item android:drawable="@drawable/btn_stroke_corners_bg" />
|
||||||
|
</selector>
|
||||||
14
app/src/main/res/drawable/selector_direction.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@mipmap/direction_press"/> <!-- pressed -->
|
||||||
|
<item android:state_focused="true"
|
||||||
|
android:drawable="@mipmap/direction_press"/> <!-- focused -->
|
||||||
|
<item android:state_selected="true"
|
||||||
|
android:drawable="@mipmap/direction_press"/>
|
||||||
|
<item android:state_checked="true"
|
||||||
|
android:drawable="@mipmap/direction_press"/>
|
||||||
|
<item android:state_enabled="false"
|
||||||
|
android:drawable="@mipmap/direction_press"/>
|
||||||
|
<item android:drawable="@mipmap/direction" /> <!-- default -->
|
||||||
|
</selector>
|
||||||
14
app/src/main/res/drawable/selector_navi_distance.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@mipmap/navi_distance_disable"/> <!-- pressed -->
|
||||||
|
<item android:state_focused="true"
|
||||||
|
android:drawable="@mipmap/navi_distance_disable"/> <!-- focused -->
|
||||||
|
<item android:state_selected="true"
|
||||||
|
android:drawable="@mipmap/navi_distance_disable"/>
|
||||||
|
<item android:state_checked="true"
|
||||||
|
android:drawable="@mipmap/navi_distance_disable"/>
|
||||||
|
<item android:state_enabled="false"
|
||||||
|
android:drawable="@mipmap/navi_distance_disable"/>
|
||||||
|
<item android:drawable="@mipmap/navi_distance_normal" /> <!-- default -->
|
||||||
|
</selector>
|
||||||
14
app/src/main/res/drawable/selector_picture_map_change.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@mipmap/exchange_press"/> <!-- pressed -->
|
||||||
|
<item android:state_focused="true"
|
||||||
|
android:drawable="@mipmap/exchange_press"/> <!-- focused -->
|
||||||
|
<item android:state_selected="true"
|
||||||
|
android:drawable="@mipmap/exchange_press"/>
|
||||||
|
<item android:state_checked="true"
|
||||||
|
android:drawable="@mipmap/exchange_press"/>
|
||||||
|
<item android:state_enabled="false"
|
||||||
|
android:drawable="@mipmap/exchange_press"/>
|
||||||
|
<item android:drawable="@mipmap/exchange" /> <!-- default -->
|
||||||
|
</selector>
|
||||||
14
app/src/main/res/drawable/selector_round_bg.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/round_bg_gray"/> <!-- pressed -->
|
||||||
|
<item android:state_focused="true"
|
||||||
|
android:drawable="@drawable/round_bg_gray"/> <!-- focused -->
|
||||||
|
<item android:state_selected="true"
|
||||||
|
android:drawable="@drawable/round_bg_gray"/>
|
||||||
|
<item android:state_checked="true"
|
||||||
|
android:drawable="@drawable/round_bg_gray"/>
|
||||||
|
<item android:state_enabled="false"
|
||||||
|
android:drawable="@drawable/round_bg_gray"/>
|
||||||
|
<item android:drawable="@drawable/round_bg_white" /> <!-- default -->
|
||||||
|
</selector>
|
||||||
288
app/src/main/res/layout/activity_auto_take_pictures.xml
Normal file
@@ -0,0 +1,288 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#FF444444"
|
||||||
|
tools:context=".activity.PicturesActivity">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/layer_change"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<com.otaliastudios.cameraview.CameraView
|
||||||
|
android:id="@+id/camera"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:keepScreenOn="true"
|
||||||
|
app:cameraPictureFormat="jpeg"
|
||||||
|
app:cameraPictureMetering="true"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
|
||||||
|
android:id="@+id/text_map_view"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="157dp"
|
||||||
|
app:layout_constraintHeight_default="percent"
|
||||||
|
app:layout_constraintHeight_percent="0.4"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintWidth_default="percent"
|
||||||
|
app:layout_constraintWidth_percent="0.4" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_view"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
app:layout_constraintHeight_default="percent"
|
||||||
|
app:layout_constraintHeight_percent="0.4"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintWidth_default="percent"
|
||||||
|
app:layout_constraintWidth_percent="0.4" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_convert"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_zoom_add"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginEnd="25dp"
|
||||||
|
android:src="@mipmap/zoom_add"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/btn_stop_picture"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_zoom_del"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:src="@mipmap/zoom_del"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_add"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_zoom_add" />
|
||||||
|
|
||||||
|
<!--<CheckBox
|
||||||
|
android:id="@+id/cb_map_type"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:background="@drawable/atlas_selector"
|
||||||
|
android:button="@null"
|
||||||
|
android:checked="false"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />-->
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_location"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:background="@drawable/selector_round_bg"
|
||||||
|
android:src="@mipmap/location_auto_pic"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btn_switch"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:background="@drawable/selector_round_bg"
|
||||||
|
android:layout_marginTop="35dp"
|
||||||
|
android:src="@drawable/selector_picture_map_change"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:layout_marginRight="@dimen/default_widget_padding"
|
||||||
|
android:text="切换"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_setting"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:text="设置"
|
||||||
|
android:layout_marginTop="@dimen/default_widget_padding"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_switch"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"></Button>
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
android:id="@+id/location_switch"
|
||||||
|
android:text="启用定位"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:checked="true"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_setting"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"></Switch>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_navi_distance"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:src="@drawable/selector_navi_distance"
|
||||||
|
android:background="@drawable/selector_round_bg"
|
||||||
|
android:text="按距离自动导航"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:layout_margin="@dimen/default_widget_padding"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/location_switch"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_road_direction"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:background="@drawable/selector_round_bg"
|
||||||
|
android:text="起点方向捕捉"
|
||||||
|
android:src="@drawable/selector_direction"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:layout_margin="@dimen/default_widget_padding"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/img_navi_distance"></ImageView>
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/radio_group_picture"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="35dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/image_view">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radio_btn_hand"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="手动"
|
||||||
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radio_btn_half_sec"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="自动0.5秒"
|
||||||
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radio_btn_auto"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="自动1秒"
|
||||||
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radio_btn_auto_sec"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="自动2秒"
|
||||||
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_pic_road"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/take_pic_arrow"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_pic_video"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/take_poi_video_arrow"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/clear_all_match_data"
|
||||||
|
style="@style/user_data_style"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:background="@drawable/user_style"
|
||||||
|
android:button="@null"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="@dimen/fab_margin"
|
||||||
|
android:text="清空匹配"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toLeftOf="@id/btn_stop_picture" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_stop_picture"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/uploding_shape"
|
||||||
|
android:text="结束采集"
|
||||||
|
android:textColor="@color/colorBlue"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/clear_all_match_data"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/clear_all_match_data"
|
||||||
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -6,5 +6,14 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/start_bg"
|
android:background="@drawable/start_bg"
|
||||||
tools:context="activity.MainActivity">
|
tools:context="activity.MainActivity">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
12
app/src/main/res/layout/activity_navi_car.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.NaviCarActivity">
|
||||||
|
<com.tencent.map.navi.car.CarNaviView
|
||||||
|
android:id="@+id/carnaviview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
12
app/src/main/res/layout/activity_navi_ride.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.NaviCarActivity">
|
||||||
|
<com.tencent.map.navi.ride.RideNaviView
|
||||||
|
android:id="@+id/ridenaviview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
12
app/src/main/res/layout/activity_navi_walk.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.NaviCarActivity">
|
||||||
|
<com.tencent.map.navi.walk.WalkNaviView
|
||||||
|
android:id="@+id/walknaviview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -23,15 +23,6 @@
|
|||||||
android:keepScreenOn="true"
|
android:keepScreenOn="true"
|
||||||
app:cameraPictureFormat="jpeg"
|
app:cameraPictureFormat="jpeg"
|
||||||
app:cameraPictureMetering="true"
|
app:cameraPictureMetering="true"
|
||||||
app:cameraPictureSizeAspectRatio="1920:1080"
|
|
||||||
app:cameraPictureSizeBiggest="true"
|
|
||||||
app:cameraPictureSizeMaxArea="3686400"
|
|
||||||
app:cameraPictureSizeMaxHeight="1920"
|
|
||||||
app:cameraPictureSizeMaxWidth="1920"
|
|
||||||
app:cameraPictureSizeMinArea="1166400"
|
|
||||||
app:cameraPictureSizeMinHeight="1080"
|
|
||||||
app:cameraPictureSizeMinWidth="1080"
|
|
||||||
app:cameraPictureSizeSmallest="true"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@@ -61,15 +52,32 @@
|
|||||||
app:layout_constraintWidth_default="percent"
|
app:layout_constraintWidth_default="percent"
|
||||||
app:layout_constraintWidth_percent="0.4" />
|
app:layout_constraintWidth_percent="0.4" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="25dp"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_convert"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_zoom_add"
|
android:id="@+id/iv_zoom_add"
|
||||||
@@ -114,17 +122,28 @@
|
|||||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
|
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
|
||||||
|
|
||||||
<Button
|
<ImageView
|
||||||
android:id="@+id/btn_switch"
|
android:id="@+id/btn_switch"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="25dp"
|
||||||
android:layout_marginEnd="25dp"
|
android:layout_marginEnd="25dp"
|
||||||
android:text="切换"
|
android:text="切换"
|
||||||
android:visibility="gone"
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:src="@mipmap/switcher"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_setting"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="设置"
|
||||||
|
android:layout_marginTop="@dimen/default_widget_padding"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_switch"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"></Button>
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/radio_group_picture"
|
android:id="@+id/radio_group_picture"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -144,7 +163,17 @@
|
|||||||
android:layout_marginBottom="15dp"
|
android:layout_marginBottom="15dp"
|
||||||
android:button="@null"
|
android:button="@null"
|
||||||
android:text="手动"
|
android:text="手动"
|
||||||
android:textColor="@color/white" />
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radio_btn_half_sec"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="自动0.5秒"
|
||||||
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/radio_btn_auto"
|
android:id="@+id/radio_btn_auto"
|
||||||
@@ -154,7 +183,7 @@
|
|||||||
android:layout_marginBottom="15dp"
|
android:layout_marginBottom="15dp"
|
||||||
android:button="@null"
|
android:button="@null"
|
||||||
android:text="自动1秒"
|
android:text="自动1秒"
|
||||||
android:textColor="@color/white" />
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/radio_btn_auto_sec"
|
android:id="@+id/radio_btn_auto_sec"
|
||||||
@@ -164,7 +193,7 @@
|
|||||||
android:layout_marginBottom="15dp"
|
android:layout_marginBottom="15dp"
|
||||||
android:button="@null"
|
android:button="@null"
|
||||||
android:text="自动2秒"
|
android:text="自动2秒"
|
||||||
android:textColor="@color/white" />
|
android:textColor="@color/rbtn_text_color_selector" />
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
style="@style/user_text_style" />
|
style="@style/user_text_style" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_attestations"
|
android:id="@+id/btn_attestations"
|
||||||
style="@style/user_style"
|
style="@style/user_style"
|
||||||
@@ -153,24 +154,35 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_number"
|
android:id="@+id/tv_number"
|
||||||
|
style="@style/user_text_style"
|
||||||
android:layout_width="80dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="手机号码*"
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
style="@style/user_text_style"
|
android:text="手机号码*" />
|
||||||
/>
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_phone_edit"
|
||||||
|
style="@style/user_style"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:text="修改"
|
||||||
|
android:textColor="#fff" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_phone"
|
android:id="@+id/et_phone"
|
||||||
android:layout_toEndOf="@id/tv_number"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
style="@style/user_hint_style"
|
style="@style/user_hint_style"
|
||||||
android:digits="1234567890"
|
android:layout_width="match_parent"
|
||||||
android:maxLength="11"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:hint="请输入手机号码"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toLeftOf="@id/btn_phone_edit"
|
||||||
|
android:layout_toRightOf="@id/tv_number"
|
||||||
|
android:digits="1234567890"
|
||||||
|
android:hint="请输入手机号码"
|
||||||
|
android:maxLength="11" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
|||||||
165
app/src/main/res/layout/camera_setting.xml
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/dialogButtonMIUITextGray"
|
||||||
|
android:padding="@dimen/fab_margin"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="屏幕亮度"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_brightness"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="number"
|
||||||
|
android:hint="屏幕亮度"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="相机刷新"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_framness"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="number"
|
||||||
|
android:hint="相机刷新"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="起点距离阈值"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_start_distance"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:hint="起点距离阈值"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="过程点距离阈值"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_mid_distance"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:hint="过程点距离阈值"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
<!--<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="起点放弃个数"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_start_count"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="number"
|
||||||
|
android:hint="起点放弃个数"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>-->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="过程点放弃个数"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_mid_count"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="number"
|
||||||
|
android:hint="过程点放弃个数"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- <LinearLayout-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:orientation="horizontal">-->
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:paddingHorizontal="@dimen/default_widget_padding"-->
|
||||||
|
<!-- android:text="放弃匹配距离阈值"></TextView>-->
|
||||||
|
|
||||||
|
<!-- <EditText-->
|
||||||
|
<!-- android:id="@+id/edt_camera_setting_unmatch_pecent"-->
|
||||||
|
<!-- android:layout_width="150dp"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:inputType="numberDecimal"-->
|
||||||
|
<!-- android:hint="放弃匹配距离百分比"-->
|
||||||
|
<!-- ></EditText>-->
|
||||||
|
<!-- </LinearLayout>-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="完全匹配距离百分比"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_match_pecent"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:hint="完全匹配距离百分比"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_camera_setting_confirm"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="确定"
|
||||||
|
android:layout_gravity="center"></Button>
|
||||||
|
</LinearLayout>
|
||||||
53
app/src/main/res/layout/camera_setting_pre.xml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/dialogButtonMIUITextGray"
|
||||||
|
android:padding="@dimen/fab_margin"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="屏幕亮度"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_brightness"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="number"
|
||||||
|
android:hint="屏幕亮度"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:text="相机刷新"></TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_camera_setting_framness"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="number"
|
||||||
|
android:hint="相机刷新"
|
||||||
|
></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_camera_setting_confirm"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="确定"
|
||||||
|
android:layout_gravity="center"></Button>
|
||||||
|
</LinearLayout>
|
||||||
74
app/src/main/res/layout/dialog_select_navi_type.xml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:background="@drawable/selector_hui_bg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/navi_type_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/text_style_title"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="选择导航模式"></TextView>
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/rg_navi_type"
|
||||||
|
android:layout_below="@id/navi_type_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginVertical="@dimen/fab_margin"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/navi_type_car"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="驾车"
|
||||||
|
android:background="@drawable/selector_default_btn_round_corner_bg"
|
||||||
|
style="@style/btn_round_corner"></RadioButton>
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/navi_type_ride"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="骑行"
|
||||||
|
android:layout_marginHorizontal="@dimen/fab_margin"
|
||||||
|
android:background="@drawable/selector_default_btn_round_corner_bg"
|
||||||
|
style="@style/btn_round_corner"></RadioButton>
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/navi_type_walk"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:button="@null"
|
||||||
|
android:text="步行"
|
||||||
|
android:background="@drawable/selector_default_btn_round_corner_bg"
|
||||||
|
style="@style/btn_round_corner"></RadioButton>
|
||||||
|
</RadioGroup>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/rg_navi_type"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_navi_type_select_confirm"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/btn_round_corner"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:text="确定"></TextView>
|
||||||
|
<Space
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
</Space>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_navi_type_select_cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:textColor="@color/colorRed"
|
||||||
|
android:text="取消"></TextView>
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
60
app/src/main/res/layout/edit_phone.xml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="@dimen/fab_margin"
|
||||||
|
android:background="@color/white"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_phone_new"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="请输入新手机号"
|
||||||
|
android:maxLength="11"
|
||||||
|
android:digits="0123456789"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
style="@style/MyEditText"></EditText>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/layer_confirm"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/edt_phone_new"
|
||||||
|
android:layout_marginTop="@dimen/default_widget_padding"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_confirm_code"
|
||||||
|
style="@style/user_style"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:text="获取验证码"
|
||||||
|
android:layout_marginHorizontal="@dimen/default_widget_padding"
|
||||||
|
android:textColor="#fff" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edt_phone_confirm_code"
|
||||||
|
style="@style/MyEditText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBaseline="@id/tv_confirm_code"
|
||||||
|
android:layout_toLeftOf="@id/tv_confirm_code"
|
||||||
|
android:digits="0123456789"
|
||||||
|
android:hint="请输入验证码"
|
||||||
|
android:maxLength="11"></EditText>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_finish"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/default_widget_padding"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/layer_confirm"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
style="@style/user_style"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:text="确认修改"></Button>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_delete"
|
android:id="@+id/btn_delete"
|
||||||
android:layout_width="25dp"
|
android:layout_width="28dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="28dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:background="@drawable/delete"
|
android:background="@drawable/delete"
|
||||||
@@ -16,6 +16,20 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_gather_start_navi"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/pickerview_topbar_title_textsize"
|
||||||
|
android:textColor="@color/colorWhite"
|
||||||
|
android:padding="@dimen/default_widget_padding"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:background="@drawable/selector_red_bg"
|
||||||
|
app:layout_constraintRight_toLeftOf="@id/btn_delete"
|
||||||
|
app:layout_constraintBaseline_toBaselineOf="@id/btn_delete"
|
||||||
|
android:layout_marginEnd="18dp"
|
||||||
|
android:text="导航到此处"></androidx.appcompat.widget.AppCompatTextView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linear_layout"
|
android:id="@+id/linear_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_mas_notification"
|
android:id="@+id/iv_mas_notification"
|
||||||
android:layout_width="10dp"
|
android:layout_width="10dp"
|
||||||
@@ -91,7 +92,6 @@
|
|||||||
android:background="@drawable/atlas_selector"
|
android:background="@drawable/atlas_selector"
|
||||||
android:button="@null"
|
android:button="@null"
|
||||||
android:checked="false"
|
android:checked="false"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/iv_zoom_del"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_zoom_add" />
|
app:layout_constraintTop_toTopOf="@+id/iv_zoom_add" />
|
||||||
|
|
||||||
@@ -101,7 +101,6 @@
|
|||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:src="@mipmap/submit"
|
android:src="@mipmap/submit"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/iv_refrish"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/cb_map_type"
|
app:layout_constraintEnd_toEndOf="@+id/cb_map_type"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/cb_map_type"
|
app:layout_constraintLeft_toLeftOf="@id/cb_map_type"
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_zoom_del" />
|
app:layout_constraintTop_toTopOf="@+id/iv_zoom_del" />
|
||||||
@@ -111,10 +110,34 @@
|
|||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:src="@mipmap/filter"
|
android:src="@mipmap/filter"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/iv_location"
|
app:layout_constraintLeft_toLeftOf="@id/iv_submit"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/cb_map_type"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_refrish" />
|
app:layout_constraintTop_toTopOf="@+id/iv_refrish" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_navi_distance"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:src="@drawable/selector_navi_distance"
|
||||||
|
android:background="@drawable/selector_round_bg"
|
||||||
|
android:text="按距离自动导航"
|
||||||
|
android:padding="8dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/iv_submit"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/iv_location"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_auto_match_road"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:src="@mipmap/auto_camera"
|
||||||
|
android:background="@drawable/selector_round_bg"
|
||||||
|
android:text="道路自动匹配"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/img_navi_distance"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/img_navi_distance"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_zoom_add"
|
android:id="@+id/iv_zoom_add"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
@@ -153,6 +176,7 @@
|
|||||||
app:layout_constraintLeft_toLeftOf="@id/iv_refrish"
|
app:layout_constraintLeft_toLeftOf="@id/iv_refrish"
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_refrish" />
|
app:layout_constraintTop_toBottomOf="@id/iv_refrish" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
BIN
app/src/main/res/mipmap-xxhdpi/auto_camera.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/direction.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/direction_press.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/exchange.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/exchange_press.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/location_auto_pic.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/navi_distance_disable.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/navi_distance_normal.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/navigation_distance.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/navigation_distance_disable.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |