清理过期项目
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sat Mar 29 11:28:02 HKT 2025
|
||||
#Mon Apr 07 17:00:16 GMT 2025
|
||||
stageCount=3
|
||||
libraryProject=libappbase
|
||||
baseVersion=15.2
|
||||
publishVersion=15.2.2
|
||||
buildCount=0
|
||||
buildCount=1
|
||||
baseBetaVersion=15.2.3
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sat Mar 29 11:27:54 HKT 2025
|
||||
#Mon Apr 07 17:00:16 GMT 2025
|
||||
stageCount=3
|
||||
libraryProject=libappbase
|
||||
baseVersion=15.2
|
||||
publishVersion=15.2.2
|
||||
buildCount=0
|
||||
buildCount=1
|
||||
baseBetaVersion=15.2.3
|
||||
|
BIN
positions/.DS_Store
vendored
@ -1,41 +0,0 @@
|
||||
# Positions
|
||||
本项目涉及个人隐私,现转为个人应用开发。项目源码正式停止公开维护。
|
||||
|
||||
#### 介绍
|
||||
位置应用,与卫星定位有关的应用。可以根据设定的位置与时间条件判断,来发送通知的应用。
|
||||
|
||||
|
||||
#### 软件架构
|
||||
以腾讯位置服务SDK源码为基础。源码地址:https://lbs.qq.com/mobile/androidMapSDK/developerGuide/configuration
|
||||
适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。
|
||||
也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。
|
||||
|
||||
|
||||
#### Gradle 编译说明
|
||||
调试版编译命令 :gradle assembleBetaDebug
|
||||
阶段版编译命令 :gradle assembleStageRelease
|
||||
|
||||
#### 使用说明
|
||||
|
||||
在安卓系统中需要设置两个权限允许。
|
||||
1.自启动权限允许。
|
||||
2.省电策略-无限制权限允许。
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码 : ZhanGSKen(ZhanGSKen@AliYun.Com)
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
||||
#### 参考文档
|
@ -1,114 +0,0 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: '../.winboll/winboll_app_build.gradle'
|
||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
||||
|
||||
def genVersionName(def versionName){
|
||||
// 检查编译标志位配置
|
||||
assert (winbollBuildProps['stageCount'] != null)
|
||||
assert (winbollBuildProps['baseVersion'] != null)
|
||||
// 保存基础版本号
|
||||
winbollBuildProps.setProperty("baseVersion", "${versionName}");
|
||||
//保存编译标志配置
|
||||
FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile)
|
||||
winbollBuildProps.store(fos, "${winbollBuildPropsDesc}");
|
||||
fos.close();
|
||||
|
||||
// 返回编译版本号
|
||||
return "${versionName}." + winbollBuildProps['stageCount']
|
||||
}
|
||||
|
||||
Properties properties = new Properties()
|
||||
File localFile = project.rootProject.file('local.properties')
|
||||
if (localFile.exists()) {
|
||||
InputStream inputStream = localFile.newDataInputStream()
|
||||
properties.load(inputStream)
|
||||
}
|
||||
|
||||
def mapsdkkey = properties.getProperty('mapsdk.key', "")
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "cc.winboll.studio.positions"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
// versionName 更新后需要手动设置
|
||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||
versionName "1.0"
|
||||
if(true) {
|
||||
versionName = genVersionName("${versionName}")
|
||||
}
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
manifestPlaceholders = ["TencentMapSDK_KEY": mapsdkkey]
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
// 定位服务
|
||||
api 'com.google.android.gms:play-services-location:20.0.0'
|
||||
|
||||
// 腾讯地图
|
||||
//api 'com.tencent.map:tencent-map-vector-sdk:6.2.1.250120.3f971009.140342819'
|
||||
// 地图库
|
||||
api 'com.tencent.map:tencent-map-vector-sdk:4.5.6'
|
||||
// 地图组件库,包括小车平移、点聚合等组件功能,详见开发指南。
|
||||
api 'com.tencent.map:sdk-utilities:1.0.6'
|
||||
//api 'com.tencent.openmap:foundation:0.5.6.9be4e02'
|
||||
api 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.5.4.3'
|
||||
|
||||
api 'com.google.code.gson:gson:2.8.5'
|
||||
// 权限申请框架
|
||||
//implementation 'pub.devrel:easypermissions:2.0.1'
|
||||
// 权限申请框架:https://github.com/getActivity/XXPermissions
|
||||
//implementation 'com.github.getActivity:XXPermissions:18.63'
|
||||
// 下拉控件
|
||||
api 'com.baoyz.pullrefreshlayout:library:1.2.0'
|
||||
// 拼音搜索
|
||||
// https://mvnrepository.com/artifact/com.github.open-android/pinyin4j
|
||||
//implementation 'com.github.open-android:pinyin4j:2.5.0'
|
||||
// SSH
|
||||
//implementation 'com.jcraft:jsch:0.1.55'
|
||||
// Html 解析
|
||||
//implementation 'org.jsoup:jsoup:1.13.1'
|
||||
// 二维码类库
|
||||
api 'com.google.zxing:core:3.4.1'
|
||||
api 'com.journeyapps:zxing-android-embedded:3.6.0'
|
||||
// 应用介绍页类库
|
||||
//implementation 'io.github.medyo:android-about-page:2.0.0'
|
||||
// 吐司类库
|
||||
//implementation 'com.github.getActivity:ToastUtils:10.5'
|
||||
// 网络连接类库
|
||||
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||
|
||||
// AndroidX 类库
|
||||
api 'androidx.appcompat:appcompat:1.1.0'
|
||||
api 'com.google.android.material:material:1.4.0'
|
||||
//api 'androidx.viewpager:viewpager:1.0.0'
|
||||
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
||||
//api 'androidx.fragment:fragment:1.1.0'
|
||||
|
||||
api 'cc.winboll.studio:libaes:15.2.6'
|
||||
api 'cc.winboll.studio:libapputils:15.2.2'
|
||||
api 'cc.winboll.studio:libappbase:15.2.2'
|
||||
|
||||
/*api 'androidx.appcompat:appcompat:1.1.0'
|
||||
api 'androidx.viewpager:viewpager:1.0.0'
|
||||
api 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||
api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
||||
api 'androidx.fragment:fragment:1.1.0'
|
||||
api 'com.google.android.material:material:1.3.0'
|
||||
*/
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Mon Apr 07 16:13:21 GMT 2025
|
||||
stageCount=0
|
||||
libraryProject=
|
||||
baseVersion=1.0
|
||||
publishVersion=1.0.0
|
||||
buildCount=459
|
||||
baseBetaVersion=1.0.1
|
41
positions/proguard-rules.pro
vendored
@ -1,41 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-dontwarn com.tencent.bugly.**
|
||||
-keep public class com.tencent.bugly.**{*;}
|
||||
|
||||
-dontwarn com.tencent.tmsqmsp.**
|
||||
-keep public class com.tencent.tmsqmsp.**{*;}
|
||||
|
||||
-dontwarn com.tencent.tmsbeacon.**
|
||||
-keep public class com.tencent.tmsbeacon.**{*;}
|
||||
|
||||
-dontwarn com.tencent.map.**
|
||||
-keep public class com.tencent.map.** {*;}
|
||||
|
||||
-dontwarn com.tencent.mapsdk.**
|
||||
-keep public class com.tencent.mapsdk.** {*;}
|
||||
|
||||
-dontwarn com.tencent.tencentmap.**
|
||||
-keep public class com.tencent.tencentmap.** {*;}
|
||||
|
||||
-dontwarn com.tencent.lbssearch.**
|
||||
-keep public class com.tencent.lbssearch.** {*;}
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" >
|
||||
|
||||
<application
|
||||
tools:replace="android:icon"
|
||||
android:icon="@drawable/ic_winbollbeta">
|
||||
|
||||
<!-- Put flavor specific code here -->
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">Positions+</string>
|
||||
|
||||
</resources>
|
@ -1,746 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="cc.winboll.studio.positions">
|
||||
|
||||
<!-- 拥有完全的网络访问权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- 查看网络连接 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
<!-- 查看WLAN连接 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
|
||||
<!-- 修改或删除您共享存储空间中的内容 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
||||
<!-- 读取您共享存储空间中的内容 -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
||||
<!-- 读取手机状态和身份 -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
|
||||
<!-- 只能在前台获取精确的位置信息 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
|
||||
<!-- 只有在前台运行时才能获取大致位置信息 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
|
||||
<!-- 连接WLAN网络和断开连接 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
|
||||
<!-- 更改网络连接性 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
|
||||
|
||||
<application
|
||||
tools:replace="android:appComponentFactory"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/MyAppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
|
||||
|
||||
<activity android:name=".MainActivity">
|
||||
|
||||
<intent-filter>
|
||||
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity android:name=".MainSimpleActivity">
|
||||
|
||||
</activity>
|
||||
|
||||
<activity android:name="com.tencent.map.vector.demo.DemoMainActivity">
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.map.vector.demo.basic.MapViewActivity"
|
||||
android:description="@string/demo_description_show_map"
|
||||
android:label="@string/demo_label_show_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_basic"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".basic.SetMapTypeActivity"
|
||||
android:description="@string/demo_description_map_type"
|
||||
android:label="@string/demo_label_map_type">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_basic"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".basic.MapRenderLayerActivity"
|
||||
android:description="@string/demo_description_show_mapRenderLayer"
|
||||
android:label="@string/demo_label_show_mapRenderLayer">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_basic"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".location.LocationLayerActivity"
|
||||
android:description="@string/demo_description_show_location"
|
||||
android:label="@string/demo_label_show_location">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_location"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".location.LocationPointActivity"
|
||||
android:description="@string/demo_description_change_location_style"
|
||||
android:label="@string/demo_label_change_location_style">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_location"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".basic.IndoorMapActivity"
|
||||
android:description="@string/demo_description_indoor_map"
|
||||
android:label="@string/demo_label_indoor_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_basic"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".basic.OverseaMapActivity"
|
||||
android:description="@string/demo_description_oversea"
|
||||
android:label="@string/demo_label_oversea">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_basic"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".basic.MapStyleDemoActivity"
|
||||
android:description="@string/demo_description_style"
|
||||
android:label="@string/demo_label_style">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_basic"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".basic.UiSettingsActivity"
|
||||
android:description="@string/demo_description_ui"
|
||||
android:label="@string/demo_label_ui">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".gesture.GestureSettingsActivity"
|
||||
android:description="@string/demo_description_gesture"
|
||||
android:label="@string/demo_label_gesture">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".transaction.ZoomMapActivity"
|
||||
android:description="@string/demo_description_modify_zoom"
|
||||
android:label="@string/demo_label_modify_zoom">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".camera.MapCameraCenterActivity"
|
||||
android:description="@string/demo_description_modify_map_center"
|
||||
android:label="@string/demo_label_modify_map_center">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".camera.MapBoundActivity"
|
||||
android:description="@string/demo_description_map_bound"
|
||||
android:label="@string/demo_label_map_bound">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".poi.PoiClickActivity"
|
||||
android:description="@string/demo_description_click_poi"
|
||||
android:label="@string/demo_label_click_poi">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".transaction.AnimateCameraActivity"
|
||||
android:description="@string/demo_description_animate_camera"
|
||||
android:label="@string/demo_label_animate_camera">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".camera.MapAnchorZoomActivity"
|
||||
android:description="@string/demo_description_map_camera_anchor"
|
||||
android:label="@string/demo_label_map_camera_anchor">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_interactive"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".transaction.ScollMapActivity"
|
||||
android:description="@string/demo_description_camera_translation"
|
||||
android:label="@string/demo_label_camera_translation">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_transformation"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".transaction.RotateMapActivity"
|
||||
android:description="@string/demo_description_camera_rotation"
|
||||
android:label="@string/demo_label_camera_rotation">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_transformation"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".transaction.ZoomCalulateActivity"
|
||||
android:description="@string/demo_description_camera_include_points"
|
||||
android:label="@string/demo_label_camera_include_points">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_transformation"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".transaction.MoveCameraActivity"
|
||||
android:description="@string/demo_description_camera_change_listener"
|
||||
android:label="@string/demo_label_camera_change_listener">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_transformation"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".gesture.MapListenActivity"
|
||||
android:description="@string/demo_description_map_click_listener"
|
||||
android:label="@string/demo_label_map_click_listener">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_transformation"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".gesture.MapLongClickActivity"
|
||||
android:description="@string/demo_description_map_long_click_listener"
|
||||
android:label="@string/demo_label_map_long_click_listener">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_transformation"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.SimpleMarkerActivity"
|
||||
android:description="@string/demo_description_simple_marker"
|
||||
android:label="@string/demo_label_simple_marker">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.MarkerCollisions"
|
||||
android:description="@string/demo_description_collisions_marker"
|
||||
android:label="@string/demo_label_collisions_marker">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.MarkerOptionsActivity"
|
||||
android:description="@string/demo_description_marker_options"
|
||||
android:label="@string/demo_label_marker_options">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.MarkerClickActivity"
|
||||
android:description="@string/demo_description_marker_click_listener"
|
||||
android:label="@string/demo_label_marker_click_listener">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.MarkerDragActivity"
|
||||
android:description="@string/demo_description_marker_drag_listener"
|
||||
android:label="@string/demo_label_marker_drag_listener">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.MarkerInfoWindowActivity"
|
||||
android:description="@string/demo_description_infowindow_click_listener"
|
||||
android:label="@string/demo_label_infowindow_click_listener">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.MarkerClusterActivity"
|
||||
android:description="@string/demo_description_marker_cluster"
|
||||
android:label="@string/demo_label_marker_cluster">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.MarkerAnimation"
|
||||
android:description="@string/demo_description_marker_animation"
|
||||
android:label="@string/demo_label_marker_animation">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_marker"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.DrawHeatOverlayActivity"
|
||||
android:description="@string/demo_description_heat_map"
|
||||
android:label="@string/demo_label_heat_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".polygon.TileOverlayActivity"
|
||||
android:description="@string/demo_description_tileOverlay_map"
|
||||
android:label="@string/demo_label_tileOverlay_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".polyline.DrawLineActivity"
|
||||
android:description="@string/demo_description_polyline"
|
||||
android:label="@string/demo_label_polyline">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".polyline.MutablePolylineActivity"
|
||||
android:description="@string/demo_description_mutable_polyline"
|
||||
android:label="@string/demo_label_mutable_polyline">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".polygon.DrawPolygonActivity"
|
||||
android:description="@string/demo_description_polygon"
|
||||
android:label="@string/demo_label_polygon">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".circle.DrawCircleActivity"
|
||||
android:description="@string/demo_description_circle"
|
||||
android:label="@string/demo_label_circle">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".circle.ArcActivity"
|
||||
android:description="@string/demo_description_arc"
|
||||
android:label="@string/demo_label_arc">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".search.WalkingRouteActivity"
|
||||
android:description="@string/demo_description_walking_plan"
|
||||
android:label="@string/demo_label_walking_plan">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_route_plan"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".search.DrivingRouteActivity"
|
||||
android:description="@string/demo_description_driving_plan"
|
||||
android:label="@string/demo_label_driving_plan">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_route_plan"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".search.TransitRouteActivity"
|
||||
android:description="@string/demo_description_transit_plan"
|
||||
android:label="@string/demo_label_transit_plan">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_route_plan"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".search.TruckingRouteActivity"
|
||||
android:description="@string/demo_description_truking_plan"
|
||||
android:label="@string/demo_label_truking_plan">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_route_plan"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".search.SearchBasicActivity"
|
||||
android:description="@string/demo_description_basic_search"
|
||||
android:label="@string/demo_label_basic_search">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_search"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".search.GeoCoderActivity"
|
||||
android:description="@string/demo_description_geocoder"
|
||||
android:label="@string/demo_label_geocoder">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_search"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".search.DistrictActivity"
|
||||
android:description="@string/demo_description_district"
|
||||
android:label="@string/demo_label_district">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_search"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".polyline.LineTextActivity"
|
||||
android:description="@string/demo_description_line_text"
|
||||
android:label="@string/demo_label_line_text">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_special"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".utils.BitMapActivity"
|
||||
android:description="@string/demo_description_bitmap"
|
||||
android:enabled="false"
|
||||
android:label="@string/demo_label_bitmap">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_tools"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".utils.SnapshotActivity"
|
||||
android:description="@string/demo_description_map_snapshot"
|
||||
android:label="@string/demo_label_map_snapshot">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_tools"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".utils.CoordinateActivity"
|
||||
android:description="@string/demo_description_projection"
|
||||
android:label="@string/demo_label_projection">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_tools"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity android:name=".basic.SupportMapFragmentActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".marker.CustomRenderActivity"
|
||||
android:description="@string/demo_description_opengl"
|
||||
android:label="@string/demo_label_opengl">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.GroundOverlayActivity"
|
||||
android:description="@string/demo_description_overlay"
|
||||
android:label="@string/demo_label_ground_overlay">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".marker.AoiLayerActivity"
|
||||
android:description="@string/demo_description_aoi"
|
||||
android:label="@string/demo_label_aoi">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.VectorHeatMapActivity"
|
||||
android:description="@string/demo_description_vectorheatmap"
|
||||
android:label="@string/demo_label_vectorheatmap">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.ArcLineLayerActivity"
|
||||
android:description="@string/demo_description_arcline"
|
||||
android:label="@string/demo_label_arcline_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.HeatMapVectorOverlayActivity"
|
||||
android:description="@string/demo_description_3dheatmap"
|
||||
android:label="@string/demo_label_3d_heat_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.AggregationOverlayActivity"
|
||||
android:description="@string/demo_description_AggregationOverlay"
|
||||
android:label="@string/demo_label_3d_aggregationOverlay_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.ScatterPlotOverlayActivity"
|
||||
android:description="@string/demo_description_ScatterPlotOverlay"
|
||||
android:label="@string/demo_label_3d_scatterplotoverlay_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.TrailOverlayActivity"
|
||||
android:description="@string/demo_description_TrailOverlay"
|
||||
android:label="@string/demo_label_3d_railoverltay_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".heatoverlay.GLModelActivity"
|
||||
android:description="@string/demo_description_glModel"
|
||||
android:label="@string/demo_label_glModel">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".basic.RecyclerListActivity"
|
||||
android:description="@string/demo_description_recycler_map"
|
||||
android:label="@string/demo_label_recycler_map">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_basic"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".smooth.SmoothMoveActivity"
|
||||
android:description="@string/demo_description_smooth_move"
|
||||
android:label="@string/demo_label_smooth_move">
|
||||
|
||||
<meta-data
|
||||
android:name="@string/demo_type"
|
||||
android:value="@string/demo_type_draw"/>
|
||||
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="TencentMapSDK"
|
||||
android:value="SCYBZ-EC5Y4-XMHUI-FX2PU-ZYMMS-IBB7P"/>
|
||||
|
||||
<activity android:name="cc.winboll.studio.positions.activities.TestMapViewActivity"/>
|
||||
|
||||
<activity android:name="cc.winboll.studio.positions.activities.JointPositioningActivity"/>
|
||||
|
||||
<service android:name="cc.winboll.studio.positions.services.GPSService"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -1,38 +0,0 @@
|
||||
package cc.winboll.studio.positions;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/08 15:10:51
|
||||
* @Describe 全局应用类
|
||||
*/
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import java.io.File;
|
||||
import cc.winboll.studio.libappbase.winboll.WinBollActivityManager;
|
||||
|
||||
public class App extends GlobalApplication {
|
||||
|
||||
public static final String TAG = "App";
|
||||
public static String szDataFolder = "";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
// 必须在调用基类前设置应用调试标志,
|
||||
// 这样可以预先设置日志与数据的存储根目录。
|
||||
super.onCreate();
|
||||
// 设置 WinBoll 应用 UI 类型
|
||||
getWinBollActivityManager().setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Aplication);
|
||||
|
||||
LogUtils.d(TAG, "onCreate");
|
||||
if (BuildConfig.DEBUG) {
|
||||
szDataFolder = getExternalFilesDir(TAG).toString();
|
||||
} else {
|
||||
szDataFolder = getFilesDir().toString() + File.separator + TAG;
|
||||
}
|
||||
File fDataFolder = new File(szDataFolder);
|
||||
if (!fDataFolder.exists()) {
|
||||
fDataFolder.mkdirs();
|
||||
}
|
||||
LogUtils.d(TAG, String.format("Data path is : %s", szDataFolder));
|
||||
}
|
||||
}
|
@ -1,374 +0,0 @@
|
||||
package cc.winboll.studio.positions;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.LogView;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.positions.activities.AbsActivity;
|
||||
import cc.winboll.studio.positions.activities.JointPositioningActivity;
|
||||
import cc.winboll.studio.positions.activities.SettingsActivity;
|
||||
import cc.winboll.studio.positions.fragments.LogFragment;
|
||||
import cc.winboll.studio.positions.fragments.PositionsFragment;
|
||||
import cc.winboll.studio.positions.fragments.TXMSFragment;
|
||||
import cc.winboll.studio.positions.fragments.TasksFragment;
|
||||
import cc.winboll.studio.positions.models.MainServiceBean;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import cc.winboll.studio.positions.listeners.OnTXRTLocationListener;
|
||||
import android.location.Location;
|
||||
|
||||
final public class MainActivity extends AbsActivity implements IWinBollActivity, ViewPager.OnPageChangeListener, View.OnClickListener {
|
||||
|
||||
public static final String TAG = "MainActivity";
|
||||
|
||||
public static final int REQUEST_HOME_ACTIVITY = 0;
|
||||
public static final int REQUEST_ABOUT_ACTIVITY = 1;
|
||||
|
||||
public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoll.ACTION_SOS";
|
||||
|
||||
static MainActivity _MainActivity;
|
||||
|
||||
// 创建Fragment列表和标题列表
|
||||
List<Fragment> fragmentList = new ArrayList<>();
|
||||
List<String> tabTitleList = new ArrayList<>();
|
||||
|
||||
TXMSFragment mTXMSFragment;
|
||||
PositionsFragment mPositionsFragment;
|
||||
TasksFragment mTasksFragment;
|
||||
LogFragment mLogFragment;
|
||||
LogView mLogView;
|
||||
Toolbar mToolbar;
|
||||
CheckBox cbMainService;
|
||||
MainServiceBean mMainServiceBean;
|
||||
private TabLayout tabLayout;
|
||||
private ViewPager viewPager;
|
||||
private List<View> views; //用来存放放进ViewPager里面的布局
|
||||
//实例化存储imageView(导航原点)的集合
|
||||
ImageView[] imageViews;
|
||||
//MyPagerAdapter adapter;//适配器
|
||||
MyPagerAdapter pagerAdapter;
|
||||
LinearLayout linearLayout;//下标所在在LinearLayout布局里
|
||||
int currentPoint = 0;//当前被选中中页面的下标
|
||||
|
||||
private static final int DIALER_REQUEST_CODE = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
_MainActivity = this;
|
||||
|
||||
// 初始化工具栏
|
||||
// mToolbar = findViewById(R.id.toolbar);
|
||||
// setActionBar(mToolbar);
|
||||
//// if (isEnableDisplayHomeAsUp()) {
|
||||
//// // 显示后退按钮
|
||||
//// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
//// }
|
||||
// getActionBar().setTitle("");
|
||||
|
||||
// 初始化地图视图
|
||||
// 创建Fragment实例
|
||||
mTXMSFragment = new TXMSFragment();
|
||||
// 获取FragmentTransaction
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
// 将Fragment添加到FrameLayout容器中
|
||||
transaction.add(R.id.frameLayout, mTXMSFragment);
|
||||
transaction.commit();
|
||||
|
||||
tabLayout = findViewById(R.id.tabLayout);
|
||||
viewPager = findViewById(R.id.viewPager);
|
||||
|
||||
mPositionsFragment = new PositionsFragment();
|
||||
fragmentList.add(mPositionsFragment);
|
||||
tabTitleList.add("位置");
|
||||
|
||||
mTasksFragment = new TasksFragment();
|
||||
fragmentList.add(mTasksFragment);
|
||||
tabTitleList.add("任务");
|
||||
|
||||
|
||||
mLogFragment = new LogFragment();
|
||||
fragmentList.add(mLogFragment);
|
||||
tabTitleList.add("日志");
|
||||
|
||||
|
||||
|
||||
// 设置ViewPager的适配器
|
||||
MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());
|
||||
viewPager.setAdapter(adapter);
|
||||
|
||||
// 关联TabLayout和ViewPager
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
mTXMSFragment.setOnTXRTLocationListener(new OnTXRTLocationListener(){
|
||||
@Override
|
||||
public void onTXRTLocation(Location location) {
|
||||
mPositionsFragment.showLocationTX(location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startTXRTLocation(){
|
||||
mTXMSFragment.startRTLocation();
|
||||
}
|
||||
|
||||
// ViewPager的适配器
|
||||
public class MyPagerAdapter extends FragmentStatePagerAdapter {
|
||||
private static final int PAGE_COUNT = 3;
|
||||
|
||||
public MyPagerAdapter(FragmentManager fm) {
|
||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// 根据position返回不同的Fragment
|
||||
return fragmentList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// 返回页面总数
|
||||
return PAGE_COUNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return tabTitleList.get(position);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化view,即显示的图片
|
||||
// void initViewPager() {
|
||||
// pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
|
||||
// mViewPager.setAdapter(pagerAdapter);
|
||||
// //adapter = new MyPagerAdapter(views);
|
||||
// //viewPager = findViewById(R.id.activitymainViewPager1);
|
||||
// //viewPager.setAdapter(adapter);
|
||||
// //linearLayout = findViewById(R.id.activitymainLinearLayout1);
|
||||
// //initPoint();//初始化页面下方的点
|
||||
// mViewPager.setOnPageChangeListener(this);
|
||||
// }
|
||||
|
||||
//初始化所要显示的布局
|
||||
// void initLayoutData() {
|
||||
// LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||
// View view1 = inflater.inflate(R.layout.fragment_gms, mViewPager, false);
|
||||
// View view2 = inflater.inflate(R.layout.fragment_contacts, mViewPager, false);
|
||||
// View view3 = inflater.inflate(R.layout.fragment_log, mViewPager, false);
|
||||
//
|
||||
// views = new ArrayList<>();
|
||||
// views.add(view1);
|
||||
// views.add(view2);
|
||||
// views.add(view3);
|
||||
// }
|
||||
|
||||
// void initPoint() {
|
||||
// imageViews = new ImageView[5];//实例化5个图片
|
||||
// for (int i = 0; i < linearLayout.getChildCount(); i++) {
|
||||
// imageViews[i] = (ImageView) linearLayout.getChildAt(i);
|
||||
// imageViews[i].setImageResource(R.drawable.ic_launcher);
|
||||
// imageViews[i].setOnClickListener(this);//点击导航点,即可跳转
|
||||
// imageViews[i].setTag(i);//重复利用实例化的对象
|
||||
// }
|
||||
// currentPoint = 0;//默认第一个坐标
|
||||
// imageViews[currentPoint].setImageResource(R.drawable.ic_launcher);
|
||||
// }
|
||||
|
||||
//OnPageChangeListener接口要实现的三个方法
|
||||
/* onPageScrollStateChanged(int state)
|
||||
此方法是在状态改变的时候调用,其中state这个参数有三种状态:
|
||||
SCROLL_STATE_DRAGGING(1)表示用户手指“按在屏幕上并且开始拖动”的状态
|
||||
(手指按下但是还没有拖动的时候还不是这个状态,只有按下并且手指开始拖动后log才打出。)
|
||||
SCROLL_STATE_IDLE(0)滑动动画做完的状态。
|
||||
SCROLL_STATE_SETTLING(2)在“手指离开屏幕”的状态。*/
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
/* onPageScrolled(int position, float positionOffset, int positionOffsetPixels)
|
||||
当页面在滑动的时候会调用此方法,在滑动被停止之前,此方法回一直得到调用。其中三个参数的含义分别为:
|
||||
|
||||
position :当前页面,即你点击滑动的页面(从A滑B,则是A页面的position。
|
||||
positionOffset:当前页面偏移的百分比
|
||||
positionOffsetPixels:当前页面偏移的像素位置*/
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
/* onPageSelected(int position)
|
||||
此方法是页面滑动完后得到调用,position是你当前选中的页面的Position(位置编号)
|
||||
(从A滑动到B,就是B的position)*/
|
||||
public void onPageSelected(int position) {
|
||||
|
||||
// ImageView preView = imageViews[currentPoint];
|
||||
// preView.setImageResource(R.drawable.ic_launcher);
|
||||
// ImageView currView = imageViews[position];
|
||||
// currView.setImageResource(R.drawable.ic_launcher);
|
||||
// currentPoint = position;
|
||||
}
|
||||
|
||||
//小圆点点击事件
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
//通过getTag(),可以判断是哪个控件
|
||||
// int i = (Integer) v.getTag();
|
||||
// viewPager.setCurrentItem(i);//直接跳转到某一个页面的情况
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
//setSubTitle("");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
LogUtils.d(TAG, "onDestroy() SOS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Activity getActivity() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//exit();
|
||||
}
|
||||
|
||||
// void exit() {
|
||||
// YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
|
||||
//
|
||||
// @Override
|
||||
// public void onYes() {
|
||||
// WinBollActivityManager.getInstance(getApplicationContext()).finishAll();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNo() {
|
||||
// }
|
||||
// };
|
||||
// YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.item_settings) {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
||||
} else if (item.getItemId() == R.id.item_joint_positioning) {
|
||||
Intent intent = new Intent(this, JointPositioningActivity.class);
|
||||
startActivity(intent);
|
||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
||||
} else if (item.getItemId() == R.id.item_demomain) {
|
||||
// Intent intent = new Intent(this, com.tencent.map.vector.demo.DemoMainActivity.class);
|
||||
// startActivity(intent);
|
||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
||||
} else if (item.getItemId() == R.id.item_positionnow) {
|
||||
mTXMSFragment.sendRealTimePositioningMessage();
|
||||
} else if (item.getItemId() == R.id.item_addnewposition) {
|
||||
ToastUtils.show("item_addnewpositon");
|
||||
}
|
||||
// } else
|
||||
// if (item.getItemId() == R.id.item_exit) {
|
||||
// exit();
|
||||
// return true;
|
||||
// }
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
/**
|
||||
* Android M 及以上检查是否是系统默认电话应用
|
||||
*/
|
||||
public boolean isDefaultPhoneCallApp() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
TelecomManager manger = (TelecomManager) getSystemService(TELECOM_SERVICE);
|
||||
if (manger != null && manger.getDefaultDialerPackage() != null) {
|
||||
return manger.getDefaultDialerPackage().equals(getPackageName());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isServiceRunning(Class<?> serviceClass) {
|
||||
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (manager == null) return false;
|
||||
|
||||
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(
|
||||
Integer.MAX_VALUE)) {
|
||||
if (serviceClass.getName().equals(service.service.getClassName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// switch (resultCode) {
|
||||
// case REQUEST_HOME_ACTIVITY : {
|
||||
// LogUtils.d(TAG, "REQUEST_HOME_ACTIVITY");
|
||||
// break;
|
||||
// }
|
||||
// case REQUEST_ABOUT_ACTIVITY : {
|
||||
// LogUtils.d(TAG, "REQUEST_ABOUT_ACTIVITY");
|
||||
// break;
|
||||
// }
|
||||
// default : {
|
||||
// super.onActivityResult(requestCode, resultCode, data);
|
||||
// }
|
||||
// }
|
||||
if (requestCode == DIALER_REQUEST_CODE) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
Toast.makeText(MainActivity.this, getString(R.string.app_name) + " 已成为默认电话应用",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,471 +0,0 @@
|
||||
package cc.winboll.studio.positions;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/24 11:05:49
|
||||
*/
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import cc.winboll.studio.libappbase.LogView;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.positions.activities.SettingsActivity;
|
||||
import cc.winboll.studio.positions.activities.TestMapViewActivity;
|
||||
import cc.winboll.studio.positions.models.PostionModel;
|
||||
import cc.winboll.studio.positions.utils.LocationFileStorage;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.map.geolocation.TencentLocationListener;
|
||||
import com.tencent.map.geolocation.TencentLocationManager;
|
||||
import com.tencent.map.geolocation.TencentLocationRequest;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.LocationSource;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||
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.MyLocationStyle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
//import pub.devrel.easypermissions.EasyPermissions;
|
||||
|
||||
public class MainSimpleActivity extends AppCompatActivity implements /*EasyPermissions.PermissionCallbacks,*/LocationSource, TencentLocationListener {
|
||||
|
||||
public static final String TAG ="MainSimpleActivity";
|
||||
|
||||
private static final int PERMISSION_REQUEST_CODE = 1;
|
||||
|
||||
Toolbar mToolbar;
|
||||
private TextureMapView mapView;
|
||||
protected TencentMap tencentMap;
|
||||
TextView mtvInfo;
|
||||
private LocationSource.OnLocationChangedListener locationChangedListener;
|
||||
|
||||
private TencentLocationManager locationManager;
|
||||
private TencentLocationRequest locationRequest;
|
||||
private MyLocationStyle locationStyle;
|
||||
ArrayList<PostionModel> locationJsonList;
|
||||
LogView mLogView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main_simple);
|
||||
|
||||
locationJsonList = new ArrayList<PostionModel>();
|
||||
|
||||
// 初始化工具栏
|
||||
mToolbar = findViewById(R.id.activitymainToolbar1);
|
||||
setSupportActionBar(mToolbar);
|
||||
getSupportActionBar().setSubtitle(TAG);
|
||||
|
||||
mLogView = findViewById(R.id.logview);
|
||||
mLogView.start();
|
||||
|
||||
TencentMapInitializer.setAgreePrivacy(true);
|
||||
//TencentMapInitializer.setAgreePrivacy(this, true);
|
||||
//TencentMapInitializer.start(this);
|
||||
TencentLocationManager.setUserAgreePrivacy(true);
|
||||
|
||||
|
||||
mapView = findViewById(R.id.mapview);
|
||||
mapView.setOpaque(false);
|
||||
//创建tencentMap地图对象,可以完成对地图的几乎所有操作
|
||||
tencentMap = mapView.getMap();
|
||||
|
||||
FloatingActionButton fab = findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, "点击了悬浮按钮", Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
mtvInfo = findViewById(R.id.tv_info);
|
||||
|
||||
checkLocationPermission();
|
||||
|
||||
//设置显示定位的图标
|
||||
TencentLocationManager.setUserAgreePrivacy(true);
|
||||
//建立定位
|
||||
//initLocation();
|
||||
//对地图操作类进行操作
|
||||
// CameraUpdate cameraSigma =
|
||||
// CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
// new LatLng(22.984066, 116.307548),
|
||||
// 15f,
|
||||
// 0f,
|
||||
// 0f));
|
||||
// //移动地图
|
||||
// tencentMap.moveCamera(cameraSigma);
|
||||
|
||||
// // 设置地图点击监听
|
||||
// tencentMap.setOnMapClickListener(new TencentMap.OnMapClickListener(){
|
||||
//
|
||||
// @Override
|
||||
// public void onMapClick(com.tencent.tencentmap.mapsdk.maps.model.LatLng latLng) {
|
||||
// //创建Marker对象之前,设置属性
|
||||
// //LatLng position = new LatLng(40.011313,116.391907);
|
||||
// BitmapDescriptor custom = BitmapDescriptorFactory.fromResource(R.drawable.marker);
|
||||
// Location location = createLocationFromLatLng(latLng);
|
||||
// addLocationJson(location);
|
||||
// Marker mCustomMarker = tencentMap.addMarker(new MarkerOptions(latLng));
|
||||
//
|
||||
// //创建Marker对象之后,修改属性
|
||||
//// Animation animation = new AlphaAnimation(0.7f, 0f);
|
||||
//// animation.setDuration(2000);
|
||||
//// mCustomMarker.setAnimation(animation);
|
||||
//// mCustomMarker.startAnimation();
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
|
||||
void loadLocations() {
|
||||
// 存储位置数据
|
||||
// Location location = new Location("gps");
|
||||
// location.setLatitude(22.984066);
|
||||
// location.setLongitude(116.307548);
|
||||
// location.setTime(System.currentTimeMillis());
|
||||
//
|
||||
// // 方式1:保存到文件
|
||||
// List<Location> locations = new ArrayList<>();
|
||||
// locations.add(location);
|
||||
// LocationFileStorage.saveToFile(this, locations);
|
||||
|
||||
// 读取数据
|
||||
locationJsonList = LocationFileStorage.loadFromFile(this);
|
||||
|
||||
// for (PostionModel lj : locationJsonList) {
|
||||
// tencentMap.addMarker(new MarkerOptions(toTencentLatLng(lj.toLocation())));
|
||||
// //LogUtils.d("Location", "Lat: " + loc.getLatitude() + ", Lng: " + loc.getLongitude());
|
||||
// }
|
||||
}
|
||||
|
||||
void addLocationJson(Location location) {
|
||||
// 存储位置数据
|
||||
// Location location = new Location("gps");
|
||||
// location.setLatitude(22.984066);
|
||||
// location.setLongitude(116.307548);
|
||||
// location.setTime(System.currentTimeMillis());
|
||||
|
||||
// 方式1:保存到文件
|
||||
//List<Location> locations = new ArrayList<>();
|
||||
locationJsonList.add(new PostionModel(location));
|
||||
LocationFileStorage.saveToFile(this, locationJsonList);
|
||||
|
||||
// 读取数据
|
||||
// List<Location> loaded = LocationFileStorage.loadFromFile(this);
|
||||
// for (Location loc : loaded) {
|
||||
// tencentMap.addMarker(new MarkerOptions(toTencentLatLng(loc)));
|
||||
// //LogUtils.d("Location", "Lat: " + loc.getLatitude() + ", Lng: " + loc.getLongitude());
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 创建Location对象方法
|
||||
private Location createLocationFromLatLng(LatLng latLng) {
|
||||
Location location = new Location("tencent_map_manual");
|
||||
|
||||
// 设置基础坐标
|
||||
location.setLatitude(latLng.getLatitude());
|
||||
location.setLongitude(latLng.getLongitude());
|
||||
|
||||
// 设置必要元数据
|
||||
location.setTime(System.currentTimeMillis());
|
||||
location.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
|
||||
location.setAccuracy(5.0f); // 手动点击精度设为5米
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
public LatLng toTencentLatLng(Location location) {
|
||||
return new LatLng(
|
||||
location.getLatitude(),
|
||||
location.getLongitude()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 添加标记方法
|
||||
// private void addMarker(LatLng latLng) {
|
||||
// tencentMap.clearAllOverlays();
|
||||
// MarkerOptions options = new MarkerOptions(latLng)
|
||||
// .icon(BitmapDescriptorFactory.defaultMarker())
|
||||
// .title("点击保存");
|
||||
// tencentMap.addMarker(options);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
// LatLng center = new LatLng(39.904556, 116.427242);
|
||||
// tencentMap.moveCamera(
|
||||
// CameraUpdateFactory.newLatLngZoom(center, 13f) // 注意 13 → 13f
|
||||
// );
|
||||
loadLocations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.item_settings) {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
||||
} else if (item.getItemId() == R.id.item_demomain) {
|
||||
// Intent intent = new Intent(this, com.tencent.map.vector.demo.DemoMainActivity.class);
|
||||
// startActivity(intent);
|
||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
||||
} else if (item.getItemId() == R.id.item_testmapview) {
|
||||
Intent intent = new Intent(this, TestMapViewActivity.class);
|
||||
startActivity(intent);
|
||||
//WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class);
|
||||
}
|
||||
// } else
|
||||
// if (item.getItemId() == R.id.item_exit) {
|
||||
// exit();
|
||||
// return true;
|
||||
// }
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* mapview的生命周期管理
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
mapView.onRestart();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle() {
|
||||
locationStyle = new MyLocationStyle();
|
||||
//创建图标
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.marker));
|
||||
locationStyle.icon(bitmapDescriptor);
|
||||
//设置定位圆形区域的边框宽度
|
||||
locationStyle.strokeWidth(3);
|
||||
//设置圆区域的颜色
|
||||
locationStyle.fillColor(R.color.style);
|
||||
|
||||
tencentMap.setMyLocationStyle(locationStyle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Bitmap getBitMap(int resourceId) {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
int newWidth = 55;
|
||||
int newHeight = 55;
|
||||
float widthScale = ((float)newWidth) / width;
|
||||
float heightScale = ((float)newHeight) / height;
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(widthScale, heightScale);
|
||||
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 定位的一些初始化设置
|
||||
*/
|
||||
private void initLocation() {
|
||||
//用于访问腾讯定位服务的类, 周期性向客户端提供位置更新
|
||||
locationManager = TencentLocationManager.getInstance(this);
|
||||
//设置坐标系
|
||||
locationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
|
||||
//创建定位请求
|
||||
locationRequest = TencentLocationRequest.create();
|
||||
//设置定位周期(位置监听器回调周期)为3s
|
||||
locationRequest.setInterval(3000);
|
||||
|
||||
//地图上设置定位数据源
|
||||
tencentMap.setLocationSource(this);
|
||||
//设置当前位置可见
|
||||
tencentMap.setMyLocationEnabled(true);
|
||||
//设置定位图标样式
|
||||
setLocMarkerStyle();
|
||||
// locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
|
||||
tencentMap.setMyLocationStyle(locationStyle);
|
||||
}
|
||||
/**
|
||||
* 实现位置监听
|
||||
* @param tencentLocation
|
||||
* @param i
|
||||
* @param s
|
||||
*/
|
||||
@Override
|
||||
public void onLocationChanged(TencentLocation tencentLocation, int i, String s) {
|
||||
|
||||
if (i == TencentLocation.ERROR_OK && locationChangedListener != null) {
|
||||
final Location location = new Location(tencentLocation.getProvider());
|
||||
//设置经纬度以及精度
|
||||
location.setLatitude(tencentLocation.getLatitude());
|
||||
location.setLongitude(tencentLocation.getLongitude());
|
||||
location.setAccuracy(tencentLocation.getAccuracy());
|
||||
locationChangedListener.onLocationChanged(location);
|
||||
|
||||
//显示回调的实时位置信息
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Rules.getEffectInfo(location);
|
||||
// double distance = DistanceUtils.getDistance(
|
||||
// locationA.getLatitude(),
|
||||
// locationA.getLongitude(),
|
||||
// locationB.getLatitude(),
|
||||
// locationB.getLongitude()
|
||||
// );
|
||||
mtvInfo.setText(String.format("\n%f %f", location.getLatitude(), location.getLongitude()));
|
||||
//打印tencentLocation的json字符串
|
||||
// Toast.makeText(getApplicationContext(), new Gson().toJson(location), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusUpdate(String s, int i, String s1) {
|
||||
//GPS, WiFi, Radio 等状态发生变化
|
||||
Log.v("State changed", s + "===" + s1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void activate(OnLocationChangedListener onLocationChangedListener) {
|
||||
locationChangedListener = onLocationChangedListener;
|
||||
|
||||
int err = locationManager.requestLocationUpdates(locationRequest, this, Looper.myLooper());
|
||||
switch (err) {
|
||||
case 1:
|
||||
Toast.makeText(this, "设备缺少使用腾讯定位服务需要的基本条件", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 2:
|
||||
Toast.makeText(this, "manifest 中配置的 key 不正确", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 3:
|
||||
Toast.makeText(this, "自动加载libtencentloc.so失败", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
locationManager.removeUpdates(this);
|
||||
locationManager = null;
|
||||
locationRequest = null;
|
||||
locationChangedListener = null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {
|
||||
// Log.e("location quest: ", "success");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
|
||||
// Log.e("location quest: ", "failed");
|
||||
// }
|
||||
|
||||
private void checkLocationPermission() {
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
|
||||
PERMISSION_REQUEST_CODE);
|
||||
} else {
|
||||
// 权限已授予,可进行定位操作
|
||||
//startLocationUpdates();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == PERMISSION_REQUEST_CODE) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
//startLocationUpdates();
|
||||
} else {
|
||||
// 用户拒绝了权限请求
|
||||
Toast.makeText(this, "请授予定位权限", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package cc.winboll.studio.positions.activities;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import cc.winboll.studio.positions.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbsActivity extends AppCompatActivity {
|
||||
|
||||
private static final int PERMISSIONS_REQUEST_CODE = 0x99FF;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
requestPermission();
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
private void requestPermission() {
|
||||
String[] permissions = onRequestPermissions();
|
||||
if (permissions != null) {
|
||||
List<String> deniedPermissions = new ArrayList<>();
|
||||
for (String permission : permissions) {
|
||||
if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
deniedPermissions.add(permission);
|
||||
}
|
||||
}
|
||||
|
||||
if (deniedPermissions.size() > 0) {
|
||||
requestPermissions(deniedPermissions.toArray(new String[0]), PERMISSIONS_REQUEST_CODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String[] onRequestPermissions() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package cc.winboll.studio.positions.activities;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/22 02:01:44
|
||||
*/
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.positions.views.GridMapView;
|
||||
|
||||
public class GridMapActivity extends AppCompatActivity {
|
||||
|
||||
GridMapView gridMap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_gridmap);
|
||||
|
||||
// 初始化视图
|
||||
GridMapView mapView = (GridMapView) findViewById(R.id.map_view);
|
||||
|
||||
// 设置网格参数
|
||||
mapView.setGridParameters(10000f, 10000f, 10f);
|
||||
|
||||
// 初始化显示区域(中心点400,300,显示范围2000x200)
|
||||
mapView.initViewport(5000f, 5000f, 1000f, 1000f);
|
||||
|
||||
// 绘制图形
|
||||
mapView.drawPoint(5000f, 5000f, Color.RED, 8f);
|
||||
mapView.drawCircle(5000f, 5000f, 50f, Color.BLUE, 8f);
|
||||
mapView.drawLine(4975f, 4975f, 5025f, 5025f, Color.GREEN, 2f);
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
package cc.winboll.studio.positions.activities;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/10 19:56:49
|
||||
* @Describe Main2Activity
|
||||
*/
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import cc.winboll.studio.positions.R;
|
||||
|
||||
public class JointPositioningActivity extends AppCompatActivity {
|
||||
|
||||
public static final String TAG = "JointPositioningActivity";
|
||||
|
||||
|
||||
private LocationManager locationManager;
|
||||
private TextView locationTextView;
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main2);
|
||||
|
||||
locationTextView = findViewById(R.id.location_text_view);
|
||||
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
|
||||
// 检查权限
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
|
||||
1);
|
||||
return;
|
||||
}
|
||||
|
||||
// 请求GPS定位
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsLocationListener);
|
||||
|
||||
// 请求基站(网络)定位
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, networkLocationListener);
|
||||
}
|
||||
|
||||
private LocationListener gpsLocationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
// 处理GPS定位结果
|
||||
updateLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {}
|
||||
};
|
||||
|
||||
private LocationListener networkLocationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
// 处理基站(网络)定位结果
|
||||
updateLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {}
|
||||
};
|
||||
|
||||
private void updateLocation(Location location) {
|
||||
if (location != null) {
|
||||
double latitude = location.getLatitude();
|
||||
double longitude = location.getLongitude();
|
||||
|
||||
// 简单的融合示例:这里只是显示最后获取到的位置,实际应用中需要更复杂的融合算法
|
||||
locationTextView.setText("Latitude: " + latitude + ", Longitude: " + longitude);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == 1) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// 权限已授予,可以继续获取位置信息
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsLocationListener);
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, networkLocationListener);
|
||||
} else {
|
||||
Toast.makeText(this, "权限被拒绝,无法获取位置信息", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (locationManager != null) {
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
locationManager.removeUpdates(gpsLocationListener);
|
||||
locationManager.removeUpdates(networkLocationListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,116 +0,0 @@
|
||||
package cc.winboll.studio.positions.activities;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/21 05:37:42
|
||||
*/
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Toolbar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity implements IWinBollActivity {
|
||||
|
||||
public static final String TAG = "SettingsActivity";
|
||||
|
||||
Toolbar mToolbar;
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Activity getActivity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
// 初始化工具栏
|
||||
mToolbar = findViewById(R.id.activitymainToolbar1);
|
||||
setActionBar(mToolbar);
|
||||
// 显示后退按钮
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getActionBar().setSubtitle(getTag());
|
||||
|
||||
}
|
||||
|
||||
public void onDefaultPhone(View view) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void onCanDrawOverlays(View view) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
&& !Settings.canDrawOverlays(this)) {
|
||||
// 请求 悬浮框 权限
|
||||
askForDrawOverlay();
|
||||
} else {
|
||||
ToastUtils.show("悬浮窗已开启");
|
||||
}
|
||||
}
|
||||
|
||||
private void askForDrawOverlay() {
|
||||
AlertDialog alertDialog = new AlertDialog.Builder(this)
|
||||
.setTitle("允许显示悬浮框")
|
||||
.setMessage("为了使电话监听服务正常工作,请允许这项权限")
|
||||
.setPositiveButton("去设置", new DialogInterface.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
openDrawOverlaySettings();
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("稍后再说", new DialogInterface.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
|
||||
//noinspection ConstantConditions
|
||||
alertDialog.getWindow().setFlags(
|
||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
|
||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转悬浮窗管理设置界面
|
||||
*/
|
||||
private void openDrawOverlaySettings() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// Android M 以上引导用户去系统设置中打开允许悬浮窗
|
||||
// 使用反射是为了用尽可能少的代码保证在大部分机型上都可用
|
||||
try {
|
||||
Context context = this;
|
||||
Class clazz = Settings.class;
|
||||
Field field = clazz.getDeclaredField("ACTION_MANAGE_OVERLAY_PERMISSION");
|
||||
Intent intent = new Intent(field.get(null).toString());
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, "请在悬浮窗管理中打开权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package cc.winboll.studio.positions.activities;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/24 12:14:04
|
||||
*/
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||
|
||||
public class TestMapViewActivity extends AppCompatActivity {
|
||||
|
||||
public static final String TAG = "TestMapViewActivity";
|
||||
|
||||
/**
|
||||
* 由于SDK并没有提供用于MapView管理地图生命周期的Activity
|
||||
* 因此需要用户继承Activity后管理地图的生命周期,防止内存泄露
|
||||
*/
|
||||
|
||||
private TextureMapView mapView;
|
||||
protected TencentMap tencentMap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_testmapview);
|
||||
|
||||
mapView = findViewById(R.id.mapview);
|
||||
mapView.setOpaque(false);
|
||||
//创建tencentMap地图对象,可以完成对地图的几乎所有操作
|
||||
tencentMap = mapView.getMap();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mapview的生命周期管理
|
||||
*/
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
mapView.onRestart();
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package cc.winboll.studio.positions.adapters;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/20 13:33:04
|
||||
* @Describe MyPagerAdapter
|
||||
*/
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import cc.winboll.studio.positions.fragments.TasksFragment;
|
||||
import cc.winboll.studio.positions.fragments.PositionsFragment;
|
||||
import cc.winboll.studio.positions.fragments.LogFragment;
|
||||
|
||||
public class MyPagerAdapter2 extends FragmentPagerAdapter {
|
||||
public static final String TAG = "MyPagerAdapter2";
|
||||
|
||||
private static final int PAGE_COUNT = 3;
|
||||
|
||||
public MyPagerAdapter2(@NonNull FragmentManager fm) {
|
||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// if(position == 0) {
|
||||
// return PositionsFragment.newInstance(position);
|
||||
// } else if(position == 1) {
|
||||
// return TasksFragment.newInstance(position);
|
||||
// } else {
|
||||
// return LogFragment.newInstance(position);
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return PAGE_COUNT;
|
||||
}
|
||||
}
|
||||
|
@ -1,250 +0,0 @@
|
||||
package cc.winboll.studio.positions.adapters;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/04/04 13:38:13
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.positions.models.PostionModel;
|
||||
import cc.winboll.studio.positions.utils.PostionUtils;
|
||||
import cc.winboll.studio.positions.views.LeftScrollView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PostionModelAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
public static final String TAG = "PostionModelAdapter";
|
||||
|
||||
private static final int VIEW_TYPE_SIMPLE = 0;
|
||||
private static final int VIEW_TYPE_EDIT = 1;
|
||||
|
||||
private Context context;
|
||||
private ArrayList<PostionModel> mPostionList;
|
||||
|
||||
public PostionModelAdapter(Context context, ArrayList<PostionModel> postionList) {
|
||||
this.context = context;
|
||||
this.mPostionList = postionList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
if (viewType == VIEW_TYPE_SIMPLE) {
|
||||
View view = inflater.inflate(R.layout.view_position_simple, parent, false);
|
||||
return new SimpleViewHolder(parent, view);
|
||||
} else {
|
||||
View view = inflater.inflate(R.layout.view_position, parent, false);
|
||||
return new EditViewHolder(parent, view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
|
||||
final PostionModel model = mPostionList.get(position);
|
||||
if (holder instanceof SimpleViewHolder) {
|
||||
final SimpleViewHolder simpleViewHolder = (SimpleViewHolder) holder;
|
||||
String szView = model.getComments().trim().equals("") ?"[NULL]": model.getComments();
|
||||
simpleViewHolder.tvComments.setText(szView);
|
||||
simpleViewHolder.scrollView.setOnActionListener(new LeftScrollView.OnActionListener(){
|
||||
|
||||
@Override
|
||||
public void onUp() {
|
||||
ArrayList<PostionModel> list = mPostionList;
|
||||
if (position > 0) {
|
||||
ToastUtils.show("onUp");
|
||||
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||
// PhoneConnectRuleModel newBean = new PhoneConnectRuleModel();
|
||||
// newBean.setRuleText(list.get(position).getRuleText());
|
||||
// newBean.setIsAllowConnection(list.get(position).isAllowConnection());
|
||||
// newBean.setIsEnable(list.get(position).isEnable());
|
||||
// newBean.setIsSimpleView(list.get(position).isSimpleView());
|
||||
list.add(position - 1, list.get(position));
|
||||
list.remove(position + 1);
|
||||
PostionUtils.getInstance(context).savePostionModelList();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDown() {
|
||||
ArrayList<PostionModel> list = mPostionList;
|
||||
if (position < list.size() - 1) {
|
||||
ToastUtils.show("onDown");
|
||||
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||
// PhoneConnectRuleModel newBean = new PhoneConnectRuleModel();
|
||||
// newBean.setRuleText(list.get(position).getRuleText());
|
||||
// newBean.setIsAllowConnection(list.get(position).isAllowConnection());
|
||||
// newBean.setIsEnable(list.get(position).isEnable());
|
||||
// newBean.setIsSimpleView(list.get(position).isSimpleView());
|
||||
list.add(position + 2, list.get(position));
|
||||
list.remove(position);
|
||||
PostionUtils.getInstance(context).savePostionModelList();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEdit() {
|
||||
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||
model.setIsSimpleView(false);
|
||||
notifyDataSetChanged();
|
||||
//notifyItemChanged(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDelete() {
|
||||
YesNoAlertDialog.show(simpleViewHolder.scrollView.getContext(), "删除确认", "是否删除该通话规则?", new YesNoAlertDialog.OnDialogResultListener(){
|
||||
|
||||
@Override
|
||||
public void onYes() {
|
||||
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||
model.setIsSimpleView(true);
|
||||
ArrayList<PostionModel> list = mPostionList;
|
||||
list.remove(position);
|
||||
PostionUtils.getInstance(context).savePostionModelList();
|
||||
notifyDataSetChanged();
|
||||
//notifyItemChanged(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNo() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
// simpleViewHolder.editButton.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// model.setIsSimpleView(false);
|
||||
// notifyItemChanged(position);
|
||||
// }
|
||||
// });
|
||||
// simpleViewHolder.deleteButton.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// model.setIsSimpleView(false);
|
||||
// ArrayList<PhoneConnectRuleModel> list = Rules.getInstance(context).getPhoneBlacRuleBeanList();
|
||||
// list.remove(position);
|
||||
// Rules.getInstance(context).saveRules();
|
||||
// notifyItemChanged(position);
|
||||
// }
|
||||
// });
|
||||
// // 触摸事件处理
|
||||
// simpleViewHolder.contentLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// switch (event.getAction()) {
|
||||
// case MotionEvent.ACTION_DOWN:
|
||||
// simpleViewHolder.startX = event.getX();
|
||||
// simpleViewHolder.isSwiping = true;
|
||||
// break;
|
||||
// case MotionEvent.ACTION_MOVE:
|
||||
// if (simpleViewHolder.isSwiping) {
|
||||
// float deltaX = simpleViewHolder.startX - event.getX();
|
||||
// if (deltaX > 0) { // 左滑
|
||||
// float translationX = Math.max(-simpleViewHolder.actionLayout.getWidth(), -deltaX);
|
||||
// simpleViewHolder.contentLayout.setTranslationX(translationX);
|
||||
// simpleViewHolder.actionLayout.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case MotionEvent.ACTION_UP:
|
||||
// simpleViewHolder.isSwiping = false;
|
||||
// if (simpleViewHolder.contentLayout.getTranslationX() < -simpleViewHolder.actionLayout.getWidth() / 2) {
|
||||
// // 保持按钮显示
|
||||
// simpleViewHolder.contentLayout.setTranslationX(-actionLayout.getWidth());
|
||||
// } else {
|
||||
// // 恢复原状
|
||||
// simpleViewHolder.contentLayout.animate().translationX(0).setDuration(200).start();
|
||||
// simpleViewHolder.actionLayout.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
} else if (holder instanceof EditViewHolder) {
|
||||
final EditViewHolder editViewHolder = (EditViewHolder) holder;
|
||||
editViewHolder.etComments.setText(model.getComments());
|
||||
editViewHolder.swEnable.setChecked(model.isEnable());
|
||||
editViewHolder.btnConfirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
model.setComments(editViewHolder.etComments.getText().toString());
|
||||
model.setIsEnable(editViewHolder.swEnable.isChecked());
|
||||
model.setIsSimpleView(true);
|
||||
PostionUtils.getInstance(context).savePostionModelList();
|
||||
notifyItemChanged(position);
|
||||
Toast.makeText(context, "保存成功", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPostionList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
PostionModel model = mPostionList.get(position);
|
||||
// 这里可以根据模型的状态来决定视图类型,简单起见,假设点击按钮后进入编辑视图
|
||||
return model.isSimpleView() ? VIEW_TYPE_SIMPLE : VIEW_TYPE_EDIT;
|
||||
}
|
||||
|
||||
static class SimpleViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private final LeftScrollView scrollView;
|
||||
private final TextView tvComments;
|
||||
|
||||
|
||||
public SimpleViewHolder(@NonNull ViewGroup parent, @NonNull View itemView) {
|
||||
super(itemView);
|
||||
//LinearLayout linearLayout = itemView.findViewById(R.id.linearLayout);
|
||||
scrollView = itemView.findViewById(R.id.scrollView);
|
||||
//tvRuleText = itemView.findViewById(R.id.ruletext_tv);
|
||||
tvComments = new TextView(itemView.getContext());
|
||||
|
||||
//tvComments.setBackgroundColor(Color.GRAY);
|
||||
//LogUtils.d(TAG, String.format("linearLayout.getMeasuredWidth() %d", linearLayout.getMeasuredWidth()));
|
||||
LogUtils.d(TAG, String.format("parent.getMeasuredWidth() %d", parent.getMeasuredWidth()));
|
||||
scrollView.setContentWidth(parent.getMeasuredWidth());
|
||||
//scrollView.setContentWidth(600);
|
||||
scrollView.addContentLayout(tvComments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class EditViewHolder extends RecyclerView.ViewHolder {
|
||||
EditText etComments;
|
||||
Switch swEnable;
|
||||
Button btnMoveCarema;
|
||||
Button btnConfirm;
|
||||
|
||||
public EditViewHolder(@NonNull ViewGroup parent, @NonNull View itemView) {
|
||||
super(itemView);
|
||||
etComments = itemView.findViewById(R.id.comments_et);
|
||||
swEnable = itemView.findViewById(R.id.enable_sw);
|
||||
btnMoveCarema = itemView.findViewById(R.id.movecarema_btn);
|
||||
btnConfirm = itemView.findViewById(R.id.confirm_btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
package cc.winboll.studio.positions.fragments;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/20 12:58:15
|
||||
* @Describe 应用日志
|
||||
*/
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.libappbase.LogView;
|
||||
|
||||
public class LogFragment extends Fragment {
|
||||
|
||||
public static final String TAG = "LogFragment";
|
||||
|
||||
private static final String ARG_PAGE = "ARG_PAGE";
|
||||
private int mPage;
|
||||
|
||||
LogView mLogView;
|
||||
|
||||
// public static LogFragment newInstance(int page) {
|
||||
// Bundle args = new Bundle();
|
||||
// args.putInt(ARG_PAGE, page);
|
||||
// LogFragment fragment = new LogFragment();
|
||||
// fragment.setArguments(args);
|
||||
// return fragment;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// if (getArguments() != null) {
|
||||
// mPage = getArguments().getInt(ARG_PAGE);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_log, container, false);
|
||||
mLogView = view.findViewById(R.id.logview);
|
||||
mLogView.start();
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mLogView.start();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,508 +0,0 @@
|
||||
package cc.winboll.studio.positions.fragments;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/20 12:57:50
|
||||
* @Describe 联系人
|
||||
*/
|
||||
import android.Manifest;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.positions.MainActivity;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.positions.adapters.PostionModelAdapter;
|
||||
import cc.winboll.studio.positions.listeners.OnGPSRTLocationListener;
|
||||
import cc.winboll.studio.positions.models.PostionFixModel;
|
||||
import cc.winboll.studio.positions.models.PostionModel;
|
||||
import cc.winboll.studio.positions.services.GPSService;
|
||||
import cc.winboll.studio.positions.utils.LocationFusion;
|
||||
import cc.winboll.studio.positions.utils.PostionUtils;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PositionsFragment extends Fragment {
|
||||
|
||||
public static final String TAG = "PositionsFragment";
|
||||
|
||||
private static final String ARG_PAGE = "ARG_PAGE";
|
||||
private int mPage;
|
||||
|
||||
private LocationManager locationManager;
|
||||
|
||||
|
||||
//MyHandler mMyHandler;
|
||||
|
||||
TextView mtvTXMyLocationInfo;
|
||||
TextView mtvPhoneGPSInfo;
|
||||
MyServiceConnection mMyServiceConnection;
|
||||
GPSService mGPSService;
|
||||
Button mbtnTXRT;
|
||||
Button mbtnAdd;
|
||||
Location mLocationTX;
|
||||
Location mLocationPhoneGPS;
|
||||
private RecyclerView recyclerView;
|
||||
private PostionModelAdapter mPostionModelAdapter;
|
||||
private ArrayList<PostionModel> mPostionList;
|
||||
|
||||
TextView mtvPostionFixModelInfo;
|
||||
TextView mtvLockPostionInfo;
|
||||
|
||||
EditText metLockLatitude;
|
||||
EditText metLockLongitude;
|
||||
|
||||
Switch mswTaskService;
|
||||
|
||||
double latitudeWifiLock;
|
||||
double longitudeWifiLock;
|
||||
double latitudeGPSLock;
|
||||
double longitudeGPSLock;
|
||||
double latitudeFuseLock;
|
||||
double longitudeFuseLock;
|
||||
|
||||
PostionFixModel mPostionFixModel;
|
||||
static Location _LocationPhoneGPSLock;
|
||||
|
||||
LocationManager locationManagerPhoneGPS;
|
||||
volatile static int nFixActivationCountValue = 70;
|
||||
volatile static int nCurrentFixActivationCountValue = 0;
|
||||
volatile static int nGPSUpdateCount = 0;
|
||||
|
||||
// public static PositionsFragment newInstance(int page) {
|
||||
// Bundle args = new Bundle();
|
||||
// args.putInt(ARG_PAGE, page);
|
||||
// PositionsFragment fragment = new PositionsFragment();
|
||||
// fragment.setArguments(args);
|
||||
// return fragment;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// if (getArguments()!= null) {
|
||||
// mPage = getArguments().getInt(ARG_PAGE);
|
||||
// }
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View viewMain = inflater.inflate(R.layout.fragment_positions, container, false);
|
||||
|
||||
mtvTXMyLocationInfo = viewMain.findViewById(R.id.txmylocationinfo_tv);
|
||||
mtvPhoneGPSInfo = viewMain.findViewById(R.id.phonegpsinfo_tv);
|
||||
mMyServiceConnection = new MyServiceConnection();
|
||||
|
||||
Intent intent = new Intent(getActivity(), GPSService.class);
|
||||
getActivity().startService(intent);
|
||||
getActivity().bindService(intent, mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
|
||||
mbtnTXRT = viewMain.findViewById(R.id.txrt_btn);
|
||||
mbtnTXRT.setOnClickListener(new Button.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//ToastUtils.show("mbtnTXRT");
|
||||
((MainActivity)getActivity()).startTXRTLocation();
|
||||
}
|
||||
});
|
||||
mbtnAdd = viewMain.findViewById(R.id.add_btn);
|
||||
mbtnAdd.setOnClickListener(new Button.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//ToastUtils.show("mbtnAdd");
|
||||
PostionUtils postionUtils = PostionUtils.getInstance(getActivity());
|
||||
postionUtils.addPostion(mLocationPhoneGPS);
|
||||
mPostionModelAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
recyclerView = viewMain.findViewById(R.id.recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
|
||||
mPostionList = PostionUtils.getInstance(getActivity()).getPostionModelList();
|
||||
|
||||
mPostionModelAdapter = new PostionModelAdapter(getActivity(), mPostionList);
|
||||
recyclerView.setAdapter(mPostionModelAdapter);
|
||||
|
||||
|
||||
// metLockLatitude = viewMain.findViewById(R.id.locklatitude_et);
|
||||
// metLockLongitude = viewMain.findViewById(R.id.locklongitude_et);
|
||||
// metLockLatitude.setEnabled(false);
|
||||
// metLockLongitude.setEnabled(false);
|
||||
// mswTaskService = viewMain.findViewById(R.id.taskservice_sw);
|
||||
|
||||
//mMyHandler = new MyHandler();
|
||||
|
||||
//nCurrentFixActivationCountValue = 0;
|
||||
//nGPSUpdateCount = 0;
|
||||
|
||||
|
||||
// mtvPostionFixModelInfo = viewMain.findViewById(R.id.postionfixmodelinfo_tv);
|
||||
// mtvLockPostionInfo = viewMain.findViewById(R.id.lockpostioninfo_tv);
|
||||
//
|
||||
|
||||
//locationManager = (LocationManager) getActivity().getSystemService(getActivity().LOCATION_SERVICE);
|
||||
|
||||
// mswTaskService.setOnClickListener(new View.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(View p1) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
// 请求GPS定位
|
||||
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, phoneGPSLocationListener);
|
||||
|
||||
// 请求基站(网络)定位
|
||||
//locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, networkLocationListener);
|
||||
|
||||
|
||||
//ToastUtils.show("PositionsFragment onCreateView");
|
||||
|
||||
//showLocationTX();
|
||||
//showLocationPhoneGPS();
|
||||
//showPostionFixModelInfo();
|
||||
|
||||
return viewMain;
|
||||
}
|
||||
|
||||
void moveToCurrentLocation() {
|
||||
if (!metLockLatitude.getText().toString().trim().equals("")
|
||||
&& !metLockLongitude.getText().toString().trim().equals("")) {
|
||||
_LocationPhoneGPSLock = new Location("User_Defined_GPS");
|
||||
_LocationPhoneGPSLock.setLatitude(Double.parseDouble(metLockLatitude.getText().toString()));
|
||||
_LocationPhoneGPSLock.setLongitude(Double.parseDouble(metLockLongitude.getText().toString()));
|
||||
//ToastUtils.show("定位手动设定位置");
|
||||
} else {
|
||||
//Location locationFix = fixGPSLocationFromPostionFixModel(_LocationPhoneGPS);
|
||||
//_LocationPhoneGPSLock = _LocationTX;
|
||||
//_LocationPhoneGPSLock = locationFix;
|
||||
//ToastUtils.show("定位GPS设定位置");
|
||||
}
|
||||
//showLockPostionInfo();
|
||||
//ToastUtils.show(String.format("%s", locationFix.toString()));
|
||||
|
||||
TXMSFragment.moveToLocation(_LocationPhoneGPSLock.getLatitude(), _LocationPhoneGPSLock.getLongitude());
|
||||
}
|
||||
|
||||
// void showLocationPhoneGPS(Location location) {
|
||||
// if (location != null) {
|
||||
// mLocationPhoneGPS = location;
|
||||
// String szTemp = String.format("\n(%d)PhoneGPS MyLocation Info\nLatitude %f\nLongitude %f\nAccuracy %f\n", nGPSUpdateCount, _LocationPhoneGPS.getLatitude(), _LocationPhoneGPS.getLongitude(), _LocationPhoneGPS.getAccuracy());
|
||||
// mtvPhoneMyLocationInfo.append(szTemp);
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
// }
|
||||
// }
|
||||
|
||||
// void showPostionFixModelInfo() {
|
||||
// if (mPostionFixModel != null && mLocationTX != null && _LocationPhoneGPS != null) {
|
||||
// String szTemp = String.format("\n(%d)FixModel Info\nLatitude TX %f\nLatitude GPS %f\nLatitude Fix %f\nLongitude TX %f\nLongitude GPS %f\nLongitude Fix %f\n\n",
|
||||
// nCurrentFixActivationCountValue,
|
||||
// mLocationTX.getLatitude(),
|
||||
// _LocationPhoneGPS.getLatitude(),
|
||||
// mPostionFixModel.getLatitudeFixModel(),
|
||||
// mLocationTX.getLongitude(),
|
||||
// _LocationPhoneGPS.getLongitude(),
|
||||
// mPostionFixModel.getLongitudeFixModel());
|
||||
// mtvPostionFixModelInfo.append(szTemp);
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
// }
|
||||
// }
|
||||
|
||||
// void showLockPostionInfo() {
|
||||
// if (mPostionFixModel != null && mLocationTX != null && _LocationPhoneGPSLock != null) {
|
||||
// String szTemp = String.format("\n%s\nFixModel Info\nLatitude TX %f\nLatitude GPS %f\nLatitude Fix %f\nLatitude GPSLock %f\nLongitude TX %f\nLongitude GPS %f\nLongitude Fix %f\nLongitude GPSLock %f\n\n",
|
||||
// TimeUtils.getCurrentTimeString(),
|
||||
// mLocationTX.getLatitude(),
|
||||
// _LocationPhoneGPS.getLatitude(),
|
||||
// mPostionFixModel.getLatitudeFixModel(),
|
||||
// _LocationPhoneGPSLock.getLatitude(),
|
||||
// mLocationTX.getLongitude(),
|
||||
// _LocationPhoneGPS.getLongitude(),
|
||||
// mPostionFixModel.getLongitudeFixModel(),
|
||||
// _LocationPhoneGPSLock.getLongitude());
|
||||
// mtvLockPostionInfo.append(szTemp);
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
// }
|
||||
// }
|
||||
|
||||
// void showLocationTX() {
|
||||
// if (_LocationTX != null) {
|
||||
// String szTemp = String.format("TX MyLocation Init Info\nLatitude %f, Longitude %f, Accuracy %f", _LocationTX.getLatitude(), _LocationTX.getLongitude(), _LocationTX.getAccuracy());
|
||||
// mtvTXMyLocationInfo.setText(szTemp);
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
// }
|
||||
// }
|
||||
|
||||
public void showLocationTX(Location location) {
|
||||
if (location != null) {
|
||||
mLocationTX = location;
|
||||
String szTemp = String.format("TX MyLocation Info\nLatitude %f, Longitude %f\nAccuracy %f", mLocationTX.getLatitude(), mLocationTX.getLongitude(), mLocationTX.getAccuracy());
|
||||
mtvTXMyLocationInfo.setText(szTemp);
|
||||
LogUtils.d(TAG, szTemp);
|
||||
}
|
||||
}
|
||||
|
||||
public void showLocationPhoneGPS(Location location) {
|
||||
if (location != null) {
|
||||
mLocationPhoneGPS = location;
|
||||
String szTemp = String.format("Phone GPS Info\nLatitude %f, Longitude %f\nAccuracy %f", mLocationPhoneGPS.getLatitude(), mLocationPhoneGPS.getLongitude(), mLocationPhoneGPS.getAccuracy());
|
||||
mtvPhoneGPSInfo.setText(szTemp);
|
||||
LogUtils.d(TAG, szTemp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.toolbar_positions, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (locationManager != null) {
|
||||
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||
ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
locationManager.removeUpdates(phoneGPSLocationListener);
|
||||
locationManager.removeUpdates(networkLocationListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// if (item.getItemId() == R.id.item_addposition) {
|
||||
// ToastUtils.show("item_addposition");
|
||||
// }
|
||||
// } else
|
||||
// if (item.getItemId() == R.id.item_exit) {
|
||||
// exit();
|
||||
// return true;
|
||||
// }
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
// void updatePostionFixModel() {
|
||||
// if (_LocationPhoneGPS == null
|
||||
// || mLocationTX == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// nCurrentFixActivationCountValue++;
|
||||
// if (nCurrentFixActivationCountValue < nFixActivationCountValue) {
|
||||
// mPostionFixModel = PostionFixModel.loadPostionFixModel();
|
||||
// mPostionFixModel.setLatitudeFixModel(_LocationPhoneGPS.getLatitude() - mLocationTX.getLatitude());
|
||||
// mPostionFixModel.setLongitudeFixModel(_LocationPhoneGPS.getLongitude() - mLocationTX.getLongitude());
|
||||
//
|
||||
//// String szTemp = String.format("PostionFixModel Info\nLatitude Fix %f, Longitude Fix %f", mPostionFixModel.getLatitudeFixModel(), mPostionFixModel.getLongitudeFixModel());
|
||||
//// mtvPostionFixModelInfo.setText(szTemp);
|
||||
//// LogUtils.d(TAG, szTemp);
|
||||
// PostionFixModel.savePostionFixModel(mPostionFixModel);
|
||||
// //ToastUtils.show(szTemp);
|
||||
// LogUtils.d(TAG, String.format("updatePostionFixModel() run %d", nCurrentFixActivationCountValue));
|
||||
//
|
||||
// showPostionFixModelInfo();
|
||||
// } else {
|
||||
// // 定位修复模型数据定型, GPS定位监听停止
|
||||
// // 在需要停止监听的地方(如onPause/onDestroy)添加:
|
||||
// if (locationManagerPhoneGPS != null) {
|
||||
// // 取消位置更新监听
|
||||
// locationManagerPhoneGPS.removeUpdates(phoneGPSLocationListener);
|
||||
// // 可选:停止后释放资源
|
||||
// phoneGPSLocationListener = null;
|
||||
// }
|
||||
// LogUtils.d(TAG, String.format("updatePostionFixModel() stop %d", nCurrentFixActivationCountValue));
|
||||
// }
|
||||
// }
|
||||
|
||||
private Location fixGPSLocationFromPostionFixModel(Location location) {
|
||||
// 用腾讯定位数据与GPS定位数据的数据差修复模型,来修复一下GPS定位数据。
|
||||
mPostionFixModel = PostionFixModel.loadPostionFixModel();
|
||||
|
||||
//Location location = locationTX;
|
||||
Location locationFix = new Location("GPS_Fix_Map_Manual");
|
||||
|
||||
// 设置基础坐标
|
||||
locationFix.setLatitude(location.getLatitude() - mPostionFixModel.getLatitudeFixModel());
|
||||
locationFix.setLongitude(location.getLongitude() - mPostionFixModel.getLongitudeFixModel());
|
||||
|
||||
// 设置必要元数据
|
||||
locationFix.setTime(System.currentTimeMillis());
|
||||
locationFix.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
|
||||
locationFix.setAccuracy(5.0f); // 手动点击精度设为5米
|
||||
|
||||
return locationFix;
|
||||
}
|
||||
|
||||
private LocationListener phoneGPSLocationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
// 处理GPS定位结果
|
||||
nGPSUpdateCount++;
|
||||
updateGPSLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {}
|
||||
};
|
||||
|
||||
private LocationListener networkLocationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
// 处理基站(网络)定位结果
|
||||
updateWifiLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {}
|
||||
};
|
||||
|
||||
void updateWifiLocation(Location location) {
|
||||
if (location != null) {
|
||||
double latitude = location.getLatitude();
|
||||
double longitude = location.getLongitude();
|
||||
|
||||
latitudeWifiLock = latitude;
|
||||
longitudeWifiLock = longitude;
|
||||
|
||||
// 简单的融合示例:这里只是显示最后获取到的位置,实际应用中需要更复杂的融合算法
|
||||
//tvWifiLocation.setText(String.format("Wifi [ Latitude: %f \nLongitude: %f ]", latitudeWifiLock, longitudeWifiLock));
|
||||
fuseLocationData();
|
||||
}
|
||||
}
|
||||
|
||||
void updateGPSLocation(Location location) {
|
||||
if (location != null) {
|
||||
// double latitude = location.getLatitude();
|
||||
// double longitude = location.getLongitude();
|
||||
//
|
||||
// latitudeGPSLock = latitude;
|
||||
// longitudeGPSLock = longitude;
|
||||
//
|
||||
// // 简单的融合示例:这里只是显示最后获取到的位置,实际应用中需要更复杂的融合算法
|
||||
// tvGPSLocation.setText(String.format("GPS [ Latitude: %f \nLongitude: %f ]", latitudeGPSLock, longitudeGPSLock));
|
||||
// fuseLocationData();
|
||||
|
||||
//_LocationPhoneGPS = location;
|
||||
// 位置变化时的处理逻辑
|
||||
// double latitude = location.getLatitude();
|
||||
// double longitude = location.getLongitude();
|
||||
// String szTemp = String.format("Phone GPS MyLocation Init Info\nLatitude %f, Longitude %f, Accuracy %f", _LocationPhoneGPS.getLatitude(), _LocationPhoneGPS.getLongitude(), _LocationPhoneGPS.getAccuracy());
|
||||
// mtvPhoneMyLocationInfo.setText(szTemp);
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
//showLocationPhoneGPS();
|
||||
//updatePostionFixModel();
|
||||
if(mswTaskService.isChecked()) {
|
||||
moveToCurrentLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fuseLocationData() {
|
||||
// 融合数据不充分退出
|
||||
if (latitudeWifiLock == 0 ||
|
||||
longitudeWifiLock == 0 ||
|
||||
latitudeGPSLock == 0 ||
|
||||
longitudeGPSLock == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
double[] result = LocationFusion.fuseLocationData(latitudeGPSLock, longitudeGPSLock,
|
||||
latitudeWifiLock, longitudeWifiLock,
|
||||
0.6, 0.4);
|
||||
latitudeFuseLock = result[0];
|
||||
longitudeFuseLock = result[1];
|
||||
|
||||
//tvFuseLocation.setText(String.format("Fuse [ Latitude: %f \nLongitude: %f ]", latitudeFuseLock, longitudeFuseLock));
|
||||
}
|
||||
|
||||
// public static final int INIT_POSITION = 1;
|
||||
// class MyHandler extends Handler {
|
||||
// @Override
|
||||
// public void handleMessage(@NonNull Message msg) {
|
||||
// switch (msg.what) {
|
||||
// case INIT_POSITION:
|
||||
// // 在这里处理接收到消息后的逻辑,比如更新 UI
|
||||
// mLocationTX = (Location)msg.obj;
|
||||
// //showLocationTX();
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
// public void sendInitPositioningMessage(Location location) {
|
||||
// if (mMyHandler != null) {
|
||||
// Message message = Message.obtain();
|
||||
// message.what = INIT_POSITION;
|
||||
// message.obj = location;
|
||||
// mMyHandler.sendMessage(message);
|
||||
// }
|
||||
// }
|
||||
|
||||
private class MyServiceConnection implements ServiceConnection {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
LogUtils.d(TAG, "onServiceConnected(...)");
|
||||
GPSService.MyBinder binder = (GPSService.MyBinder) service;
|
||||
mGPSService = binder.getService();
|
||||
mGPSService.setOnGPSRTLocationListener(new OnGPSRTLocationListener(){
|
||||
@Override
|
||||
public void onGPSRTLocation(Location location) {
|
||||
showLocationPhoneGPS(location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
LogUtils.d(TAG, "onServiceDisconnected(...)");
|
||||
mGPSService = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,515 +0,0 @@
|
||||
package cc.winboll.studio.positions.fragments;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/25 12:44:39
|
||||
* @Describe 腾讯地图服务视图
|
||||
*/
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.positions.listeners.OnTXRTLocationListener;
|
||||
import cc.winboll.studio.positions.models.PostionModel;
|
||||
import cc.winboll.studio.positions.utils.LocationFileStorage;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.map.geolocation.TencentLocationListener;
|
||||
import com.tencent.map.geolocation.TencentLocationManager;
|
||||
import com.tencent.map.geolocation.TencentLocationRequest;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.LocationSource;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||
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.MyLocationStyle;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TXMSFragment extends Fragment implements /*EasyPermissions.PermissionCallbacks,*/LocationSource, TencentLocationListener,TencentMap.OnMapClickListener {
|
||||
|
||||
public static final String TAG = "TXMSFragment";
|
||||
|
||||
private static final int PERMISSION_REQUEST_CODE = 1;
|
||||
|
||||
private LocationManager mLocationManager;
|
||||
private LocationListener mLocationListener;
|
||||
|
||||
private static final String ARG_PAGE = "ARG_PAGE";
|
||||
private int mPage;
|
||||
private TextureMapView mapView;
|
||||
protected TencentMap tencentMap;
|
||||
|
||||
private LocationSource.OnLocationChangedListener locationChangedListener;
|
||||
|
||||
private TencentLocationManager mTencentLocationManager;
|
||||
private TencentLocationRequest mTencentLocationRequest;
|
||||
private MyLocationStyle mMyLocationStyle;
|
||||
ArrayList<PostionModel> locationPostionModelList;
|
||||
//Location lastLocation;
|
||||
static TXMSFragment _TXMSFragment;
|
||||
OnTXRTLocationListener mOnTXRTLocationListener;
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
_TXMSFragment = TXMSFragment.this;
|
||||
View viewRoot = inflater.inflate(R.layout.fragment_txms, container, false);
|
||||
locationPostionModelList = new ArrayList<PostionModel>();
|
||||
|
||||
TencentMapInitializer.setAgreePrivacy(true);
|
||||
//TencentMapInitializer.setAgreePrivacy(getActivity(), true);
|
||||
//TencentMapInitializer.start(getActivity());
|
||||
TencentLocationManager.setUserAgreePrivacy(true);
|
||||
|
||||
mapView = viewRoot.findViewById(R.id.mapview);
|
||||
mapView.setOpaque(false);
|
||||
//创建tencentMap地图对象,可以完成对地图的几乎所有操作
|
||||
tencentMap = mapView.getMap();
|
||||
|
||||
|
||||
checkLocationPermission();
|
||||
|
||||
// 设置地图点击监听
|
||||
tencentMap.setOnMapClickListener(this);
|
||||
|
||||
loadLocations();
|
||||
|
||||
UiSettings uiSettings = tencentMap.getUiSettings();
|
||||
uiSettings.setAllGesturesEnabled(true);
|
||||
mTencentLocationManager = TencentLocationManager.getInstance(getActivity());
|
||||
//创建定位请求
|
||||
mTencentLocationRequest = TencentLocationRequest.create();
|
||||
//mTencentLocationManager.requestLocationUpdates(mTencentLocationRequest, this);
|
||||
//地图上设置定位数据源
|
||||
tencentMap.setLocationSource(this);
|
||||
//设置当前位置可见
|
||||
tencentMap.setMyLocationEnabled(true);
|
||||
//设置定位图标样式
|
||||
setMyLocationMarkerStyle();
|
||||
startRTLocation();
|
||||
|
||||
return viewRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick(LatLng latLng) {
|
||||
//创建Marker对象之前,设置属性
|
||||
//LatLng position = new LatLng(40.011313,116.391907);
|
||||
BitmapDescriptor custom = BitmapDescriptorFactory.fromResource(R.drawable.marker);
|
||||
Location location = createTXLocationFromLatLng(latLng);
|
||||
addLocationToMap(location);
|
||||
Marker mCustomMarker = tencentMap.addMarker(new MarkerOptions(latLng));
|
||||
|
||||
//创建Marker对象之后,修改属性
|
||||
// Animation animation = new AlphaAnimation(0.7f, 0f);
|
||||
// animation.setDuration(2000);
|
||||
// mCustomMarker.setAnimation(animation);
|
||||
// mCustomMarker.startAnimation();
|
||||
}
|
||||
|
||||
void genLocationFixModel() {
|
||||
|
||||
}
|
||||
|
||||
public void startRTLocation() {
|
||||
//ToastUtils.show("startRTLocation()");
|
||||
mTencentLocationManager.requestLocationUpdates(mTencentLocationRequest, this);
|
||||
}
|
||||
|
||||
private void stopLocation() {
|
||||
if (mTencentLocationManager != null) {
|
||||
mTencentLocationManager.removeUpdates(this);
|
||||
//mTencentLocationManager.removeLocationListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
void loadLocations() {
|
||||
// 读取数据
|
||||
locationPostionModelList = LocationFileStorage.loadFromFile(getActivity());
|
||||
|
||||
for (PostionModel lj : locationPostionModelList) {
|
||||
tencentMap.addMarker(new MarkerOptions(convertLocationToLatLng(lj.toLocation())));
|
||||
}
|
||||
}
|
||||
|
||||
void addLocationToMap(Location location) {
|
||||
locationPostionModelList.add(new PostionModel(location));
|
||||
LocationFileStorage.saveToFile(getActivity(), locationPostionModelList);
|
||||
}
|
||||
|
||||
// public void addCurrentLocationToMap() {
|
||||
// ToastUtils.show("addCurrentLocationToMap");
|
||||
// Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
// locationPostionModelList.add(new PostionModel(getCurrentGPSLocation()));
|
||||
// LocationFileStorage.saveToFile(getActivity(), locationPostionModelList);
|
||||
// }
|
||||
|
||||
// 手机 GPS 定位信息
|
||||
// LocationListener phoneGPSLocationListener = new LocationListener() {
|
||||
// @Override
|
||||
// public void onLocationChanged(Location location) {
|
||||
// locationPhoneGPS = location;
|
||||
// // 位置变化时的处理逻辑
|
||||
//// double latitude = location.getLatitude();
|
||||
//// double longitude = location.getLongitude();
|
||||
// String szTemp = String.format("Phone GPS MyLocation Init Info\nLatitude %f, Longitude %f, Accuracy %f", locationPhoneGPS.getLatitude(), locationPhoneGPS.getLongitude(), locationPhoneGPS.getAccuracy());
|
||||
// mtvPhoneMyLocationInfo.setText(szTemp);
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
// updatePostionFixModel();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onProviderDisabled(String provider) {}
|
||||
//
|
||||
// @Override
|
||||
// public void onProviderEnabled(String provider) {}
|
||||
//
|
||||
// @Override
|
||||
// public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
// };
|
||||
|
||||
|
||||
|
||||
|
||||
// 创建Location对象方法
|
||||
private Location createTXLocationFromLatLng(double latitudeLock, double longitudeLock) {
|
||||
Location location = new Location("Tencent_Map_Manual");
|
||||
|
||||
// 设置基础坐标
|
||||
location.setLatitude(latitudeLock);
|
||||
location.setLongitude(longitudeLock);
|
||||
|
||||
// 设置必要元数据
|
||||
location.setTime(System.currentTimeMillis());
|
||||
location.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
|
||||
location.setAccuracy(5.0f); // 手动点击精度设为5米
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
// 创建Location对象方法
|
||||
private Location createTXLocationFromLatLng(LatLng latLng) {
|
||||
Location location = new Location("Tencent_Map_Manual");
|
||||
|
||||
// 设置基础坐标
|
||||
location.setLatitude(latLng.getLatitude());
|
||||
location.setLongitude(latLng.getLongitude());
|
||||
|
||||
// 设置必要元数据
|
||||
location.setTime(System.currentTimeMillis());
|
||||
location.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());
|
||||
location.setAccuracy(5.0f); // 手动点击精度设为5米
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
public static LatLng convertTencentLocationToLatLng(TencentLocation location) {
|
||||
if (location != null) {
|
||||
double latitude = location.getLatitude();
|
||||
double longitude = location.getLongitude();
|
||||
return new LatLng(latitude, longitude);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LatLng convertLocationToLatLng(Location location) {
|
||||
return new LatLng(
|
||||
location.getLatitude(),
|
||||
location.getLongitude()
|
||||
);
|
||||
}
|
||||
|
||||
// 添加标记方法
|
||||
private void addMarker(LatLng latLng) {
|
||||
tencentMap.clearAllOverlays();
|
||||
MarkerOptions options = new MarkerOptions(latLng)
|
||||
.icon(BitmapDescriptorFactory.defaultMarker())
|
||||
.title("点击保存");
|
||||
tencentMap.addMarker(options);
|
||||
}
|
||||
|
||||
public static final int REALTIME_POSITIONING = 1;
|
||||
private Handler handler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void handleMessage(@NonNull Message msg) {
|
||||
switch (msg.what) {
|
||||
case REALTIME_POSITIONING:
|
||||
// 在这里处理接收到消息后的逻辑,比如更新 UI
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* mapview的生命周期管理
|
||||
*/
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setMyLocationMarkerStyle() {
|
||||
mMyLocationStyle = new MyLocationStyle();
|
||||
//创建图标
|
||||
//BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.marker));
|
||||
//mMyLocationStyle.icon(bitmapDescriptor);
|
||||
//设置定位圆形区域的边框宽度
|
||||
mMyLocationStyle.strokeWidth(0);
|
||||
//设置圆区域的颜色
|
||||
mMyLocationStyle.fillColor(R.color.style);
|
||||
|
||||
tencentMap.setMyLocationStyle(mMyLocationStyle);
|
||||
}
|
||||
|
||||
private Bitmap getBitMap(int resourceId) {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
int newWidth = 55;
|
||||
int newHeight = 55;
|
||||
float widthScale = ((float)newWidth) / width;
|
||||
float heightScale = ((float)newHeight) / height;
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(widthScale, heightScale);
|
||||
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static void moveToLocation(double latitudeLock, double longitudeLock) {
|
||||
if (_TXMSFragment != null) {
|
||||
Location location = _TXMSFragment.createTXLocationFromLatLng(latitudeLock, longitudeLock);
|
||||
_TXMSFragment.moveToGPSLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void moveToGPSLocation(Location location) {
|
||||
//对地图操作类进行操作
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
convertLocationToLatLng(location),
|
||||
19f,
|
||||
0f,
|
||||
0f));
|
||||
//移动地图
|
||||
tencentMap.moveCamera(cameraSigma);
|
||||
ToastUtils.show("Move To Location.");
|
||||
//addLocationToMap(location);
|
||||
}
|
||||
|
||||
public void sendRealTimePositioningMessage() {
|
||||
Message message = Message.obtain();
|
||||
message.what = TXMSFragment.REALTIME_POSITIONING;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
|
||||
public void setOnTXRTLocationListener(OnTXRTLocationListener listener) {
|
||||
mOnTXRTLocationListener = listener;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实现位置监听
|
||||
* @param tencentLocation
|
||||
* @param i
|
||||
* @param s
|
||||
*/
|
||||
@Override
|
||||
public void onLocationChanged(TencentLocation tencentLocation, int i, String s) {
|
||||
|
||||
if (i == TencentLocation.ERROR_OK && locationChangedListener != null) {
|
||||
final Location locationTX = new Location(tencentLocation.getProvider());
|
||||
//设置经纬度以及精度
|
||||
locationTX.setLatitude(tencentLocation.getLatitude());
|
||||
locationTX.setLongitude(tencentLocation.getLongitude());
|
||||
locationTX.setAccuracy(tencentLocation.getAccuracy());
|
||||
|
||||
locationChangedListener.onLocationChanged(locationTX);
|
||||
moveToGPSLocation(locationTX);
|
||||
|
||||
//显示回调的实时位置信息
|
||||
// getActivity().runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
//
|
||||
// //对地图操作类进行操作
|
||||
//// CameraUpdate cameraSigma =
|
||||
//// CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
//// convertToLatLng(location),
|
||||
//// 15,
|
||||
//// 0f,
|
||||
//// 0f));
|
||||
//// //移动地图
|
||||
//// tencentMap.moveCamera(cameraSigma);
|
||||
//// Rules.getEffectInfo(location);
|
||||
//// double distance = DistanceUtils.getDistance(
|
||||
//// locationA.getLatitude(),
|
||||
//// locationA.getLongitude(),
|
||||
//// locationB.getLatitude(),
|
||||
//// locationB.getLongitude()
|
||||
//// );
|
||||
// String szTemp = String.format("TX MyLocation Init Info\nLatitude %f, Longitude %f, Accuracy %f", locationTX.getLatitude(), locationTX.getLongitude(), locationTX.getAccuracy());
|
||||
// mtvTXMyLocationInfo.setText(szTemp);
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
// //打印tencentLocation的json字符串
|
||||
//// Toast.makeText(getApplicationContext(), new Gson().toJson(location), Toast.LENGTH_LONG).show();
|
||||
//
|
||||
//
|
||||
// //
|
||||
// // 本机 GPS 定位服务调用服务
|
||||
// //
|
||||
// locationManagerPhoneGPS = (LocationManager) getActivity().getSystemService(getActivity().LOCATION_SERVICE);
|
||||
// String provider = LocationManager.GPS_PROVIDER;
|
||||
// //Location location = locationManager.getLastKnownLocation(provider);
|
||||
// locationManagerPhoneGPS.requestLocationUpdates(provider, 2000, 10, phoneGPSLocationListener);
|
||||
// }
|
||||
// });
|
||||
|
||||
// 保存最后定位信息
|
||||
// lastLocation = new Location(tencentLocation.getProvider());
|
||||
// lastLocation.setLatitude(tencentLocation.getLatitude());
|
||||
// lastLocation.setLongitude(tencentLocation.getLongitude());
|
||||
// lastLocation.setAccuracy(tencentLocation.getAccuracy());
|
||||
|
||||
//PositionsFragment.sendInitPositioningMessage(locationTX);
|
||||
mOnTXRTLocationListener.onTXRTLocation(locationTX);
|
||||
|
||||
// 当不再需要定位时
|
||||
// 取消定位监听
|
||||
if (mTencentLocationManager != null) {
|
||||
mTencentLocationManager.removeUpdates(this);
|
||||
}
|
||||
// 关闭当前位置显示
|
||||
// if (tencentMap != null) {
|
||||
// tencentMap.setMyLocationEnabled(false);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusUpdate(String s, int i, String s1) {
|
||||
//GPS, WiFi, Radio 等状态发生变化
|
||||
Log.v("State changed", s + "===" + s1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void activate(OnLocationChangedListener onLocationChangedListener) {
|
||||
locationChangedListener = onLocationChangedListener;
|
||||
|
||||
int err = mTencentLocationManager.requestLocationUpdates(mTencentLocationRequest, this, Looper.myLooper());
|
||||
switch (err) {
|
||||
case 1:
|
||||
Toast.makeText(getActivity(), "设备缺少使用腾讯定位服务需要的基本条件", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 2:
|
||||
Toast.makeText(getActivity(), "manifest 中配置的 key 不正确", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 3:
|
||||
Toast.makeText(getActivity(), "自动加载libtencentloc.so失败", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
mTencentLocationManager.removeUpdates(this);
|
||||
mTencentLocationManager = null;
|
||||
mTencentLocationRequest = null;
|
||||
locationChangedListener = null;
|
||||
}
|
||||
|
||||
|
||||
private void checkLocationPermission() {
|
||||
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
|
||||
|| ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(getActivity(),
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
|
||||
PERMISSION_REQUEST_CODE);
|
||||
} else {
|
||||
// 权限已授予,可进行定位操作
|
||||
//startLocationUpdates();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == PERMISSION_REQUEST_CODE) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
//startLocationUpdates();
|
||||
} else {
|
||||
// 用户拒绝了权限请求
|
||||
Toast.makeText(getActivity(), "请授予定位权限", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package cc.winboll.studio.positions.fragments;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/20 12:57:00
|
||||
* @Describe 拨号
|
||||
*/
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
//import com.hjq.toast.ToastUtils;
|
||||
|
||||
public class TasksFragment extends Fragment {
|
||||
|
||||
public static final String TAG = "TasksFragment";
|
||||
|
||||
private static final String ARG_PAGE = "ARG_PAGE";
|
||||
private int mPage;
|
||||
|
||||
// public static TasksFragment newInstance(int page) {
|
||||
// Bundle args = new Bundle();
|
||||
// args.putInt(ARG_PAGE, page);
|
||||
// TasksFragment fragment = new TasksFragment();
|
||||
// fragment.setArguments(args);
|
||||
// return fragment;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// if (getArguments()!= null) {
|
||||
// mPage = getArguments().getInt(ARG_PAGE);
|
||||
// }
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View viewMain = inflater.inflate(R.layout.fragment_tasks, container, false);
|
||||
// Toolbar toolbar = viewMain.findViewById(R.id.toolbar);
|
||||
// getActivity().getMenuInflater().inflate(R.menu.toolbar_tasks, toolbar.getMenu());
|
||||
//
|
||||
|
||||
return viewMain;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.toolbar_tasks, menu);
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.item_addtask) {
|
||||
ToastUtils.show("item_addtask");
|
||||
}
|
||||
// } else
|
||||
// if (item.getItemId() == R.id.item_exit) {
|
||||
// exit();
|
||||
// return true;
|
||||
// }
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package cc.winboll.studio.positions.handlers;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/14 03:51:40
|
||||
*/
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import cc.winboll.studio.positions.services.MainService;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class MainServiceHandler extends Handler {
|
||||
public static final String TAG = "MainServiceHandler";
|
||||
|
||||
public static final int MSG_REMINDTHREAD = 0;
|
||||
|
||||
WeakReference<MainService> serviceWeakReference;
|
||||
public MainServiceHandler(MainService service) {
|
||||
serviceWeakReference = new WeakReference<MainService>(service);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_REMINDTHREAD: // 处理下载完成消息,更新UI
|
||||
{
|
||||
// 显示提醒消息
|
||||
//
|
||||
//LogUtils.d(TAG, "显示提醒消息");
|
||||
MainService mainService = serviceWeakReference.get();
|
||||
if (mainService != null) {
|
||||
mainService.appenMessage((String)msg.obj);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package cc.winboll.studio.positions.listeners;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/04/03 14:01:18
|
||||
* @Describe 手机 GPS 实时位置监听类
|
||||
*/
|
||||
import android.location.Location;
|
||||
|
||||
public interface OnGPSRTLocationListener {
|
||||
|
||||
public static final String TAG = "OnGPSRTLocationListener";
|
||||
|
||||
void onGPSRTLocation(Location location);
|
||||
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package cc.winboll.studio.positions.listeners;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/04/03 13:06:13
|
||||
* @Describe 位置监听类
|
||||
*/
|
||||
import android.location.Location;
|
||||
|
||||
public interface OnTXRTLocationListener {
|
||||
|
||||
public static final String TAG = "OnTXRTLocationListener";
|
||||
|
||||
void onTXRTLocation(Location location);
|
||||
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package cc.winboll.studio.positions.models;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/13 07:06:13
|
||||
*/
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MainServiceBean extends BaseBean {
|
||||
|
||||
public static final String TAG = "MainServiceBean";
|
||||
|
||||
boolean isEnable;
|
||||
|
||||
public MainServiceBean() {
|
||||
this.isEnable = false;
|
||||
}
|
||||
|
||||
public void setIsEnable(boolean isEnable) {
|
||||
this.isEnable = isEnable;
|
||||
}
|
||||
|
||||
public boolean isEnable() {
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainServiceBean.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
MainServiceBean bean = this;
|
||||
jsonWriter.name("isEnable").value(bean.isEnable());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("isEnable")) {
|
||||
setIsEnable(jsonReader.nextBoolean());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
package cc.winboll.studio.positions.models;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/21 10:11:36
|
||||
* @Describe 定位数据修正模型
|
||||
*/
|
||||
import android.location.Location;
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
import android.content.Context;
|
||||
import cc.winboll.studio.positions.App;
|
||||
import java.io.File;
|
||||
|
||||
public class PostionFixModel extends BaseBean {
|
||||
|
||||
public static final String TAG = "PostionFixModel";
|
||||
|
||||
// 纬度校验数据模型
|
||||
private double latitudeFixModel;
|
||||
// 经度校验数据模型
|
||||
private double longitudeFixModel;
|
||||
|
||||
public PostionFixModel() {
|
||||
this.latitudeFixModel = 0;
|
||||
this.longitudeFixModel = 0;
|
||||
}
|
||||
|
||||
public PostionFixModel(double latitudeFixModel, double longitudeFixModel) {
|
||||
this.latitudeFixModel = latitudeFixModel;
|
||||
this.longitudeFixModel = longitudeFixModel;
|
||||
}
|
||||
|
||||
public void setLatitudeFixModel(double latitudeFixModel) {
|
||||
this.latitudeFixModel = latitudeFixModel;
|
||||
}
|
||||
|
||||
public double getLatitudeFixModel() {
|
||||
return latitudeFixModel;
|
||||
}
|
||||
|
||||
public void setLongitudeFixModel(double longitudeFixModel) {
|
||||
this.longitudeFixModel = longitudeFixModel;
|
||||
}
|
||||
|
||||
public double getLongitudeFixModel() {
|
||||
return longitudeFixModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return PostionFixModel.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
jsonWriter.name("latitudeFixModel").value(getLatitudeFixModel());
|
||||
jsonWriter.name("longitudeFixModel").value(getLongitudeFixModel());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("latitudeFixModel")) {
|
||||
setLatitudeFixModel(jsonReader.nextDouble());
|
||||
} else if (name.equals("longitudeFixModel")) {
|
||||
setLongitudeFixModel(jsonReader.nextDouble());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
|
||||
public static void savePostionFixModel(PostionFixModel model) {
|
||||
saveBeanToFile(getPostionFixModelDataPath(), model);
|
||||
}
|
||||
|
||||
public static PostionFixModel loadPostionFixModel() {
|
||||
PostionFixModel model = loadBeanFromFile(getPostionFixModelDataPath(), PostionFixModel.class);
|
||||
if(model == null) {
|
||||
model = new PostionFixModel();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
static String getPostionFixModelDataPath() {
|
||||
return App.szDataFolder + File.separator + TAG + ".data";
|
||||
}
|
||||
}
|
@ -1,202 +0,0 @@
|
||||
package cc.winboll.studio.positions.models;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/25 02:58:33
|
||||
* @Describe LocationJson
|
||||
*/
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
import android.location.Location;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PostionModel extends BaseBean {
|
||||
|
||||
public static final String TAG = "PostionModel";
|
||||
|
||||
// UUID 唯一位置标识
|
||||
private String uuid;
|
||||
// 纬度
|
||||
private double latitude;
|
||||
// 经度
|
||||
private double longitude;
|
||||
// 标记时间
|
||||
private long timestamp;
|
||||
// 精确度
|
||||
private double accuracy;
|
||||
private String provider;
|
||||
private String comments;
|
||||
private boolean isEnable;
|
||||
private boolean isSimpleView;
|
||||
|
||||
public PostionModel() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.latitude = 0.0f;
|
||||
this.longitude = 0.0f;
|
||||
this.timestamp = 0L;
|
||||
this.accuracy = 0.0f;
|
||||
this.provider = "";
|
||||
this.comments = "";
|
||||
this.isEnable = false;
|
||||
this.isSimpleView = true;
|
||||
}
|
||||
|
||||
public PostionModel(Location location) {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.latitude = location.getLatitude();
|
||||
this.longitude = location.getLongitude();
|
||||
this.timestamp = location.getTime();
|
||||
this.accuracy = location.getAccuracy();
|
||||
this.provider = location.getProvider();
|
||||
this.comments = "";
|
||||
this.isEnable = false;
|
||||
this.isSimpleView = true;
|
||||
}
|
||||
|
||||
public void setIsEnable(boolean isEnable) {
|
||||
this.isEnable = isEnable;
|
||||
}
|
||||
|
||||
public boolean isEnable() {
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setIsSimpleView(boolean isSimpleView) {
|
||||
this.isSimpleView = isSimpleView;
|
||||
}
|
||||
|
||||
public boolean isSimpleView() {
|
||||
return isSimpleView;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLongitude(double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setTimestamp(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setAccuracy(double accuracy) {
|
||||
this.accuracy = accuracy;
|
||||
}
|
||||
|
||||
public double getAccuracy() {
|
||||
return accuracy;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return PostionModel.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
jsonWriter.name("uuid").value(getUuid());
|
||||
jsonWriter.name("latitude").value(getLatitude());
|
||||
jsonWriter.name("longitude").value(getLongitude());
|
||||
jsonWriter.name("timestamp").value(getTimestamp());
|
||||
jsonWriter.name("accuracy").value(getAccuracy());
|
||||
jsonWriter.name("provider").value(getProvider());
|
||||
jsonWriter.name("comments").value(getComments());
|
||||
jsonWriter.name("isEnable").value(isEnable());
|
||||
jsonWriter.name("isSimpleView").value(isSimpleView());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("uuid")) {
|
||||
setUuid(jsonReader.nextString());
|
||||
} else if (name.equals("latitude")) {
|
||||
setLatitude(jsonReader.nextDouble());
|
||||
} else if (name.equals("longitude")) {
|
||||
setLongitude(jsonReader.nextDouble());
|
||||
} else if (name.equals("timestamp")) {
|
||||
setTimestamp(jsonReader.nextLong());
|
||||
} else if (name.equals("accuracy")) {
|
||||
setAccuracy(jsonReader.nextDouble());
|
||||
} else if (name.equals("provider")) {
|
||||
setProvider(jsonReader.nextString());
|
||||
} else if (name.equals("comments")) {
|
||||
setComments(jsonReader.nextString());
|
||||
} else if (name.equals("isEnable")) {
|
||||
setIsEnable(jsonReader.nextBoolean());
|
||||
} else if (name.equals("isSimpleView")) {
|
||||
setIsSimpleView(jsonReader.nextBoolean());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Location toLocation() {
|
||||
Location location = new Location(getProvider());
|
||||
location.setLatitude(getLatitude());
|
||||
location.setLongitude(getLongitude());
|
||||
location.setTime(getTimestamp());
|
||||
location.setAccuracy((float)getAccuracy());
|
||||
return location;
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package cc.winboll.studio.positions.models;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/25 01:21:17
|
||||
* @Describe 定位信息类
|
||||
*/
|
||||
public class RulsBean {
|
||||
|
||||
public static final String TAG = "LocationBean";
|
||||
|
||||
float latitude;
|
||||
float longitude;
|
||||
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
package cc.winboll.studio.positions.models;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/04/07 13:30:41
|
||||
* @Describe 提醒任务单一任务模型
|
||||
*/
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
import android.location.Location;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TaskModel extends BaseBean {
|
||||
|
||||
public static final String TAG = "TaskModel";
|
||||
|
||||
enum AROUND_CONDITIONAL { WITHIN, BEYOND };
|
||||
|
||||
// UUID 唯一任务标识
|
||||
private String uuid;
|
||||
// 距离任务中心点的方圆半径(米)
|
||||
private int aroundMeters;
|
||||
// 方圆半径区域选择条件
|
||||
private AROUND_CONDITIONAL aroundConditional;
|
||||
// 任务生效时间戳
|
||||
private long taskEnableTimestamp;
|
||||
// 任务过期时间戳
|
||||
private long taskDisableTimestamp;
|
||||
// 任务描述
|
||||
private String comments;
|
||||
// 是否启用
|
||||
private boolean isEnable;
|
||||
// 在UI列表中是否显示简单视图
|
||||
private boolean isSimpleView;
|
||||
|
||||
public TaskModel() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.aroundMeters = 0;
|
||||
this.aroundConditional = AROUND_CONDITIONAL.WITHIN;
|
||||
this.taskEnableTimestamp = System.currentTimeMillis();
|
||||
this.taskDisableTimestamp = System.currentTimeMillis();
|
||||
this.comments = "";
|
||||
this.isEnable = false;
|
||||
this.isSimpleView = true;
|
||||
}
|
||||
|
||||
public TaskModel(String uuid, int aroundMeters, AROUND_CONDITIONAL aroundConditional, long taskEnableTimestamp, long taskDisableTimestamp, String comments, boolean isEnable, boolean isSimpleView) {
|
||||
this.uuid = uuid;
|
||||
this.aroundMeters = aroundMeters;
|
||||
this.aroundConditional = aroundConditional;
|
||||
this.taskEnableTimestamp = taskEnableTimestamp;
|
||||
this.taskDisableTimestamp = taskDisableTimestamp;
|
||||
this.comments = comments;
|
||||
this.isEnable = isEnable;
|
||||
this.isSimpleView = isSimpleView;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setAroundMeters(int aroundMeters) {
|
||||
this.aroundMeters = aroundMeters;
|
||||
}
|
||||
|
||||
public int getAroundMeters() {
|
||||
return aroundMeters;
|
||||
}
|
||||
|
||||
public void setAroundConditional(AROUND_CONDITIONAL aroundConditional) {
|
||||
this.aroundConditional = aroundConditional;
|
||||
}
|
||||
|
||||
public AROUND_CONDITIONAL getAroundConditional() {
|
||||
return aroundConditional;
|
||||
}
|
||||
|
||||
public void setTaskEnableTimestamp(long taskEnableTimestamp) {
|
||||
this.taskEnableTimestamp = taskEnableTimestamp;
|
||||
}
|
||||
|
||||
public long getTaskEnableTimestamp() {
|
||||
return taskEnableTimestamp;
|
||||
}
|
||||
|
||||
public void setTaskDisableTimestamp(long taskDisableTimestamp) {
|
||||
this.taskDisableTimestamp = taskDisableTimestamp;
|
||||
}
|
||||
|
||||
public long getTaskDisableTimestamp() {
|
||||
return taskDisableTimestamp;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setIsEnable(boolean isEnable) {
|
||||
this.isEnable = isEnable;
|
||||
}
|
||||
|
||||
public boolean isEnable() {
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
public void setIsSimpleView(boolean isSimpleView) {
|
||||
this.isSimpleView = isSimpleView;
|
||||
}
|
||||
|
||||
public boolean isSimpleView() {
|
||||
return isSimpleView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return TaskModel.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
jsonWriter.name("uuid").value(getUuid());
|
||||
jsonWriter.name("aroundMeters").value(getUuid());
|
||||
jsonWriter.name("aroundConditional").value(getComments());
|
||||
jsonWriter.name("taskEnableTimestamp").value(isEnable());
|
||||
jsonWriter.name("taskDisableTimestamp").value(isSimpleView());
|
||||
jsonWriter.name("comments").value(getComments());
|
||||
jsonWriter.name("isEnable").value(isEnable());
|
||||
jsonWriter.name("isSimpleView").value(isSimpleView());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("uuid")) {
|
||||
setUuid(jsonReader.nextString());
|
||||
} else if (name.equals("comments")) {
|
||||
setComments(jsonReader.nextString());
|
||||
} else if (name.equals("isEnable")) {
|
||||
setIsEnable(jsonReader.nextBoolean());
|
||||
} else if (name.equals("isSimpleView")) {
|
||||
setIsSimpleView(jsonReader.nextBoolean());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package cc.winboll.studio.positions.receivers;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/13 06:58:04
|
||||
* @Describe 主要广播接收器
|
||||
*/
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import cc.winboll.studio.positions.services.MainService;
|
||||
//import com.hjq.toast.ToastUtils;
|
||||
import java.lang.ref.WeakReference;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
|
||||
public class MainReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String TAG = "MainReceiver";
|
||||
public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
|
||||
WeakReference<MainService> mwrService;
|
||||
// 存储电量指示值,
|
||||
// 用于校验电量消息时的电量变化
|
||||
static volatile int _mnTheQuantityOfElectricityOld = -1;
|
||||
static volatile boolean _mIsCharging = false;
|
||||
|
||||
public MainReceiver(MainService service) {
|
||||
mwrService = new WeakReference<MainService>(service);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String szAction = intent.getAction();
|
||||
if (szAction.equals(ACTION_BOOT_COMPLETED)) {
|
||||
ToastUtils.show("ACTION_BOOT_COMPLETED");
|
||||
MainService.startMainService(context);
|
||||
} else {
|
||||
ToastUtils.show(szAction);
|
||||
}
|
||||
}
|
||||
|
||||
// 注册 Receiver
|
||||
//
|
||||
public void registerAction(Context context) {
|
||||
IntentFilter filter=new IntentFilter();
|
||||
filter.addAction(ACTION_BOOT_COMPLETED);
|
||||
//filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||
context.registerReceiver(this, filter);
|
||||
}
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
package cc.winboll.studio.positions.services;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/14 03:38:31
|
||||
* @Describe 守护进程服务
|
||||
*/
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.positions.models.MainServiceBean;
|
||||
import cc.winboll.studio.positions.services.MainService;
|
||||
|
||||
public class AssistantService extends Service {
|
||||
|
||||
public static final String TAG = "AssistantService";
|
||||
|
||||
MainServiceBean mMainServiceBean;
|
||||
MyServiceConnection mMyServiceConnection;
|
||||
MainService mMainService;
|
||||
boolean isBound = false;
|
||||
volatile boolean isThreadAlive = false;
|
||||
|
||||
public synchronized void setIsThreadAlive(boolean isThreadAlive) {
|
||||
LogUtils.d(TAG, "setIsThreadAlive(...)");
|
||||
LogUtils.d(TAG, String.format("isThreadAlive %s", isThreadAlive));
|
||||
this.isThreadAlive = isThreadAlive;
|
||||
}
|
||||
|
||||
public boolean isThreadAlive() {
|
||||
return isThreadAlive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return new MyBinder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
LogUtils.d(TAG, "onCreate");
|
||||
super.onCreate();
|
||||
|
||||
//mMyBinder = new MyBinder();
|
||||
if (mMyServiceConnection == null) {
|
||||
mMyServiceConnection = new MyServiceConnection();
|
||||
}
|
||||
// 设置运行参数
|
||||
setIsThreadAlive(false);
|
||||
assistantService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
LogUtils.d(TAG, "call onStartCommand(...)");
|
||||
assistantService();
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
//LogUtils.d(TAG, "onDestroy");
|
||||
setIsThreadAlive(false);
|
||||
// 解除绑定
|
||||
if (isBound) {
|
||||
unbindService(mMyServiceConnection);
|
||||
isBound = false;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
// 运行服务内容
|
||||
//
|
||||
void assistantService() {
|
||||
LogUtils.d(TAG, "assistantService()");
|
||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
||||
LogUtils.d(TAG, String.format("mMainServiceBean.isEnable() %s", mMainServiceBean.isEnable()));
|
||||
if (mMainServiceBean.isEnable()) {
|
||||
LogUtils.d(TAG, String.format("mIsThreadAlive %s", isThreadAlive()));
|
||||
if (isThreadAlive() == false) {
|
||||
// 设置运行状态
|
||||
setIsThreadAlive(true);
|
||||
// 唤醒和绑定主进程
|
||||
wakeupAndBindMain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 唤醒和绑定主进程
|
||||
//
|
||||
void wakeupAndBindMain() {
|
||||
LogUtils.d(TAG, "wakeupAndBindMain()");
|
||||
// 绑定服务的Intent
|
||||
Intent intent = new Intent(this, MainService.class);
|
||||
startService(new Intent(this, MainService.class));
|
||||
bindService(intent, mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
|
||||
// startService(new Intent(this, MainService.class));
|
||||
// bindService(new Intent(AssistantService.this, MainService.class), mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
}
|
||||
|
||||
// 主进程与守护进程连接时需要用到此类
|
||||
//
|
||||
class MyServiceConnection implements ServiceConnection {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
LogUtils.d(TAG, "onServiceConnected(...)");
|
||||
MainService.MyBinder binder = (MainService.MyBinder) service;
|
||||
mMainService = binder.getService();
|
||||
isBound = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
LogUtils.d(TAG, "onServiceDisconnected(...)");
|
||||
mMainServiceBean = MainServiceBean.loadBean(AssistantService.this, MainServiceBean.class);
|
||||
if (mMainServiceBean.isEnable()) {
|
||||
wakeupAndBindMain();
|
||||
}
|
||||
isBound = false;
|
||||
mMainService = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 用于返回服务实例的Binder
|
||||
public class MyBinder extends Binder {
|
||||
AssistantService getService() {
|
||||
LogUtils.d(TAG, "AssistantService MyBinder getService()");
|
||||
return AssistantService.this;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
package cc.winboll.studio.positions.services;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import cc.winboll.studio.positions.listeners.OnGPSRTLocationListener;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/04/03 12:13:23
|
||||
* @Describe 获取实时 GPS 数据的服务
|
||||
*/
|
||||
public class GPSService extends Service {
|
||||
|
||||
public static final String TAG = "GPSService";
|
||||
|
||||
OnGPSRTLocationListener mOnGPSRTLocationListener;
|
||||
LocationManager locationManager;
|
||||
Location mLocationPhoneGPS;
|
||||
Location mLocationNetwork;
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return new MyBinder();
|
||||
}
|
||||
|
||||
// 用于返回服务实例的Binder
|
||||
public class MyBinder extends Binder {
|
||||
public GPSService getService() {
|
||||
return GPSService.this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
// 请求GPS定位
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, phoneGPSLocationListener);
|
||||
// 请求基站(网络)定位
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, networkLocationListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (locationManager != null) {
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
|
||||
ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
locationManager.removeUpdates(phoneGPSLocationListener);
|
||||
locationManager.removeUpdates(networkLocationListener);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnGPSRTLocationListener(OnGPSRTLocationListener listener) {
|
||||
mOnGPSRTLocationListener = listener;
|
||||
}
|
||||
|
||||
private LocationListener phoneGPSLocationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
// 处理GPS定位结果
|
||||
if (location != null && mOnGPSRTLocationListener != null) {
|
||||
mLocationPhoneGPS = location;
|
||||
mOnGPSRTLocationListener.onGPSRTLocation(mLocationPhoneGPS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {}
|
||||
};
|
||||
|
||||
private LocationListener networkLocationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
// 处理基站(网络)定位结果
|
||||
if (location != null) {
|
||||
mLocationNetwork = location;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {}
|
||||
};
|
||||
}
|
@ -1,237 +0,0 @@
|
||||
package cc.winboll.studio.positions.services;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/13 06:56:41
|
||||
* @Describe 拨号主服务
|
||||
* 参考:
|
||||
* 进程保活-双进程守护的正确姿势
|
||||
* https://blog.csdn.net/sinat_35159441/article/details/75267380
|
||||
* Android Service之onStartCommand方法研究
|
||||
* https://blog.csdn.net/cyp331203/article/details/38920491
|
||||
*/
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.sos.SOS;
|
||||
import cc.winboll.studio.libappbase.sos.WinBoll;
|
||||
import cc.winboll.studio.positions.App;
|
||||
import cc.winboll.studio.positions.models.MainServiceBean;
|
||||
import cc.winboll.studio.positions.handlers.MainServiceHandler;
|
||||
import cc.winboll.studio.positions.receivers.MainReceiver;
|
||||
import cc.winboll.studio.positions.services.MainService;
|
||||
import cc.winboll.studio.positions.threads.MainServiceThread;
|
||||
|
||||
public class MainService extends Service {
|
||||
|
||||
public static final String TAG = "MainService";
|
||||
|
||||
public static final int MSG_UPDATE_STATUS = 0;
|
||||
|
||||
static MainService _mControlCenterService;
|
||||
|
||||
volatile boolean isServiceRunning;
|
||||
|
||||
MainServiceBean mMainServiceBean;
|
||||
MainServiceThread mMainServiceThread;
|
||||
MainServiceHandler mMainServiceHandler;
|
||||
MyServiceConnection mMyServiceConnection;
|
||||
AssistantService mAssistantService;
|
||||
boolean isBound = false;
|
||||
MainReceiver mMainReceiver;
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return new MyBinder();
|
||||
}
|
||||
|
||||
public MainServiceThread getRemindThread() {
|
||||
return mMainServiceThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
LogUtils.d(TAG, "onCreate()");
|
||||
_mControlCenterService = MainService.this;
|
||||
isServiceRunning = false;
|
||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
||||
|
||||
if (mMyServiceConnection == null) {
|
||||
mMyServiceConnection = new MyServiceConnection();
|
||||
}
|
||||
mMainServiceHandler = new MainServiceHandler(this);
|
||||
|
||||
// 运行服务内容
|
||||
mainService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
LogUtils.d(TAG, "onStartCommand(...)");
|
||||
// 运行服务内容
|
||||
mainService();
|
||||
return (mMainServiceBean.isEnable()) ? START_STICKY : super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
// 运行服务内容
|
||||
//
|
||||
void mainService() {
|
||||
LogUtils.d(TAG, "mainService()");
|
||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
||||
if (mMainServiceBean.isEnable() && isServiceRunning == false) {
|
||||
LogUtils.d(TAG, "mainService() start running");
|
||||
isServiceRunning = true;
|
||||
// 唤醒守护进程
|
||||
wakeupAndBindAssistant();
|
||||
// 召唤 WinBoll APP 绑定本服务
|
||||
if (App.isDebuging()) {
|
||||
WinBoll.bindToAPPBaseBeta(this, MainService.class.getName());
|
||||
} else {
|
||||
WinBoll.bindToAPPBase(this, MainService.class.getName());
|
||||
}
|
||||
|
||||
if (mMainReceiver == null) {
|
||||
// 注册广播接收器
|
||||
mMainReceiver = new MainReceiver(this);
|
||||
mMainReceiver.registerAction(this);
|
||||
}
|
||||
|
||||
|
||||
MainServiceThread.getInstance(this, mMainServiceHandler).start();
|
||||
|
||||
LogUtils.i(TAG, "Main Service Is Start.");
|
||||
}
|
||||
}
|
||||
|
||||
// 唤醒和绑定守护进程
|
||||
//
|
||||
void wakeupAndBindAssistant() {
|
||||
LogUtils.d(TAG, "wakeupAndBindAssistant()");
|
||||
// if (ServiceUtils.isServiceAlive(getApplicationContext(), AssistantService.class.getName()) == false) {
|
||||
// startService(new Intent(MainService.this, AssistantService.class));
|
||||
// //LogUtils.d(TAG, "call wakeupAndBindAssistant() : Binding... AssistantService");
|
||||
// bindService(new Intent(MainService.this, AssistantService.class), mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
// }
|
||||
Intent intent = new Intent(this, AssistantService.class);
|
||||
startService(intent);
|
||||
// 绑定服务的Intent
|
||||
//Intent intent = new Intent(this, AssistantService.class);
|
||||
bindService(intent, mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
|
||||
// Intent intent = new Intent(this, AssistantService.class);
|
||||
// startService(intent);
|
||||
// LogUtils.d(TAG, "startService(intent)");
|
||||
// bindService(new Intent(this, AssistantService.class), mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
//LogUtils.d(TAG, "onDestroy");
|
||||
mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class);
|
||||
//LogUtils.d(TAG, "onDestroy done");
|
||||
if (mMainServiceBean.isEnable() == false) {
|
||||
// 设置运行状态
|
||||
isServiceRunning = false;// 解除绑定
|
||||
if (isBound) {
|
||||
unbindService(mMyServiceConnection);
|
||||
isBound = false;
|
||||
}
|
||||
// 停止守护进程
|
||||
Intent intent = new Intent(this, AssistantService.class);
|
||||
stopService(intent);
|
||||
// 停止Receiver
|
||||
if (mMainReceiver != null) {
|
||||
unregisterReceiver(mMainReceiver);
|
||||
mMainReceiver = null;
|
||||
}
|
||||
// 停止前台通知栏
|
||||
stopForeground(true);
|
||||
|
||||
// 停止主要进程
|
||||
MainServiceThread.getInstance(this, mMainServiceHandler).setIsExit(true);
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
// 主进程与守护进程连接时需要用到此类
|
||||
//
|
||||
private class MyServiceConnection implements ServiceConnection {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
LogUtils.d(TAG, "onServiceConnected(...)");
|
||||
AssistantService.MyBinder binder = (AssistantService.MyBinder) service;
|
||||
mAssistantService = binder.getService();
|
||||
isBound = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
LogUtils.d(TAG, "onServiceDisconnected(...)");
|
||||
if (mMainServiceBean.isEnable()) {
|
||||
// 唤醒守护进程
|
||||
wakeupAndBindAssistant();
|
||||
if (App.isDebuging()) {
|
||||
SOS.sosToAppBaseBeta(MainService.this, MainService.class.getName());
|
||||
} else {
|
||||
SOS.sosToAppBase(MainService.this, MainService.class.getName());
|
||||
}
|
||||
}
|
||||
isBound = false;
|
||||
mAssistantService = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 用于返回服务实例的Binder
|
||||
public class MyBinder extends Binder {
|
||||
MainService getService() {
|
||||
LogUtils.d(TAG, "MainService MyBinder getService()");
|
||||
return MainService.this;
|
||||
}
|
||||
}
|
||||
|
||||
// //
|
||||
// // 启动服务
|
||||
// //
|
||||
// public static void startControlCenterService(Context context) {
|
||||
// Intent intent = new Intent(context, MainService.class);
|
||||
// context.startForegroundService(intent);
|
||||
// }
|
||||
//
|
||||
// //
|
||||
// // 停止服务
|
||||
// //
|
||||
// public static void stopControlCenterService(Context context) {
|
||||
// Intent intent = new Intent(context, MainService.class);
|
||||
// context.stopService(intent);
|
||||
// }
|
||||
|
||||
public void appenMessage(String message) {
|
||||
LogUtils.d(TAG, String.format("Message : %s", message));
|
||||
}
|
||||
|
||||
public static void stopMainService(Context context) {
|
||||
LogUtils.d(TAG, "stopMainService");
|
||||
MainServiceBean bean = new MainServiceBean();
|
||||
bean.setIsEnable(false);
|
||||
MainServiceBean.saveBean(context, bean);
|
||||
context.stopService(new Intent(context, MainService.class));
|
||||
}
|
||||
|
||||
public static void startMainService(Context context) {
|
||||
LogUtils.d(TAG, "startMainService");
|
||||
MainServiceBean bean = new MainServiceBean();
|
||||
bean.setIsEnable(true);
|
||||
MainServiceBean.saveBean(context, bean);
|
||||
context.startService(new Intent(context, MainService.class));
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
package cc.winboll.studio.positions.tasks;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/25 01:15:08
|
||||
* @Describe 定位规则类
|
||||
*/
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import android.location.Location;
|
||||
|
||||
public class Rules {
|
||||
|
||||
public static final String TAG = "Rules";
|
||||
|
||||
public static String getEffectInfo(Location locationA) {
|
||||
//Location locationB = new Location(22.0f, 111.0f);
|
||||
// 腾讯SDK返回的坐标点(注意坐标系需统一)
|
||||
//TencentLocation locationA = ...; // 第一个点
|
||||
//TencentLocation locationB = ...; // 第二个点
|
||||
|
||||
// float[] results = new float[1];
|
||||
// Location.distanceBetween(
|
||||
// locationA.getLatitude(), // 纬度
|
||||
// locationA.getLongitude(), // 经度
|
||||
// locationB.getLatitude(),
|
||||
// locationB.getLongitude(),
|
||||
// results
|
||||
// );
|
||||
//
|
||||
// return "两点距离:" + results[0] + "米";
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package cc.winboll.studio.positions.threads;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/14 03:46:44
|
||||
*/
|
||||
import android.content.Context;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.positions.handlers.MainServiceHandler;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class MainServiceThread extends Thread {
|
||||
|
||||
public static final String TAG = "MainServiceThread";
|
||||
|
||||
volatile static MainServiceThread _MainServiceThread;
|
||||
// 控制线程是否退出的标志
|
||||
volatile boolean isExit = false;
|
||||
volatile boolean isStarted = false;
|
||||
Context mContext;
|
||||
// 服务Handler, 用于线程发送消息使用
|
||||
WeakReference<MainServiceHandler> mwrMainServiceHandler;
|
||||
|
||||
MainServiceThread(Context context, MainServiceHandler handler) {
|
||||
mContext = context;
|
||||
mwrMainServiceHandler = new WeakReference<MainServiceHandler>(handler);
|
||||
}
|
||||
|
||||
public void setIsExit(boolean isExit) {
|
||||
this.isExit = isExit;
|
||||
}
|
||||
|
||||
public boolean isExit() {
|
||||
return isExit;
|
||||
}
|
||||
|
||||
public void setIsStarted(boolean isStarted) {
|
||||
this.isStarted = isStarted;
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return isStarted;
|
||||
}
|
||||
|
||||
public static MainServiceThread getInstance(Context context, MainServiceHandler handler) {
|
||||
if (_MainServiceThread != null) {
|
||||
_MainServiceThread.setIsExit(true);
|
||||
}
|
||||
_MainServiceThread = new MainServiceThread(context, handler);
|
||||
return _MainServiceThread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (isStarted == false) {
|
||||
isStarted = true;
|
||||
LogUtils.d(TAG, "run()");
|
||||
|
||||
while (!isExit()) {
|
||||
//ToastUtils.show("run");
|
||||
//LogUtils.d(TAG, "run()");
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
}
|
||||
_MainServiceThread = null;
|
||||
LogUtils.d(TAG, "run() exit");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package cc.winboll.studio.positions.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/25 03:02:17
|
||||
* @Describe LocationFileStorage
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.positions.models.PostionModel;
|
||||
import cc.winboll.studio.positions.App;
|
||||
import java.io.File;
|
||||
|
||||
public class LocationFileStorage {
|
||||
public static final String TAG = "LocationFileStorage";
|
||||
|
||||
static final String FILE_NAME = "locations.json";
|
||||
|
||||
public static void saveToFile(Context context, ArrayList<PostionModel> locations) {
|
||||
try {
|
||||
PostionModel.saveBeanListToFile(getDataPath(), locations);
|
||||
} catch (Exception e) {
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<PostionModel> loadFromFile(Context context) {
|
||||
ArrayList<PostionModel> result = new ArrayList<PostionModel>();
|
||||
try {
|
||||
PostionModel.loadBeanListFromFile(getDataPath(), result, PostionModel.class);
|
||||
} catch (Exception e) {
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static String getDataPath() {
|
||||
return App.szDataFolder + File.separator + FILE_NAME;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package cc.winboll.studio.positions.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/11 09:36:52
|
||||
* @Describe 定位数据融合类
|
||||
*/
|
||||
import cc.winboll.studio.positions.App;
|
||||
import java.io.File;
|
||||
|
||||
public class LocationFusion {
|
||||
|
||||
public static final String TAG = "LocationFusion";
|
||||
|
||||
static final String FILE_NAME = "LocationFusionModel.json";
|
||||
|
||||
// 融合定位数据的方法
|
||||
public static double[] fuseLocationData(double latitudeGPSLock, double longitudeGPSLock,
|
||||
double latitudeWifiLock, double longitudeWifiLock, double gpsWeight, double wifiWeight) {
|
||||
if (gpsWeight + wifiWeight != 1) {
|
||||
throw new IllegalArgumentException("GPS权重和Wi-Fi权重之和必须为1");
|
||||
}
|
||||
double lat = latitudeGPSLock * gpsWeight + latitudeWifiLock * wifiWeight;
|
||||
double lon = longitudeGPSLock * gpsWeight + longitudeWifiLock * wifiWeight;
|
||||
return new double[]{lat, lon};
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// double[] gpsLocation = {30.5, 120.5};
|
||||
// double[] wifiLocation = {30.6, 120.6};
|
||||
// double gpsWeight = 0.6;
|
||||
// double wifiWeight = 0.4;
|
||||
// double[] fusedLocation = fuseLocationData(gpsLocation, wifiLocation, gpsWeight, wifiWeight);
|
||||
// System.out.println("融合后的纬度: " + fusedLocation[0] + ", 经度: " + fusedLocation[1]);
|
||||
// }
|
||||
|
||||
static String getDataPath() {
|
||||
return App.szDataFolder + File.separator + FILE_NAME;
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package cc.winboll.studio.positions.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/04/03 21:09:50
|
||||
* @Describe 位置处理工具集
|
||||
*/
|
||||
import android.content.Context;
|
||||
import cc.winboll.studio.positions.models.PostionModel;
|
||||
import java.util.ArrayList;
|
||||
import android.location.Location;
|
||||
|
||||
public class PostionUtils {
|
||||
|
||||
public static final String TAG = "PostionUtils";
|
||||
|
||||
static volatile PostionUtils _PostionUtils;
|
||||
|
||||
Context mContext;
|
||||
ArrayList<PostionModel> mPostionModelList = new ArrayList<PostionModel>();
|
||||
|
||||
PostionUtils(Context context) {
|
||||
mContext = context;
|
||||
PostionModel.loadBeanList(mContext, mPostionModelList, PostionModel.class);
|
||||
}
|
||||
|
||||
public synchronized static PostionUtils getInstance(Context context) {
|
||||
if (_PostionUtils == null) {
|
||||
_PostionUtils = new PostionUtils(context);
|
||||
}
|
||||
return _PostionUtils;
|
||||
}
|
||||
|
||||
public ArrayList<PostionModel> getPostionModelList() {
|
||||
return mPostionModelList;
|
||||
}
|
||||
|
||||
public void savePostionModelList() {
|
||||
PostionModel.saveBeanList(mContext, mPostionModelList, PostionModel.class);
|
||||
}
|
||||
|
||||
public void addPostion(PostionModel item) {
|
||||
mPostionModelList.add(item);
|
||||
PostionModel.saveBeanList(mContext, mPostionModelList, PostionModel.class);
|
||||
}
|
||||
|
||||
public void addPostion(Location location) {
|
||||
PostionModel item = new PostionModel();
|
||||
item.setLatitude(location.getLatitude());
|
||||
item.setLongitude(location.getLongitude());
|
||||
item.setTimestamp(location.getTime());
|
||||
item.setAccuracy(location.getAccuracy());
|
||||
item.setProvider(location.getProvider());
|
||||
|
||||
mPostionModelList.add(item);
|
||||
PostionModel.saveBeanList(mContext, mPostionModelList, PostionModel.class);
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package cc.winboll.studio.positions.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/21 16:02:56
|
||||
* @Describe 时间工具集
|
||||
*/
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class TimeUtils {
|
||||
|
||||
public static final String TAG = "TimeUtils";
|
||||
|
||||
public static String getCurrentTimeString() {
|
||||
// 获取当前日期时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
// 定义日期时间格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// 格式化日期时间
|
||||
String formattedDateTime = now.format(formatter);
|
||||
//System.out.println(formattedDateTime);
|
||||
return formattedDateTime;
|
||||
}
|
||||
|
||||
}
|
@ -1,246 +0,0 @@
|
||||
package cc.winboll.studio.positions.views;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/02/22 03:32:48
|
||||
* @Describe GridMapView
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ScaleGestureDetector;
|
||||
import android.view.View;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GridMapView extends View {
|
||||
// 网格参数
|
||||
private float gridTotalWidth = 1000f;
|
||||
private float gridTotalHeight = 1000f;
|
||||
private float gridSpacing = 50f;
|
||||
|
||||
// 视图变换参数
|
||||
private float offsetX = 0f;
|
||||
private float offsetY = 0f;
|
||||
private float scaleFactor = 1.0f;
|
||||
private final float minScale = 0.5f;
|
||||
private final float maxScale = 5.0f;
|
||||
|
||||
// 手势检测
|
||||
private final ScaleGestureDetector scaleDetector;
|
||||
private float lastTouchX;
|
||||
private float lastTouchY;
|
||||
|
||||
// 图形存储
|
||||
private final List<MapShape> shapes = new ArrayList<MapShape>();
|
||||
|
||||
public GridMapView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public GridMapView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
scaleDetector = new ScaleGestureDetector(context, new ScaleListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
canvas.save();
|
||||
canvas.translate(offsetX, offsetY);
|
||||
canvas.scale(scaleFactor, scaleFactor);
|
||||
|
||||
drawGrid(canvas);
|
||||
drawShapes(canvas);
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
private void drawGrid(Canvas canvas) {
|
||||
Paint gridPaint = new Paint();
|
||||
gridPaint.setColor(Color.LTGRAY);
|
||||
gridPaint.setStrokeWidth(1f / scaleFactor);
|
||||
|
||||
// 绘制垂直线
|
||||
for (float x = 0; x <= gridTotalWidth; x += gridSpacing) {
|
||||
canvas.drawLine(x, 0, x, gridTotalHeight, gridPaint);
|
||||
}
|
||||
|
||||
// 绘制水平线
|
||||
for (float y = 0; y <= gridTotalHeight; y += gridSpacing) {
|
||||
canvas.drawLine(0, y, gridTotalWidth, y, gridPaint);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawShapes(Canvas canvas) {
|
||||
for (MapShape shape : shapes) {
|
||||
shape.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
scaleDetector.onTouchEvent(event);
|
||||
|
||||
final int action = event.getAction();
|
||||
final float x = event.getX();
|
||||
final float y = event.getY();
|
||||
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if (!scaleDetector.isInProgress()) {
|
||||
lastTouchX = x;
|
||||
lastTouchY = y;
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (!scaleDetector.isInProgress()) {
|
||||
final float dx = x - lastTouchX;
|
||||
final float dy = y - lastTouchY;
|
||||
|
||||
offsetX += dx;
|
||||
offsetY += dy;
|
||||
invalidate();
|
||||
|
||||
lastTouchX = x;
|
||||
lastTouchY = y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 初始化视图显示区域
|
||||
public void initViewport(final float centerX, final float centerY,
|
||||
final float viewWidth, final float viewHeight) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
float viewportWidth = getWidth();
|
||||
float viewportHeight = getHeight();
|
||||
|
||||
float widthScale = viewportWidth / viewWidth;
|
||||
float heightScale = viewportHeight / viewHeight;
|
||||
scaleFactor = Math.min(widthScale, heightScale);
|
||||
|
||||
offsetX = viewportWidth/2 - centerX * scaleFactor;
|
||||
offsetY = viewportHeight/2 - centerY * scaleFactor;
|
||||
invalidate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 图形绘制方法
|
||||
public void drawPoint(float x, float y, int color, float size) {
|
||||
shapes.add(new MapShape(MapShape.TYPE_POINT, x, y, color, size));
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void drawCircle(float x, float y, float radius, int color, float strokeWidth) {
|
||||
MapShape shape = new MapShape(MapShape.TYPE_CIRCLE, x, y, color, radius);
|
||||
shape.setStrokeWidth(strokeWidth);
|
||||
shapes.add(shape);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void drawLine(float startX, float startY, float endX, float endY,
|
||||
int color, float strokeWidth) {
|
||||
MapShape shape = new MapShape(MapShape.TYPE_LINE, startX, startY, endX, endY, color);
|
||||
shape.setStrokeWidth(strokeWidth);
|
||||
shapes.add(shape);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// 网格参数设置
|
||||
public void setGridParameters(float totalWidth, float totalHeight, float spacing) {
|
||||
gridTotalWidth = totalWidth;
|
||||
gridTotalHeight = totalHeight;
|
||||
gridSpacing = spacing;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
|
||||
@Override
|
||||
public boolean onScale(ScaleGestureDetector detector) {
|
||||
float newScale = scaleFactor * detector.getScaleFactor();
|
||||
newScale = Math.max(minScale, Math.min(newScale, maxScale));
|
||||
|
||||
float focusX = detector.getFocusX();
|
||||
float focusY = detector.getFocusY();
|
||||
|
||||
offsetX = focusX - ((focusX - offsetX) / scaleFactor * newScale);
|
||||
offsetY = focusY - ((focusY - offsetY) / scaleFactor * newScale);
|
||||
|
||||
scaleFactor = newScale;
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MapShape {
|
||||
static final int TYPE_POINT = 0;
|
||||
static final int TYPE_CIRCLE = 1;
|
||||
static final int TYPE_LINE = 2;
|
||||
|
||||
final int type;
|
||||
final PointF[] points;
|
||||
final int color;
|
||||
float radius;
|
||||
float strokeWidth = 2f;
|
||||
|
||||
MapShape(int type, float x, float y, int color, float size) {
|
||||
this.type = type;
|
||||
this.points = new PointF[]{new PointF(x, y)};
|
||||
this.color = color;
|
||||
this.radius = size;
|
||||
}
|
||||
|
||||
MapShape(int type, float x1, float y1, float x2, float y2, int color) {
|
||||
this.type = type;
|
||||
this.points = new PointF[]{
|
||||
new PointF(x1, y1),
|
||||
new PointF(x2, y2)
|
||||
};
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
MapShape setStrokeWidth(float width) {
|
||||
this.strokeWidth = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
void draw(Canvas canvas) {
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(color);
|
||||
|
||||
switch (type) {
|
||||
case TYPE_POINT:
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
canvas.drawCircle(points[0].x, points[0].y, radius, paint);
|
||||
break;
|
||||
|
||||
case TYPE_CIRCLE:
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
paint.setStrokeWidth(strokeWidth);
|
||||
canvas.drawCircle(points[0].x, points[0].y, radius, paint);
|
||||
break;
|
||||
|
||||
case TYPE_LINE:
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
paint.setStrokeWidth(strokeWidth);
|
||||
canvas.drawLine(
|
||||
points[0].x, points[0].y,
|
||||
points[1].x, points[1].y,
|
||||
paint
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,219 +0,0 @@
|
||||
package cc.winboll.studio.positions.views;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/04 10:51:50
|
||||
* @Describe CustomHorizontalScrollView
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.HorizontalScrollView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
|
||||
public class LeftScrollView extends HorizontalScrollView {
|
||||
|
||||
public static final String TAG = "LeftScrollView";
|
||||
|
||||
private LinearLayout contentLayout;
|
||||
private LinearLayout toolLayout;
|
||||
private TextView textView;
|
||||
private Button editButton;
|
||||
private Button deleteButton;
|
||||
private Button upButton;
|
||||
private Button downButton;
|
||||
private float mStartX;
|
||||
private float mEndX;
|
||||
private boolean isScrolling = false;
|
||||
private int nScrollAcceptSize;
|
||||
|
||||
public LeftScrollView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public LeftScrollView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public LeftScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
public void addContentLayout(TextView textView) {
|
||||
contentLayout.addView(textView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
|
||||
}
|
||||
|
||||
public void setContentWidth(int contentWidth) {
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) contentLayout.getLayoutParams();
|
||||
layoutParams.width = contentWidth;
|
||||
contentLayout.setLayoutParams(layoutParams);
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
View viewMain = inflate(getContext(), R.layout.view_left_scroll, null);
|
||||
|
||||
// 创建内容布局
|
||||
contentLayout = viewMain.findViewById(R.id.content_layout);
|
||||
toolLayout = viewMain.findViewById(R.id.action_layout);
|
||||
|
||||
//LogUtils.d(TAG, String.format("getWidth() %d", getWidth()));
|
||||
|
||||
addView(viewMain);
|
||||
|
||||
// 创建编辑按钮
|
||||
editButton = viewMain.findViewById(R.id.edit_btn);
|
||||
// 创建删除按钮
|
||||
deleteButton = viewMain.findViewById(R.id.delete_btn);
|
||||
// 向上按钮
|
||||
upButton = viewMain.findViewById(R.id.up_btn);
|
||||
// 向下按钮
|
||||
downButton = viewMain.findViewById(R.id.down_btn);
|
||||
|
||||
// 编辑按钮点击事件
|
||||
editButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onActionListener != null) {
|
||||
onActionListener.onEdit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 删除按钮点击事件
|
||||
deleteButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onActionListener != null) {
|
||||
onActionListener.onDelete();
|
||||
}
|
||||
}
|
||||
});
|
||||
// 编辑按钮点击事件
|
||||
upButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onActionListener != null) {
|
||||
onActionListener.onUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 删除按钮点击事件
|
||||
downButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onActionListener != null) {
|
||||
onActionListener.onDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
LogUtils.d(TAG, "ACTION_DOWN");
|
||||
mStartX = event.getX();
|
||||
// isScrolling = false;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
//LogUtils.d(TAG, "ACTION_MOVE");
|
||||
// float currentX = event.getX();
|
||||
// float deltaX = mStartX - currentX;
|
||||
// //mLastX = currentX;
|
||||
// if (Math.abs(deltaX) > 0) {
|
||||
// isScrolling = true;
|
||||
// }
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
if (getScrollX() > 0) {
|
||||
LogUtils.d(TAG, "ACTION_UP");
|
||||
mEndX = event.getX();
|
||||
LogUtils.d(TAG, String.format("mStartX %f, mEndX %f", mStartX, mEndX));
|
||||
if (mEndX < mStartX) {
|
||||
LogUtils.d(TAG, String.format("mEndX >= mStartX \ngetScrollX() %d", getScrollX()));
|
||||
//if (getScrollX() > editButton.getWidth()) {
|
||||
if (Math.abs(mStartX - mEndX) > editButton.getWidth()) {
|
||||
smoothScrollToRight();
|
||||
} else {
|
||||
smoothScrollToLeft();
|
||||
}
|
||||
} else {
|
||||
LogUtils.d(TAG, String.format("mEndX >= mStartX \ngetScrollX() %d", getScrollX()));
|
||||
//if (getScrollX() > deleteButton.getWidth()) {
|
||||
if (Math.abs(mEndX - mStartX) > deleteButton.getWidth()) {
|
||||
smoothScrollToLeft();
|
||||
} else {
|
||||
smoothScrollToRight();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
void smoothScrollToRight() {
|
||||
mEndX = 0;
|
||||
mStartX = 0;
|
||||
View childView = getChildAt(0);
|
||||
if (childView != null) {
|
||||
// 计算需要滑动到最右边的距离
|
||||
int scrollToX = childView.getWidth() - getWidth();
|
||||
// 确保滑动距离不小于0
|
||||
final int scrollToX2 = Math.max(0, scrollToX);
|
||||
// 平滑滑动到最右边
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
smoothScrollTo(scrollToX2, 0);
|
||||
LogUtils.d(TAG, "smoothScrollTo(0, 0);");
|
||||
}
|
||||
});
|
||||
LogUtils.d(TAG, "smoothScrollTo(scrollToX, 0);");
|
||||
}
|
||||
}
|
||||
|
||||
void smoothScrollToLeft() {
|
||||
mEndX = 0;
|
||||
mStartX = 0;
|
||||
// 在手指抬起时,使用 post 方法调用 smoothScrollTo(0, 0)
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
smoothScrollTo(0, 0);
|
||||
LogUtils.d(TAG, "smoothScrollTo(0, 0);");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 设置文本内容
|
||||
public void setText(CharSequence text) {
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
// 定义回调接口
|
||||
public interface OnActionListener {
|
||||
void onEdit();
|
||||
void onDelete();
|
||||
void onUp();
|
||||
void onDown();
|
||||
}
|
||||
|
||||
private OnActionListener onActionListener;
|
||||
|
||||
public void setOnActionListener(OnActionListener listener) {
|
||||
this.onActionListener = listener;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#ff000000"
|
||||
android:pathData="M3.05,13H1V11H3.05C3.5,6.83 6.83,3.5 11,3.05V1H13V3.05C17.17,3.5 20.5,6.83 20.95,11H23V13H20.95C20.5,17.17 17.17,20.5 13,20.95V23H11V20.95C6.83,20.5 3.5,17.17 3.05,13M12,5A7,7 0,0 0,5 12A7,7 0,0 0,12 19A7,7 0,0 0,19 12A7,7 0,0 0,12 5Z"/>
|
||||
|
||||
</vector>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<path
|
||||
android:fillColor="#ff000000"
|
||||
android:pathData="M12,8A4,4 0,0 1,16 12A4,4 0,0 1,12 16A4,4 0,0 1,8 12A4,4 0,0 1,12 8M3.05,13H1V11H3.05C3.5,6.83 6.83,3.5 11,3.05V1H13V3.05C17.17,3.5 20.5,6.83 20.95,11H23V13H20.95C20.5,17.17 17.17,20.5 13,20.95V23H11V20.95C6.83,20.5 3.5,17.17 3.05,13M12,5A7,7 0,0 0,5 12A7,7 0,0 0,12 19A7,7 0,0 0,19 12A7,7 0,0 0,12 5Z"/>
|
||||
|
||||
</vector>
|
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 4.7 KiB |
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
//这里是Linearlayout布局的背景颜色
|
||||
<solid android:color="#4C90F9" />
|
||||
//这里是设置边框线的粗细和颜色
|
||||
<stroke
|
||||
android:width="0.0dp"
|
||||
android:color="#000000" />
|
||||
<padding
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp" />
|
||||
//角的话,里边有参数可以单独设置
|
||||
<corners android:radius="40dp" />
|
||||
</shape>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#000000" /> <!-- 设置边框宽度和颜色,这里是黑色 1dp 边框 -->
|
||||
<solid android:color="#ffffff" /> <!-- 设置背景颜色,这里是白色 -->
|
||||
</shape>
|
Before Width: | Height: | Size: 215 KiB |
Before Width: | Height: | Size: 4.1 KiB |
@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
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:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:background="#FFB2B2B2">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_get_location"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="获取位置"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_latitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_longitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_altitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bearing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<cc.winboll.studio.positions.views.GridMapView
|
||||
android:id="@+id/map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
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:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:id="@+id/frameLayout"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0"
|
||||
android:id="@+id/viewPager"/>
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:id="@+id/tabLayout"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFCAFECC">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Text"
|
||||
android:id="@+id/location_text_view"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
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:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/activitymainToolbar1"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
|
||||
android:id="@+id/mapview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14sp"
|
||||
android:background="#CAFFFFFF"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true">
|
||||
|
||||
</TextView>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_location_searching"
|
||||
app:backgroundTint="@color/colorPrimary"
|
||||
android:layout_alignParentTop="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<cc.winboll.studio.libappbase.LogView
|
||||
android:id="@+id/logview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
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:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.widget.Toolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/activitymainToolbar1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="悬浮窗设置"
|
||||
android:id="@+id/activitysettingsButton2"
|
||||
android:onClick="onCanDrawOverlays"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="默认拨号设置"
|
||||
android:id="@+id/activitysettingsButton1"
|
||||
android:onClick="onDefaultPhone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:orientation="vertical"
|
||||
tools:context=".basic.MapViewActivity">
|
||||
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
|
||||
android:id="@+id/mapview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<cc.winboll.studio.libappbase.LogView
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/logview"/>
|
||||
|
||||
</LinearLayout>
|
@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_above="@id/fragmentpositionsLinearLayout2"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:padding="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/fragmentpositionsLinearLayout1">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Text"
|
||||
android:id="@+id/txmylocationinfo_tv"/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_above="@id/fragmentpositionsLinearLayout3"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:padding="10dp"
|
||||
android:id="@+id/fragmentpositionsLinearLayout2">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Text"
|
||||
android:id="@+id/phonegpsinfo_tv"/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_above="@id/recycler_view"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right|center_vertical"
|
||||
android:id="@+id/fragmentpositionsLinearLayout3">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="۞"
|
||||
android:id="@+id/txrt_btn"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="+"
|
||||
android:id="@+id/add_btn"/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:background="@drawable/recycler_view_border"
|
||||
android:padding="2dp"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<Switch
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="任务提醒服务总开关"
|
||||
android:id="@+id/taskservice_sw"
|
||||
android:padding="10dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Spinner
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="۞"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="+Task"
|
||||
android:textAllCaps="false"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/recycler_view_border"
|
||||
android:padding="2dp"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_weight="1.0"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
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:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFF4E3FF">
|
||||
|
||||
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
|
||||
android:id="@+id/mapview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:background="@color/white">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/action_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/lightgray">
|
||||
|
||||
<Button
|
||||
android:id="@+id/edit_btn"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="编辑"
|
||||
android:background="@color/blue"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/up_btn"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="△"
|
||||
android:background="@color/green"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/down_btn"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="▽"
|
||||
android:background="@color/green"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/delete_btn"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="删除"
|
||||
android:background="@color/red"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,68 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="备注:"
|
||||
android:id="@+id/comments_tv"/>
|
||||
|
||||
<EditText
|
||||
android:layout_width="0dp"
|
||||
android:ems="10"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:id="@+id/comments_et"/>
|
||||
|
||||
<Switch
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/enable_sw"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="UUID :"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Text"
|
||||
android:id="@+id/uuid_tv"
|
||||
android:layout_weight="1.0"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="۞"
|
||||
android:id="@+id/movecarema_btn"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="√"
|
||||
android:id="@+id/confirm_btn"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="2dp"
|
||||
android:id="@+id/linearLayout">
|
||||
|
||||
<cc.winboll.studio.positions.views.LeftScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/scrollView"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/position_simple_content_root_ll">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Text"
|
||||
android:layout_weight="1.0"
|
||||
android:id="@+id/comments_tv"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="→"
|
||||
android:id="@+id/goto_task_btn"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu 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">
|
||||
<item android:id="@+id/menu_download"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="下载管理">
|
||||
</item>
|
||||
</menu>
|
@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:id="@+id/menu_type"
|
||||
app:showAsAction="ifRoom"
|
||||
tools:ignore="MenuTitle">
|
||||
<menu>
|
||||
<item android:id="@+id/menu_type_bitmap"
|
||||
android:title="@string/menu_title_infowindow_bitmap"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item android:id="@+id/menu_type_view"
|
||||
android:title="@string/menu_title_infowindow_view"
|
||||
app:showAsAction="ifRoom"/>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item android:id="@+id/menu_mult"
|
||||
app:showAsAction="ifRoom"
|
||||
tools:ignore="MenuTitle">
|
||||
<menu>
|
||||
<item android:id="@+id/menu_mult_enable"
|
||||
android:title="@string/menu_title_enable"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item android:id="@+id/menu_mult_close"
|
||||
android:title="@string/menu_title_close"
|
||||
app:showAsAction="ifRoom"/>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add"
|
||||
android:title="@string/menu_title_show"
|
||||
app:showAsAction="ifRoom" >
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_add_infowindow_default"
|
||||
android:title="@string/menu_title_default" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add_infowindow_custom"
|
||||
android:title="@string/menu_title_custom" >
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_add_infowindow_custom_1"
|
||||
android:title="@string/menu_title_style1" />
|
||||
<item
|
||||
android:id="@+id/menu_add_infowindow_custom_2"
|
||||
android:title="@string/menu_title_style2" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_play"
|
||||
android:title="@string/menu_title_animation"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_delete"
|
||||
android:title="@string/menu_title_hide"
|
||||
app:showAsAction="ifRoom"/>
|
||||
</menu>
|
@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu 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">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add_marker"
|
||||
android:title="@string/menu_title_add"
|
||||
app:showAsAction="ifRoom">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_rotate"
|
||||
android:title="@string/menu_title_marker_rotate"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_scale"
|
||||
android:title="@string/menu_title_marker_scale"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_alpha"
|
||||
android:title="@string/menu_title_marker_alpha"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_translate"
|
||||
android:title="@string/menu_title_marker_translate"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_set"
|
||||
android:title="@string/menu_title_marker_set"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_delete_marker"
|
||||
android:title="@string/menu_title_delete"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu 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">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add_marker"
|
||||
android:title="@string/menu_title_add"
|
||||
app:showAsAction="ifRoom">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_general"
|
||||
android:title="@string/menu_title_marker_general"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_massive"
|
||||
android:title="@string/menu_title_marker_massive"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_custom"
|
||||
android:title="@string/menu_title_marker_custom"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_delete_marker"
|
||||
android:title="@string/menu_title_delete"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add_groundoverlay"
|
||||
android:title="添加"
|
||||
app:showAsAction="ifRoom">
|
||||
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_remove_groundoverlay"
|
||||
android:title="移除"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_open_collisionsmap"
|
||||
android:title="添加"
|
||||
app:showAsAction="ifRoom">
|
||||
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_close_collisionsmap"
|
||||
android:title="移除"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add"
|
||||
android:title="添加"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="collapseActionView|ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add_anim"
|
||||
android:title="动画"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="collapseActionView|ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_actions"
|
||||
android:title="操作"
|
||||
android:orderInCategory="200"
|
||||
app:showAsAction="collapseActionView|ifRoom">
|
||||
<menu></menu>
|
||||
</item>
|
||||
</menu>
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu 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">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add"
|
||||
android:title="@string/menu_title_add"
|
||||
app:showAsAction="ifRoom">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_add_line_simple"
|
||||
android:title="@string/menu_title_default"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_line_dash"
|
||||
android:title="@string/menu_title_line_dash"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_line_segment"
|
||||
android:title="@string/menu_title_line_segment"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_line_texture"
|
||||
android:title="@string/menu_title_line_texture"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_add_line_gradient"
|
||||
android:title="@string/menu_title_line_gradient"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_text"
|
||||
app:showAsAction="ifRoom"
|
||||
tools:ignore="MenuTitle" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_delete"
|
||||
android:title="@string/menu_title_delete"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_adddotscatterplot"
|
||||
android:title="添加点散点"
|
||||
app:showAsAction="ifRoom">
|
||||
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_deldotscatterplot"
|
||||
android:title="移除点散点"
|
||||
app:showAsAction="ifRoom">
|
||||
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/menu_addbitmapscatterplot"
|
||||
android:title="添加贴图散点"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_delbitmapscatterplot"
|
||||
android:title="移除贴图散点"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add"
|
||||
android:title="@string/menu_title_add"
|
||||
app:showAsAction="ifRoom" >
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_simple"
|
||||
android:title="@string/menu_title_default" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_add_marker_custom"
|
||||
android:title="@string/menu_title_custom" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_delete"
|
||||
android:title="@string/menu_title_delete"
|
||||
app:showAsAction="ifRoom"/>
|
||||
</menu>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/item_testmapview"
|
||||
android:title="TestMapViewActivity"/>
|
||||
<item
|
||||
android:id="@+id/item_joint_positioning"
|
||||
android:title="JointPositioningActivity"/>
|
||||
<item
|
||||
android:id="@+id/item_demomain"
|
||||
android:title="DemoMainActivity"/>
|
||||
<item
|
||||
android:id="@+id/item_settings"
|
||||
android:title="SettingsActivity"/>
|
||||
</menu>
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/item_positionnow"
|
||||
android:title="PositionNow"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/item_addnewposition"
|
||||
android:title="AddNewPositions"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
</menu>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/item_addtask"
|
||||
android:title="AddTask"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
</menu>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_open_vectorheatmap"
|
||||
android:title="打开"
|
||||
app:showAsAction="ifRoom">
|
||||
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_close_vectorheatmap"
|
||||
android:title="关闭"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 10 KiB |