添加地图定位功能
This commit is contained in:
		| @@ -6,7 +6,7 @@ | ||||
| # http://www.gradle.org/docs/current/userguide/build_environment.html | ||||
| # Specifies the JVM arguments used for the daemon process. | ||||
| # The setting is particularly useful for tweaking memory settings. | ||||
| org.gradle.jvmargs=-Xmx2048m | ||||
| org.gradle.jvmargs=-Xmx4096m | ||||
| # When configured, Gradle will run in incubating parallel mode. | ||||
| # This option should only be used with decoupled projects. More details, visit | ||||
| # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||||
| @@ -18,7 +18,7 @@ android.useAndroidX=true | ||||
| # Automatically convert third-party libraries to use AndroidX | ||||
| android.enableJetifier=true | ||||
|  | ||||
| #org.gradle.caching=true | ||||
| org.gradle.caching=true | ||||
|  | ||||
| android.disableAutomaticComponentCreation=true | ||||
|  | ||||
|   | ||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| distributionUrl = https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||||
| distributionUrl = https\://services.gradle.org/distributions/gradle-7.5.1-all.zip | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
| zipStorePath=wrapper/dists | ||||
|   | ||||
| @@ -4,6 +4,7 @@ | ||||
| 位置应用,与卫星定位有关的应用。可以根据设定的位置与时间条件判断,来发送通知的应用。 | ||||
|  | ||||
| #### 软件架构 | ||||
| 以腾讯位置服务SDK源码为基础。源码地址:https://lbs.qq.com/mobile/androidMapSDK/developerGuide/configuration | ||||
| 适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。 | ||||
| 也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。 | ||||
|  | ||||
|   | ||||
| @@ -56,6 +56,9 @@ android { | ||||
| } | ||||
|  | ||||
| dependencies { | ||||
|     // 定位服务 | ||||
|     implementation 'com.google.android.gms:play-services-location:20.0.0' | ||||
|  | ||||
|     implementation fileTree(include: ['*.jar'], dir: 'libs') | ||||
|     implementation 'androidx.recyclerview:recyclerview:1.1.0' | ||||
|     implementation 'androidx.appcompat:appcompat:1.1.0' | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Mon Feb 24 00:05:11 GMT 2025 | ||||
| #Mon Feb 24 07:18:15 GMT 2025 | ||||
| stageCount=0 | ||||
| libraryProject= | ||||
| baseVersion=1.0 | ||||
| publishVersion=1.0.0 | ||||
| buildCount=93 | ||||
| buildCount=147 | ||||
| baseBetaVersion=1.0.1 | ||||
|   | ||||
| @@ -1,23 +1,38 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| <?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" /> <!-- 访问WiFi状态. 需要WiFi信息用于网络定位 --> | ||||
|     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 修改WiFi状态. 发起WiFi扫描, 需要WiFi信息用于网络定位 --> | ||||
|     <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" /> <!-- 访问手机当前状态, 需要device id用于网络定位 --> | ||||
|     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||||
|     <uses-permission android:name="android.permission.INTERNET" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||||
|     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||||
|     <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> | ||||
|     <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||||
|     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||||
|  | ||||
|     <!-- 拥有完全的网络访问权限 --> | ||||
|     <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 | ||||
|         android:name=".App" | ||||
| @@ -28,510 +43,699 @@ | ||||
|         android:supportsRtl="true" | ||||
|         android:theme="@style/MyAppTheme" | ||||
|         android:usesCleartextTraffic="true" | ||||
|         android:requestLegacyExternalStorage="true" | ||||
|         tools:ignore="AllowBackup,GoogleAppIndexingWarning" | ||||
|         tools:targetApi="p"> | ||||
|         <activity android:name=".MainActivity"> | ||||
|             <intent-filter> | ||||
|                 <action android:name="android.intent.action.MAIN" /> | ||||
|         tools:targetApi="q"> | ||||
|  | ||||
|         <activity android:name=".MainActivity"> | ||||
|  | ||||
|             <intent-filter> | ||||
|  | ||||
|                 <action android:name="android.intent.action.MAIN"/> | ||||
|  | ||||
|                 <category android:name="android.intent.category.LAUNCHER"/> | ||||
|  | ||||
|                 <category android:name="android.intent.category.LAUNCHER" /> | ||||
|             </intent-filter> | ||||
|  | ||||
|         </activity> | ||||
|  | ||||
|         <activity android:name=".MainActivity2"> | ||||
|  | ||||
|         </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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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> <!-- 标注 --> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 android:value="@string/demo_type_tools"/> | ||||
|  | ||||
|         </activity> | ||||
|         <activity android:name=".basic.SupportMapFragmentActivity" /> | ||||
|  | ||||
|         <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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 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" /> | ||||
|                 android:value="@string/demo_type_draw"/> | ||||
|  | ||||
|         </activity> | ||||
| <!--        <activity--> | ||||
| <!--            android:name=".basic.OfflineMapActivity"--> | ||||
| <!--            android:description="@string/demo_description_offline_map"--> | ||||
| <!--            android:label="@string/demo_label_offline_map">--> | ||||
| <!--            <meta-data--> | ||||
| <!--                android:name="@string/demo_type"--> | ||||
| <!--                android:value="@string/demo_type_basic" />--> | ||||
| <!--        </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" /> | ||||
|                 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> <!-- 如果您key确认无误,却依然授权没有通过,请检查您的key的白名单配置 --> | ||||
|                 android:value="@string/demo_type_draw"/> | ||||
|  | ||||
|         </activity> | ||||
|  | ||||
|         <meta-data | ||||
|             android:name="TencentMapSDK" | ||||
|             android:value="SCYBZ-EC5Y4-XMHUI-FX2PU-ZYMMS-IBB7P" /> | ||||
|             android:value="SCYBZ-EC5Y4-XMHUI-FX2PU-ZYMMS-IBB7P"/> | ||||
|  | ||||
|         <activity android:name="cc.winboll.studio.positions.activities.TestMapViewActivity"/> | ||||
|  | ||||
|     </application> | ||||
|  | ||||
| </manifest> | ||||
|   | ||||
| @@ -0,0 +1,394 @@ | ||||
| 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.LayoutInflater; | ||||
| 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 androidx.appcompat.app.AppCompatActivity; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.viewpager.widget.ViewPager; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import cc.winboll.studio.libappbase.LogView; | ||||
| import cc.winboll.studio.libapputils.app.IWinBollActivity; | ||||
| import cc.winboll.studio.libapputils.app.WinBollActivityManager; | ||||
| import cc.winboll.studio.libapputils.bean.APPInfo; | ||||
| import cc.winboll.studio.libapputils.view.YesNoAlertDialog; | ||||
| import cc.winboll.studio.positions.R; | ||||
| import com.tencent.map.vector.demo.DemoMainActivity; | ||||
| import cc.winboll.studio.positions.activities.SettingsActivity; | ||||
| import cc.winboll.studio.positions.adapters.MyPagerAdapter; | ||||
| import cc.winboll.studio.positions.beans.MainServiceBean; | ||||
| import cc.winboll.studio.positions.services.MainService; | ||||
| import com.google.android.material.tabs.TabLayout; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import com.tencent.map.vector.demo.AbsListActivity; | ||||
| import com.tencent.map.vector.demo.AbsActivity; | ||||
|  | ||||
| final public class Main2Activity 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"; | ||||
|  | ||||
|     LogView mLogView; | ||||
|     Toolbar mToolbar; | ||||
|     CheckBox cbMainService; | ||||
|     MainServiceBean mMainServiceBean; | ||||
|     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 | ||||
|     public AppCompatActivity getActivity() { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public APPInfo getAppInfo() { | ||||
| //        String szBranchName = "contacts"; | ||||
| // | ||||
| //        APPInfo appInfo = AboutActivityFactory.buildDefaultAPPInfo(); | ||||
| //        appInfo.setAppName("Contacts"); | ||||
| //        appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll); | ||||
| //        appInfo.setAppDescription("Contacts Description"); | ||||
| //        appInfo.setAppGitName("APP"); | ||||
| //        appInfo.setAppGitOwner("Studio"); | ||||
| //        appInfo.setAppGitAPPBranch(szBranchName); | ||||
| //        appInfo.setAppGitAPPSubProjectFolder(szBranchName); | ||||
| //        appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=Contacts"); | ||||
| //        appInfo.setAppAPKName("Contacts"); | ||||
| //        appInfo.setAppAPKFolderName("Contacts"); | ||||
| //        return appInfo; | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         // 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回 | ||||
|         //if (prosessIntents(getIntent())) return; | ||||
|         // 以下正常创建主窗口 | ||||
|         super.onCreate(savedInstanceState); | ||||
|         setContentView(R.layout.activity_main); | ||||
|  | ||||
|         // 初始化工具栏 | ||||
|         mToolbar = findViewById(R.id.activitymainToolbar1); | ||||
|         setSupportActionBar(mToolbar); | ||||
|         if (isEnableDisplayHomeAsUp()) { | ||||
|             // 显示后退按钮 | ||||
|             getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
|         } | ||||
|         getSupportActionBar().setSubtitle(getTag()); | ||||
|  | ||||
|         initData(); | ||||
|         initView(); | ||||
|         //initPoint();//调用初始化导航原点的方法 | ||||
|         viewPager.addOnPageChangeListener(this);//滑动事件 | ||||
|  | ||||
|         ViewPager viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); | ||||
|         viewPager.setAdapter(pagerAdapter); | ||||
|         TabLayout tabLayout = findViewById(R.id.activitymainTabLayout1); | ||||
|         tabLayout.setupWithViewPager(viewPager); | ||||
|  | ||||
| //        mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class); | ||||
| //        if (mMainServiceBean == null) { | ||||
| //            mMainServiceBean = new MainServiceBean(); | ||||
| //        } | ||||
| //        cbMainService = findViewById(R.id.activitymainCheckBox1); | ||||
| //        cbMainService.setChecked(mMainServiceBean.isEnable()); | ||||
| //        cbMainService.setOnClickListener(new View.OnClickListener(){ | ||||
| //                @Override | ||||
| //                public void onClick(View view) { | ||||
| //                    if (cbMainService.isChecked()) { | ||||
| //                        MainService.startMainService(MainActivity.this); | ||||
| //                    } else { | ||||
| //                        MainService.stopMainService(MainActivity.this); | ||||
| //                    } | ||||
| //                } | ||||
| //            }); | ||||
|         MainService.startMainService(Main2Activity.this); | ||||
|     } | ||||
|  | ||||
|     //初始化view,即显示的图片 | ||||
|     void initView() { | ||||
|         viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         pagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); | ||||
|         viewPager.setAdapter(pagerAdapter); | ||||
|         //adapter = new MyPagerAdapter(views); | ||||
|         //viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         //viewPager.setAdapter(adapter); | ||||
|         //linearLayout = findViewById(R.id.activitymainLinearLayout1); | ||||
|         //initPoint();//初始化页面下方的点 | ||||
|         viewPager.setOnPageChangeListener(this); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     //初始化所要显示的布局 | ||||
|     void initData() { | ||||
|         ViewPager viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         LayoutInflater inflater = LayoutInflater.from(getActivity()); | ||||
|         View view1 = inflater.inflate(R.layout.fragment_gms, viewPager, false); | ||||
|         View view2 = inflater.inflate(R.layout.fragment_contacts, viewPager, false); | ||||
|         View view3 = inflater.inflate(R.layout.fragment_log, viewPager, 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"); | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     // | ||||
|     // 处理传入的 Intent 数据 | ||||
|     // | ||||
| //    boolean prosessIntents(Intent intent) { | ||||
| //        if (intent == null  | ||||
| //            || intent.getAction() == null | ||||
| //            || intent.getAction().equals("")) | ||||
| //            return false; | ||||
| // | ||||
| //        if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) { | ||||
| //            try { | ||||
| //                WinBollActivity clazzActivity = UnitTestActivity.class.newInstance(); | ||||
| //                String tag = clazzActivity.getTag(); | ||||
| //                LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag); | ||||
| //                Intent subIntent = new Intent(this, UnitTestActivity.class); | ||||
| //                subIntent.setAction(intent.getAction()); | ||||
| //                File file = new File(getCacheDir(), UUID.randomUUID().toString()); | ||||
| //                //取出文件uri | ||||
| //                Uri uri = intent.getData(); | ||||
| //                if (uri == null) { | ||||
| //                    uri = intent.getParcelableExtra(Intent.EXTRA_STREAM); | ||||
| //                } | ||||
| //                //获取文件真实地址 | ||||
| //                String szSrcPath = UriUtils.getFileFromUri(getApplication(), uri); | ||||
| //                if (TextUtils.isEmpty(szSrcPath)) { | ||||
| //                    return false; | ||||
| //                } | ||||
| // | ||||
| //                Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath())); | ||||
| //                //startWinBollActivity(subIntent, tag); | ||||
| //                WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class); | ||||
| //            } catch (IllegalAccessException | InstantiationException | IOException e) { | ||||
| //                LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||
| //                // 函数处理异常返回失败 | ||||
| //                return false; | ||||
| //            } | ||||
| //        } else { | ||||
| //            LogUtils.d(TAG, "prosessIntents|" + intent.getAction() + "|yet"); | ||||
| //            return false; | ||||
| //        } | ||||
| //        return true; | ||||
| //    } | ||||
|  | ||||
|     @Override | ||||
|     public String getTag() { | ||||
|         return TAG; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Toolbar initToolBar() { | ||||
|         return findViewById(R.id.activitymainToolbar1); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean isAddWinBollToolBar() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean isEnableDisplayHomeAsUp() { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @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_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_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(Main2Activity.this, getString(R.string.app_name) + " 已成为默认电话应用", | ||||
|                                Toast.LENGTH_SHORT).show(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -1,311 +1,131 @@ | ||||
| package cc.winboll.studio.positions; | ||||
|  | ||||
| import android.app.Activity; | ||||
| import android.app.ActivityManager; | ||||
| import android.content.Context; | ||||
| /** | ||||
|  * @Author ZhanGSKen@AliYun.Com | ||||
|  * @Date 2025/02/24 11:05:49 | ||||
|  */ | ||||
| import cc.winboll.studio.positions.R; | ||||
| import android.content.Intent; | ||||
| import android.os.Build; | ||||
| import android.os.Bundle; | ||||
| import android.telecom.TelecomManager; | ||||
| import android.view.LayoutInflater; | ||||
| 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 androidx.appcompat.app.AppCompatActivity; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.viewpager.widget.ViewPager; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import cc.winboll.studio.libappbase.LogView; | ||||
| import cc.winboll.studio.libapputils.app.IWinBollActivity; | ||||
| import cc.winboll.studio.libapputils.app.WinBollActivityManager; | ||||
| import cc.winboll.studio.libapputils.bean.APPInfo; | ||||
| import cc.winboll.studio.libapputils.view.YesNoAlertDialog; | ||||
| import cc.winboll.studio.positions.R; | ||||
| import com.tencent.map.vector.demo.DemoMainActivity; | ||||
| import cc.winboll.studio.positions.activities.SettingsActivity; | ||||
| import cc.winboll.studio.positions.adapters.MyPagerAdapter; | ||||
| import cc.winboll.studio.positions.beans.MainServiceBean; | ||||
| import cc.winboll.studio.positions.services.MainService; | ||||
| import com.google.android.material.tabs.TabLayout; | ||||
| import java.util.ArrayList; | ||||
| import cc.winboll.studio.positions.activities.TestMapViewActivity; | ||||
| import com.tencent.map.geolocation.TencentLocationManager; | ||||
| import com.tencent.map.vector.demo.AbsActivity; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TencentMap; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TextureMapView; | ||||
| import com.google.android.material.floatingactionbutton.FloatingActionButton; | ||||
| import android.view.View; | ||||
| import com.google.android.material.snackbar.Snackbar; | ||||
| import com.google.android.gms.location.LocationCallback; | ||||
| import com.google.android.gms.location.LocationRequest; | ||||
| import com.google.android.gms.location.LocationResult; | ||||
| import com.google.android.gms.location.FusedLocationProviderClient; | ||||
| import com.google.android.gms.location.LocationServices; | ||||
| import com.google.android.gms.tasks.OnSuccessListener; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import androidx.core.content.ContextCompat; | ||||
| import android.Manifest; | ||||
| import androidx.core.app.ActivityCompat; | ||||
| import androidx.annotation.NonNull; | ||||
| import android.content.pm.PackageManager; | ||||
| import android.widget.Toast; | ||||
| import android.location.Location; | ||||
| import android.os.Looper; | ||||
| import com.hjq.toast.ToastUtils; | ||||
| import android.widget.TextView; | ||||
| import com.tencent.map.vector.demo.basic.SupportMapFragmentActivity; | ||||
| import android.Manifest; | ||||
| 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 androidx.annotation.NonNull; | ||||
| import android.util.Log; | ||||
| import android.widget.Toast; | ||||
|  | ||||
| import cc.winboll.studio.positions.R; | ||||
| import com.tencent.map.vector.demo.basic.SupportMapFragmentActivity; | ||||
| 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.LocationSource; | ||||
| import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor; | ||||
| import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory; | ||||
| import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| final public class MainActivity extends AppCompatActivity implements IWinBollActivity, ViewPager.OnPageChangeListener, View.OnClickListener { | ||||
| import pub.devrel.easypermissions.EasyPermissions; | ||||
| import androidx.appcompat.app.AppCompatActivity; | ||||
|  | ||||
| 	public static final String TAG = "MainActivity"; | ||||
| public class MainActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks,LocationSource, TencentLocationListener { | ||||
|  | ||||
|     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"; | ||||
|  | ||||
|     LogView mLogView; | ||||
|     public static final String TAG ="MainActivity"; | ||||
|      | ||||
|     private static final int PERMISSION_REQUEST_CODE = 1; | ||||
|      | ||||
|     Toolbar mToolbar; | ||||
|     CheckBox cbMainService; | ||||
|     MainServiceBean mMainServiceBean; | ||||
|     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 | ||||
|     public AppCompatActivity getActivity() { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public APPInfo getAppInfo() { | ||||
| //        String szBranchName = "contacts"; | ||||
| // | ||||
| //        APPInfo appInfo = AboutActivityFactory.buildDefaultAPPInfo(); | ||||
| //        appInfo.setAppName("Contacts"); | ||||
| //        appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll); | ||||
| //        appInfo.setAppDescription("Contacts Description"); | ||||
| //        appInfo.setAppGitName("APP"); | ||||
| //        appInfo.setAppGitOwner("Studio"); | ||||
| //        appInfo.setAppGitAPPBranch(szBranchName); | ||||
| //        appInfo.setAppGitAPPSubProjectFolder(szBranchName); | ||||
| //        appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=Contacts"); | ||||
| //        appInfo.setAppAPKName("Contacts"); | ||||
| //        appInfo.setAppAPKFolderName("Contacts"); | ||||
| //        return appInfo; | ||||
|         return null; | ||||
|     } | ||||
|     private TextureMapView mapView; | ||||
|     protected TencentMap tencentMap; | ||||
|     TextView mtvInfo; | ||||
|     private LocationSource.OnLocationChangedListener locationChangedListener; | ||||
|  | ||||
|     private TencentLocationManager locationManager; | ||||
|     private TencentLocationRequest locationRequest; | ||||
|     private MyLocationStyle locationStyle; | ||||
|      | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         // 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回 | ||||
|         //if (prosessIntents(getIntent())) return; | ||||
|         // 以下正常创建主窗口 | ||||
|         super.onCreate(savedInstanceState); | ||||
|         setContentView(R.layout.activity_main); | ||||
|  | ||||
|          | ||||
|         // 初始化工具栏 | ||||
|         mToolbar = findViewById(R.id.activitymainToolbar1); | ||||
|         setSupportActionBar(mToolbar); | ||||
|         if (isEnableDisplayHomeAsUp()) { | ||||
|             // 显示后退按钮 | ||||
|             getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
|         } | ||||
|         getSupportActionBar().setSubtitle(getTag()); | ||||
|         getSupportActionBar().setSubtitle(TAG); | ||||
|  | ||||
|         initData(); | ||||
|         initView(); | ||||
|         //initPoint();//调用初始化导航原点的方法 | ||||
|         viewPager.addOnPageChangeListener(this);//滑动事件 | ||||
|         TencentMapInitializer.setAgreePrivacy(this, true); | ||||
|         TencentMapInitializer.start(this); | ||||
|         TencentLocationManager.setUserAgreePrivacy(true); | ||||
|  | ||||
|         ViewPager viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); | ||||
|         viewPager.setAdapter(pagerAdapter); | ||||
|         TabLayout tabLayout = findViewById(R.id.activitymainTabLayout1); | ||||
|         tabLayout.setupWithViewPager(viewPager); | ||||
|  | ||||
| //        mMainServiceBean = MainServiceBean.loadBean(this, MainServiceBean.class); | ||||
| //        if (mMainServiceBean == null) { | ||||
| //            mMainServiceBean = new MainServiceBean(); | ||||
| //        } | ||||
| //        cbMainService = findViewById(R.id.activitymainCheckBox1); | ||||
| //        cbMainService.setChecked(mMainServiceBean.isEnable()); | ||||
| //        cbMainService.setOnClickListener(new View.OnClickListener(){ | ||||
| //                @Override | ||||
| //                public void onClick(View view) { | ||||
| //                    if (cbMainService.isChecked()) { | ||||
| //                        MainService.startMainService(MainActivity.this); | ||||
| //                    } else { | ||||
| //                        MainService.stopMainService(MainActivity.this); | ||||
| //                    } | ||||
| //                } | ||||
| //            }); | ||||
|         MainService.startMainService(MainActivity.this); | ||||
|     } | ||||
|         mapView = findViewById(R.id.mapview); | ||||
|         mapView.setOpaque(false); | ||||
|         //创建tencentMap地图对象,可以完成对地图的几乎所有操作 | ||||
|         tencentMap = mapView.getMap(); | ||||
|  | ||||
|     //初始化view,即显示的图片 | ||||
|     void initView() { | ||||
|         viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         pagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); | ||||
|         viewPager.setAdapter(pagerAdapter); | ||||
|         //adapter = new MyPagerAdapter(views); | ||||
|         //viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         //viewPager.setAdapter(adapter); | ||||
|         //linearLayout = findViewById(R.id.activitymainLinearLayout1); | ||||
|         //initPoint();//初始化页面下方的点 | ||||
|         viewPager.setOnPageChangeListener(this); | ||||
|         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); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     //初始化所要显示的布局 | ||||
|     void initData() { | ||||
|         ViewPager viewPager = findViewById(R.id.activitymainViewPager1); | ||||
|         LayoutInflater inflater = LayoutInflater.from(getActivity()); | ||||
|         View view1 = inflater.inflate(R.layout.fragment_gms, viewPager, false); | ||||
|         View view2 = inflater.inflate(R.layout.fragment_contacts, viewPager, false); | ||||
|         View view3 = inflater.inflate(R.layout.fragment_log, viewPager, 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);//直接跳转到某一个页面的情况 | ||||
|         checkLocationPermission(); | ||||
|          | ||||
|         //设置显示定位的图标 | ||||
|         TencentLocationManager.setUserAgreePrivacy(true); | ||||
|         //建立定位 | ||||
|         initLocation(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onPostCreate(Bundle savedInstanceState) { | ||||
|         super.onPostCreate(savedInstanceState); | ||||
|         //setSubTitle(""); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onDestroy() { | ||||
|         super.onDestroy(); | ||||
|         LogUtils.d(TAG, "onDestroy() SOS"); | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     // | ||||
|     // 处理传入的 Intent 数据 | ||||
|     // | ||||
| //    boolean prosessIntents(Intent intent) { | ||||
| //        if (intent == null  | ||||
| //            || intent.getAction() == null | ||||
| //            || intent.getAction().equals("")) | ||||
| //            return false; | ||||
| // | ||||
| //        if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) { | ||||
| //            try { | ||||
| //                WinBollActivity clazzActivity = UnitTestActivity.class.newInstance(); | ||||
| //                String tag = clazzActivity.getTag(); | ||||
| //                LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag); | ||||
| //                Intent subIntent = new Intent(this, UnitTestActivity.class); | ||||
| //                subIntent.setAction(intent.getAction()); | ||||
| //                File file = new File(getCacheDir(), UUID.randomUUID().toString()); | ||||
| //                //取出文件uri | ||||
| //                Uri uri = intent.getData(); | ||||
| //                if (uri == null) { | ||||
| //                    uri = intent.getParcelableExtra(Intent.EXTRA_STREAM); | ||||
| //                } | ||||
| //                //获取文件真实地址 | ||||
| //                String szSrcPath = UriUtils.getFileFromUri(getApplication(), uri); | ||||
| //                if (TextUtils.isEmpty(szSrcPath)) { | ||||
| //                    return false; | ||||
| //                } | ||||
| // | ||||
| //                Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath())); | ||||
| //                //startWinBollActivity(subIntent, tag); | ||||
| //                WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class); | ||||
| //            } catch (IllegalAccessException | InstantiationException | IOException e) { | ||||
| //                LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||
| //                // 函数处理异常返回失败 | ||||
| //                return false; | ||||
| //            } | ||||
| //        } else { | ||||
| //            LogUtils.d(TAG, "prosessIntents|" + intent.getAction() + "|yet"); | ||||
| //            return false; | ||||
| //        } | ||||
| //        return true; | ||||
| //    } | ||||
|  | ||||
|     @Override | ||||
|     public String getTag() { | ||||
|         return TAG; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Toolbar initToolBar() { | ||||
|         return findViewById(R.id.activitymainToolbar1); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean isAddWinBollToolBar() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean isEnableDisplayHomeAsUp() { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @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); | ||||
| //        LatLng center = new LatLng(39.904556, 116.427242); | ||||
| //        tencentMap.moveCamera( | ||||
| //            CameraUpdateFactory.newLatLngZoom(center, 13f) // 注意 13 → 13f | ||||
| //        ); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -314,7 +134,6 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
|         return super.onCreateOptionsMenu(menu); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public boolean onOptionsItemSelected(MenuItem item) { | ||||
|         if (item.getItemId() == R.id.item_settings) { | ||||
| @@ -325,6 +144,10 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
|             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) { | ||||
| @@ -334,59 +157,201 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * mapview的生命周期管理 | ||||
|      */ | ||||
|     @Override | ||||
|     protected void onStart() { | ||||
|         super.onStart(); | ||||
|         mapView.onStart(); | ||||
|     } | ||||
|  | ||||
|     @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; | ||||
|         mapView.onResume(); | ||||
|     } | ||||
|  | ||||
|     @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(); | ||||
|     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){ | ||||
|             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() { | ||||
|                         //打印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(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|      | ||||
|      | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,85 @@ | ||||
| package cc.winboll.studio.positions.activities; | ||||
|  | ||||
| /** | ||||
|  * @Author ZhanGSKen@AliYun.Com | ||||
|  * @Date 2025/02/24 12:14:04 | ||||
|  */ | ||||
| import androidx.appcompat.app.AppCompatActivity; | ||||
|  | ||||
| import android.content.Intent; | ||||
| import android.os.Bundle; | ||||
| import android.util.Log; | ||||
| import android.view.View; | ||||
|  | ||||
| import cc.winboll.studio.positions.R; | ||||
| import com.tencent.map.vector.demo.heatoverlay.ScatterPlotOverlayActivity; | ||||
| import com.tencent.tencentmap.mapsdk.maps.MapView; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TencentMap; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TencentMapOptions; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TextureMapView; | ||||
| import com.tencent.tencentmap.mapsdk.maps.model.LatLng; | ||||
|  | ||||
| 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(); | ||||
|     } | ||||
| } | ||||
| @@ -17,6 +17,9 @@ import androidx.annotation.NonNull; | ||||
| import android.graphics.Color; | ||||
| import android.widget.TextView; | ||||
| import cc.winboll.studio.positions.views.GridMapView; | ||||
| import com.tencent.tencentmap.mapsdk.maps.MapView; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TencentMap; | ||||
| import com.tencent.tencentmap.mapsdk.maps.TextureMapView; | ||||
|  | ||||
| public class GmsFragment extends Fragment { | ||||
|  | ||||
| @@ -24,7 +27,9 @@ public class GmsFragment extends Fragment { | ||||
|  | ||||
|     private static final String ARG_PAGE = "ARG_PAGE"; | ||||
|     private int mPage; | ||||
|  | ||||
|     private TextureMapView mapView; | ||||
|     protected TencentMap tencentMap; | ||||
|      | ||||
|     public static GmsFragment newInstance(int page) { | ||||
|         Bundle args = new Bundle(); | ||||
|         args.putInt(ARG_PAGE, page); | ||||
| @@ -47,19 +52,60 @@ public class GmsFragment extends Fragment { | ||||
|                              @Nullable Bundle savedInstanceState) { | ||||
|         View view = inflater.inflate(R.layout.fragment_gms, container, false); | ||||
|  | ||||
|         // 初始化视图 | ||||
|         GridMapView mapView = (GridMapView) view.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); | ||||
| //        // 初始化视图 | ||||
| //        GridMapView mapView = (GridMapView) view.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); | ||||
|          | ||||
|         // 初始化地图视图 | ||||
|         mapView = view.findViewById(R.id.mapView); | ||||
|         mapView.setOpaque(false); | ||||
|         //创建tencentMap地图对象,可以完成对地图的几乎所有操作 | ||||
|         tencentMap = mapView.getMap(); | ||||
|          | ||||
|         return view; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * 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(); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										11
									
								
								positions/src/main/res/drawable/ic_location_searching.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								positions/src/main/res/drawable/ic_location_searching.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| <?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> | ||||
							
								
								
									
										11
									
								
								positions/src/main/res/drawable/ic_my_location.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								positions/src/main/res/drawable/ic_my_location.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| <?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> | ||||
| @@ -5,23 +5,48 @@ | ||||
| 	xmlns:tools="http://schemas.android.com/tools" | ||||
| 	android:orientation="vertical" | ||||
| 	android:layout_width="match_parent" | ||||
| 	android:layout_height="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"/> | ||||
|  | ||||
| 	<androidx.viewpager.widget.ViewPager | ||||
| 	<RelativeLayout | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="0dp" | ||||
| 		android:layout_weight="1.0" | ||||
| 		android:id="@+id/activitymainViewPager1"/> | ||||
| 		android:layout_weight="1.0"> | ||||
|  | ||||
| 	<com.google.android.material.tabs.TabLayout | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="60dp" | ||||
| 		android:id="@+id/activitymainTabLayout1"/> | ||||
| 		<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_alignParentBottom="true" | ||||
| 			android:layout_alignParentEnd="true" | ||||
| 			android:layout_margin="16dp" | ||||
| 			android:src="@drawable/ic_location_searching" | ||||
| 			app:backgroundTint="@color/colorPrimary"/> | ||||
|  | ||||
| 	</RelativeLayout> | ||||
|  | ||||
| </LinearLayout> | ||||
|  | ||||
|   | ||||
							
								
								
									
										27
									
								
								positions/src/main/res/layout/activity_main2.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								positions/src/main/res/layout/activity_main2.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| <?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"> | ||||
|  | ||||
| 	<androidx.appcompat.widget.Toolbar | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="wrap_content" | ||||
| 		android:id="@+id/activitymainToolbar1"/> | ||||
|  | ||||
| 	<androidx.viewpager.widget.ViewPager | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="0dp" | ||||
| 		android:layout_weight="1.0" | ||||
| 		android:id="@+id/activitymainViewPager1"/> | ||||
|  | ||||
| 	<com.google.android.material.tabs.TabLayout | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="60dp" | ||||
| 		android:id="@+id/activitymainTabLayout1"/> | ||||
|  | ||||
| </LinearLayout> | ||||
|  | ||||
							
								
								
									
										14
									
								
								positions/src/main/res/layout/activity_testmapview.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								positions/src/main/res/layout/activity_testmapview.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| <?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> | ||||
| @@ -6,15 +6,10 @@ | ||||
| 	android:layout_width="match_parent" | ||||
| 	android:layout_height="match_parent"> | ||||
|  | ||||
|     <FrameLayout 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> | ||||
|     <com.tencent.tencentmap.mapsdk.maps.TextureMapView | ||||
|         android:id="@+id/mapView" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" /> | ||||
|  | ||||
| </LinearLayout> | ||||
|  | ||||
|   | ||||
| @@ -2,8 +2,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_mapview" | ||||
|         android:title="MapViewActivity"/> | ||||
|         android:id="@+id/item_testmapview" | ||||
|         android:title="TestMapViewActivity"/> | ||||
|     <item | ||||
|         android:id="@+id/item_demomain" | ||||
|         android:title="DemoMainActivity"/> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen