Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_freeworld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_freeworld
Commits
a0f71f23
Commit
a0f71f23
authored
Jul 10, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加卫星地图功能已完成
parent
b4294525
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
199 additions
and
29 deletions
+199
-29
compiler.xml
.idea/compiler.xml
+1
-1
runConfigurations.xml
.idea/runConfigurations.xml
+1
-0
build.gradle
app/build.gradle
+4
-0
BaiduLBS_AndroidSDK_Lib.aar
app/libs/BaiduLBS_AndroidSDK_Lib.aar
+0
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+22
-21
AppApplication.kt
app/src/main/java/com/mints/street/AppApplication.kt
+9
-1
MainActivity.kt
app/src/main/java/com/mints/street/main/MainActivity.kt
+12
-3
HomeFragment.kt
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
+127
-1
fragment_home.xml
app/src/main/res/layout/fragment_home.xml
+21
-0
icon_gcoding.png
app/src/main/res/mipmap-xxhdpi/icon_gcoding.png
+0
-0
water_drop.png
app/src/main/res/mipmap-xxhdpi/water_drop.png
+0
-0
version.properties
library_base/version.properties
+2
-2
No files found.
.idea/compiler.xml
View file @
a0f71f23
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<bytecodeTargetLevel
target=
"1
.8
"
/>
<bytecodeTargetLevel
target=
"1
1
"
/>
</component>
</project>
\ No newline at end of file
.idea/runConfigurations.xml
View file @
a0f71f23
...
...
@@ -3,6 +3,7 @@
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer"
/>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer"
/>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer"
/>
<option
value=
"org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer"
/>
...
...
app/build.gradle
View file @
a0f71f23
...
...
@@ -178,4 +178,8 @@ dependencies {
kapt
'com.cuieney:rxpay-compiler:2.1.1'
implementation
'com.romandanylyk:pageindicatorview:1.0.3'
implementation
(
name:
'BaiduLBS_AndroidSDK_Lib'
,
ext:
'aar'
)
}
\ No newline at end of file
app/libs/BaiduLBS_AndroidSDK_Lib.aar
0 → 100644
View file @
a0f71f23
File added
app/src/main/AndroidManifest.xml
View file @
a0f71f23
...
...
@@ -3,29 +3,23 @@
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.mints.street"
>
<
uses-permission
android:name=
"android.permission.INTERNET"
/
>
<uses-permission
android:name=
"android.permission.
READ_PHONE_STATE
"
/>
<
uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/
>
<uses-permission
android:name=
"android.permission.
READ_CONTACTS
"
/>
<
uses-permission
android:name=
"android.permission.ACCESS_BACKGROUND_LOCATION"
/
>
<
!-- 这个权限用于进行网络定位 --
>
<uses-permission
android:name=
"android.permission.
ACCESS_COARSE_LOCATION
"
/>
<
!-- 这个权限用于访问GPS定位 --
>
<uses-permission
android:name=
"android.permission.
ACCESS_FINE_LOCATION
"
/>
<
!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 --
>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<!-- 获取网络状态,根据网络状态切换进行数据请求网络转换 -->
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.CALL_PHONE"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.WAKE_LOCK"
/>
<uses-permission
android:name=
"android.permission.WRITE_SETTINGS"
/>
<uses-permission
android:name=
"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"
/>
<uses-permission
android:name=
"android.permission.PACKAGE_USAGE_STATS"
tools:ignore=
"ProtectedPermissions"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_USER_PRESENT"
/>
<uses-permission
android:name=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
/>
<uses-permission
android:name=
"android.permission.GET_TASKS"
/>
<uses-permission
android:name=
"android.permission.VIBRATE"
/>
<uses-permission
android:name=
"android.permission.CHANGE_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
/>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.SYSTEM_ALERT_WINDOW"
/>
<!-- 写外置存储。如果开发者使用了离线地图,并且数据写在外置存储区域,则需要申请该权限 -->
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- 读取外置存储。如果开发者使用了so动态加载功能并且把so文件放在了外置存储区域,则需要申请该权限,否则不需要 -->
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<!-- 访问网络,进行地图相关业务数据请求,包括地图数据,路线规划,POI检索等 -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 调用相机,用于实现扫描二维码,预览个性化地图编辑器生成的个性化地图样式(开发者实际开发中地图SDK不需要该权限)-->
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<application
android:name=
"com.mints.street.AppApplication"
...
...
@@ -64,6 +58,13 @@
<meta-data
android:name=
"Mob-AppSecret"
android:value=
"${SHARE_SECRET}"
/>
<meta-data
android:name=
"com.baidu.lbsapi.API_KEY"
android:value=
"SD6luBGzUFSVEZ3n9Xjk3xTsvDFmuRCi"
/>
<!--百度地图开放平台 -->
<!--百度地图开放平台 service-->
<service
android:name=
"com.baidu.location.f"
android:enabled=
"true"
android:process=
":remote"
/>
<activity
android:name=
"com.mints.street.splash.SplashActivity"
android:excludeFromRecents=
"true"
...
...
app/src/main/java/com/mints/street/AppApplication.kt
View file @
a0f71f23
package
com.mints.street
import
android.content.Context
import
android.os.StrictMode
import
android.os.StrictMode.VmPolicy
import
android.util.Log
import
com.baidu.mapapi.CoordType
import
com.baidu.mapapi.SDKInitializer
import
com.cuieney.rxpay_annotation.WX
import
com.fry.base.base.BaseApp
import
com.mints.street.manager.CsjGroMoreManager
...
...
@@ -46,6 +47,13 @@ class AppApplication : BaseApp() {
// GroMore
CsjGroMoreManager
.
init
(
this
)
//百度地图
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
// 默认本地个性化地图初始化方法
SDKInitializer
.
initialize
(
this
)
//自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
//包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
SDKInitializer
.
setCoordType
(
CoordType
.
BD09LL
)
}
companion
object
{
...
...
app/src/main/java/com/mints/street/main/MainActivity.kt
View file @
a0f71f23
package
com.mints.street.main
import
android.
media.AudioManager
import
android.
Manifest
import
android.os.Bundle
import
android.view.KeyEvent
import
android.view.View
...
...
@@ -15,10 +15,12 @@ import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.ActivityMainBinding
import
com.mints.street.main.vr.VRFragment
import
com.mints.street.main.my.MyFragment
import
com.mints.street.main.home.HomeFragment
import
com.mints.street.main.my.MyFragment
import
com.mints.street.main.vr.VRFragment
import
com.mints.street.manager.UmengManager
import
com.tbruyelle.rxpermissions2.RxPermissions
import
kotlinx.android.synthetic.main.layout_popupwindow.*
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.ToastUtils
...
...
@@ -58,6 +60,13 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
// test
UmengManager
.
initUm
()
val
rxPermissions
=
RxPermissions
(
this
)
rxPermissions
.
request
(
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
.
subscribe
{
}
}
var
oldTime
:
Long
=
0
...
...
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
a0f71f23
package
com.mints.street.main.home
import
android.graphics.Color
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
com.baidu.mapapi.map.*
import
com.baidu.mapapi.model.LatLng
import
com.baidu.mapapi.search.core.RecommendStopInfo
import
com.baidu.mapapi.search.recommendstop.OnGetRecommendStopResultListener
import
com.baidu.mapapi.search.recommendstop.RecommendStopResult
import
com.baidu.mapapi.search.recommendstop.RecommendStopSearch
import
com.baidu.mapapi.search.recommendstop.RecommendStopSearchOption
import
com.fry.base.base.BaseFragment
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.databinding.FragmentHomeBinding
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.RxUtils
/**
* Created by 冯瑞雨 on 2021/7/2.
* 首页页面
*/
class
HomeFragment
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>()
{
class
HomeFragment
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>(){
private
var
mBaiduMap
:
BaiduMap
?
=
null
private
val
mBitmapDescriptor
=
BitmapDescriptorFactory
.
fromResource
(
R
.
mipmap
.
icon_gcoding
)
private
var
mRecommendStopSearch
:
RecommendStopSearch
?
=
null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)=
R
.
layout
.
fragment_home
...
...
@@ -21,6 +41,112 @@ class HomeFragment:BaseFragment<FragmentHomeBinding,HomeViewModel>() {
override
fun
initData
()
{
super
.
initData
()
initMap
()
viewModel
.
add
()
}
private
fun
initMap
(){
mBaiduMap
=
binding
.
bmapView
.
map
mBaiduMap
?.
mapType
=
BaiduMap
.
MAP_TYPE_SATELLITE
binding
.
bmapView
.
showZoomControls
(
false
)
//设置是否显示缩放控件
// 构建地图状态
val
builder
=
MapStatus
.
Builder
()
// 默认 天安门
val
center
=
LatLng
(
39.915071
,
116.403907
)
// 默认 11级
val
zoom
=
11.0f
builder
.
target
(
center
).
zoom
(
zoom
)
val
mapStatusUpdate
=
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
())
// 设置地图状态
mBaiduMap
?.
setMapStatus
(
mapStatusUpdate
)
mBaiduMap
?.
setOnMapStatusChangeListener
(
object
:
BaiduMap
.
OnMapStatusChangeListener
{
override
fun
onMapStatusChangeStart
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动开始"
)
}
override
fun
onMapStatusChangeStart
(
status
:
MapStatus
?,
reason
:
Int
)
{
KLog
.
a
(
"百度map"
,
"移动开始,两个参数"
)
}
override
fun
onMapStatusChange
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动改变"
)
}
override
fun
onMapStatusChangeFinish
(
status
:
MapStatus
?)
{
KLog
.
a
(
"百度map"
,
"移动结束"
)
val
center
=
status
?.
target
mRecommendStopSearch
?.
requestRecommendStop
(
RecommendStopSearchOption
().
location
(
center
))
}
})
mBaiduMap
?.
setOnMapLoadedCallback
{
mRecommendStopSearch
?.
requestRecommendStop
(
RecommendStopSearchOption
().
location
(
center
))
}
//使地图缩放级别增大一级
binding
.
imageIn
.
setOnClickListener
{
mBaiduMap
?.
setMapStatus
(
MapStatusUpdateFactory
.
zoomIn
())
}
//使地图缩放级别减小一级
binding
.
imageOut
.
setOnClickListener
{
mBaiduMap
?.
setMapStatus
(
MapStatusUpdateFactory
.
zoomOut
())
}
mRecommendStopSearch
=
RecommendStopSearch
.
newInstance
()
mRecommendStopSearch
?.
setOnGetRecommendStopResultListener
(
object
:
OnGetRecommendStopResultListener
{
override
fun
onGetRecommendStopResult
(
result
:
RecommendStopResult
?)
{
if
(
result
!=
null
)
{
addMarkerToMap
(
result
.
recommendStopInfoList
)
}
}
})
}
override
fun
onPause
()
{
super
.
onPause
()
binding
.
bmapView
.
onPause
()
}
override
fun
onResume
()
{
super
.
onResume
()
binding
.
bmapView
.
onResume
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
mRecommendStopSearch
?.
destroy
()
binding
.
bmapView
.
onDestroy
()
}
/**
* 推荐上车点添加到地图上
* @param stops 推荐上车点列表
*/
private
fun
addMarkerToMap
(
stops
:
List
<
RecommendStopInfo
?
>?)
{
stops
?.
apply
{
mBaiduMap
?.
clear
()
for
(
stop
in
this
)
{
stop
?.
apply
{
val
textView
=
TextView
(
context
)
textView
.
text
=
stop
.
name
textView
.
setBackgroundColor
(
Color
.
WHITE
)
val
infoWindow
=
InfoWindow
(
textView
,
stop
.
location
,
-
47
)
val
markerOptions
=
MarkerOptions
()
markerOptions
.
icon
(
mBitmapDescriptor
).
position
(
stop
.
location
).
scaleX
(
0.5f
).
scaleY
(
0.5f
)
.
infoWindow
(
infoWindow
)
mBaiduMap
!!
.
addOverlay
(
markerOptions
)
}
}
}
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_home.xml
View file @
a0f71f23
...
...
@@ -11,6 +11,23 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<com.baidu.mapapi.map.MapView
android:id=
"@+id/bmapView"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
/>
<ImageView
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_centerInParent=
"true"
android:src=
"@mipmap/water_drop"
/>
<ImageView
android:layout_marginTop=
"15dp"
...
...
@@ -20,6 +37,7 @@
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:src=
"@mipmap/map_change_icon"
android:visibility=
"gone"
/>
<ImageView
android:layout_marginTop=
"15dp"
...
...
@@ -50,8 +68,10 @@
android:background=
"@drawable/shape_gold_card"
android:layout_marginEnd=
"2dp"
android:layout_marginBottom=
"10dp"
>
<ImageView
android:id=
"@+id/image_in"
android:padding=
"10dp"
android:layout_width=
"31dp"
android:layout_height=
"31dp"
...
...
@@ -65,6 +85,7 @@
android:background=
"@color/color_333"
/>
<ImageView
android:id=
"@+id/image_out"
android:padding=
"10dp"
android:layout_width=
"31dp"
android:layout_height=
"31dp"
...
...
app/src/main/res/mipmap-xxhdpi/icon_gcoding.png
0 → 100644
View file @
a0f71f23
4.32 KB
app/src/main/res/mipmap-xxhdpi/water_drop.png
0 → 100644
View file @
a0f71f23
2.99 KB
library_base/version.properties
View file @
a0f71f23
#
Fri Jul 09 20:05:14
CST 2021
VERSION_BUILD
=
2
725
#
Sat Jul 10 17:43:56
CST 2021
VERSION_BUILD
=
2
678
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment