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
9efbbe1d
Commit
9efbbe1d
authored
Aug 11, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改比例尺的位置
google页面添加热门景点弹出框
parent
49584319
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
73 additions
and
40 deletions
+73
-40
ItemHotViewAdapter.kt
.../main/java/com/mints/street/adapter/ItemHotViewAdapter.kt
+1
-1
GoogleMapFragment.kt
...java/com/mints/street/main/googlemap/GoogleMapFragment.kt
+22
-2
HomeFragment.kt
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
+7
-4
HomeViewModel.kt
...src/main/java/com/mints/street/main/home/HomeViewModel.kt
+2
-9
MintsWebViewActivity.kt
...ain/java/com/mints/street/webview/MintsWebViewActivity.kt
+4
-1
HotViewDialog.kt
...main/java/com/mints/street/widget/dialog/HotViewDialog.kt
+7
-6
activity_google_map.xml
app/src/main/res/layout/activity_google_map.xml
+20
-0
fragment_home.xml
app/src/main/res/layout/fragment_home.xml
+4
-14
item_hot_view_adapter.xml
app/src/main/res/layout/item_hot_view_adapter.xml
+5
-2
config.gradle
config.gradle
+1
-1
No files found.
app/src/main/java/com/mints/street/adapter/ItemHotViewAdapter.kt
View file @
9efbbe1d
...
...
@@ -43,7 +43,7 @@ class ItemHotViewAdapter(val context: Context, var list: List<HotViewBean.datasl
//否-跳转到开通vip界面
startActivity
(
OpenvipActivity
::
class
.
java
)
}
else
{
viewModel
.
authorized
(
list
?.
get
(
position
)
?.
name
,
list
?.
get
(
position
)
?.
lat
?.
toDouble
(),
list
?.
get
(
position
)
?.
lng
?.
toDouble
()
)
viewModel
.
authorized
(
list
?.
get
(
position
)
?.
name
,
list
?.
get
(
position
)
?.
lat
,
list
?.
get
(
position
)
?.
lng
)
}
}
}
...
...
app/src/main/java/com/mints/street/main/googlemap/GoogleMapFragment.kt
View file @
9efbbe1d
...
...
@@ -28,6 +28,8 @@ import com.mints.street.utils.GPSConverterUtils
import
com.mints.street.webview.MintsWebViewActivity
import
com.mints.street.widget.ScrollLayout
import
com.mints.street.widget.ScrollLayout.STATUS_CLOSE
import
com.mints.street.widget.dialog.DialogMapStyle
import
com.mints.street.widget.dialog.HotViewDialog
import
me.goldze.mvvmhabit.base.AppManager
import
me.goldze.mvvmhabit.utils.CommonDialogUtils
import
me.goldze.mvvmhabit.utils.KLog
...
...
@@ -43,6 +45,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
var
mLocationClient
:
LocationClient
?
=
null
private
val
myListener
:
MyLocationListener
=
MyLocationListener
()
private
var
isScrollLayoutClose
:
Boolean
=
false
//弹出框
private
var
dialogMapStyle
:
DialogMapStyle
?
=
null
private
var
gps
=
GPS
(
39.915121
,
116.403947
,
0
)
...
...
@@ -167,6 +171,21 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
RxUtils
.
onMultiClick
(
binding
.
stbBgSearch
)
{
SearchMapActivity
.
startSearchMapActivity
(
this
)
}
RxUtils
.
onMultiClick
(
binding
.
imageMapChangeIcon
)
{
context
?.
apply
{
if
(
dialogMapStyle
==
null
)
{
dialogMapStyle
=
DialogMapStyle
(
this
)
}
if
(
this
@GoogleMapFragment
.
fragmentManager
!=
null
)
{
dialogMapStyle
?.
show
(
this
@GoogleMapFragment
.
fragmentManager
!!
,
"dialogMapStyle"
)
}
}
}
//点击热门景点
RxUtils
.
onMultiClick
(
binding
.
lyHotview
)
{
HotViewDialog
(
requireActivity
(),
viewModel
,
0.0
,
0.0
,
this
@GoogleMapFragment
).
init
()
.
show
()
}
}
...
...
@@ -230,9 +249,10 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
super
.
initViewObservable
()
viewModel
.
authorizedBean
.
observe
(
this
,
Observer
{
it
?.
apply
{
binding
.
webview
.
loadUrl
(
"file:///android_asset/web/zsmap.html?u=${u
// binding.webview.loadUrl("file:///android_asset/web/zsmap.html?u=${u
// }&gk=${gk}&bk=${bk}&base=${base}&ut=${ut}")
binding
.
webview
.
loadUrl
(
"http://192.168.110.7:9999/z/zsmap.html?u=${u
}&
gk
=
$
{
gk
}&
bk
=
$
{
bk
}&
base
=
$
{
base
}&
ut
=
$
{
ut
}
")
KLog
.
e
(
"file:///android_asset/w"
)
}
})
viewModel
.
pt
.
observe
(
this
,
Observer
{
...
...
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
9efbbe1d
package
com.mints.street.main.home
import
android.content.Context.SENSOR_SERVICE
import
android.graphics.Point
import
android.hardware.Sensor
import
android.hardware.SensorEvent
import
android.hardware.SensorEventListener
...
...
@@ -143,10 +144,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
}
//点击热门景点
RxUtils
.
onMultiClick
(
binding
.
lyHotview
,
{
val
hotViewDialog
:
HotViewDialog
?=
HotViewDialog
(
requireActivity
(),
viewModel
,
currentLat
,
currentLon
,
this
)
hotViewDialog
?.
init
()
?.
show
()
})
RxUtils
.
onMultiClick
(
binding
.
lyHotview
)
{
HotViewDialog
(
requireActivity
(),
viewModel
,
currentLat
,
currentLon
,
this
).
init
().
show
()
}
viewModel
.
getMapBean
()
}
...
...
@@ -243,6 +243,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
}
//定位初始化
initLocation
()
// 设置比例尺控件的位置,必须在地图加载完成之后
Handler
().
postDelayed
({
binding
.
bmapView
.
scaleControlPosition
=
Point
(
20
,
60
)
},
500
)
}
/**
...
...
app/src/main/java/com/mints/street/main/home/HomeViewModel.kt
View file @
9efbbe1d
...
...
@@ -235,7 +235,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
)
}
fun
authorized
(
name
:
String
?,
lat
:
Double
?=
0.0
,
lng
:
Double
?=
0.0
)
{
fun
authorized
(
name
:
String
?,
lat
:
String
?
,
lng
:
String
?
)
{
ApiModel
.
authorized
().
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
AuthorizedBean
>>(
this
@HomeViewModel
,
false
...
...
@@ -243,14 +243,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
AuthorizedBean
>)
{
MintsWebViewActivity
.
startWebView
(
name
,
MintsWebViewActivity
.
toGoogleVR
(
response
.
result
.
u
,
response
.
result
.
gk
,
response
.
result
.
base
,
lat
.
toString
(),
lng
.
toString
(),
response
.
result
.
ut
)
MintsWebViewActivity
.
toBaduVR
(
lat
,
lng
,
response
.
result
?.
bk
)
)
}
...
...
app/src/main/java/com/mints/street/webview/MintsWebViewActivity.kt
View file @
9efbbe1d
...
...
@@ -23,6 +23,7 @@ import me.goldze.mvvmhabit.utils.KLog
class
MintsWebViewActivity
:
BaseActivity
<
ActivityMintsWebViewBinding
,
MintsWebViewModel
>()
{
companion
object
{
//打开地图的webView
fun
startWebView
(
name
:
String
?=
null
,
url
:
String
?=
null
){
AppManager
.
getAppManager
().
currentActivity
?.
apply
{
val
intent
=
Intent
(
this
,
MintsWebViewActivity
::
class
.
java
)
...
...
@@ -31,18 +32,20 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
this
.
startActivity
(
intent
)
}
}
//谷歌地址拼接
fun
toGoogleVR
(
u
:
String
?,
gk
:
String
?,
base
:
String
?,
lat
:
String
?,
lng
:
String
?,
ut
:
String
?):
String
{
KLog
.
i
(
"MintsWebViewActivity"
,
"file:///android_asset/web/streets.html?u=${u
}&
gk
=
$
{
gk
}&
base
=
$
{
base
}&
lat
=
$
{
lat
}&
lng
=
$
{
lng
}&
ut
=
$
{
ut
}
")
return
"file:///android_asset/web/streets.html?u=${u
}&
gk
=
$
{
gk
}&
base
=
$
{
base
}&
lat
=
$
{
lat
}&
lng
=
$
{
lng
}&
ut
=
$
{
ut
}
"
}
//地图上跳转百度的地址拼接
fun
toBaduVR
(
d
:
String
?,
bk
:
String
?):
String
{
KLog
.
i
(
"MintsWebViewActivity"
,
"file:///android_asset/web/mr.html?d=${d}&bk=${bk}"
)
return
"file:///android_asset/web/mr.html?d=${d}&bk=${bk}"
}
//其他的跳转百度的地址拼接
fun
toBaduVR
(
lat
:
String
?,
lng
:
String
?,
bk
:
String
?):
String
{
KLog
.
i
(
"MintsWebViewActivity"
,
"file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}"
)
return
"file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}"
}
...
...
app/src/main/java/com/mints/street/widget/dialog/HotViewDialog.kt
View file @
9efbbe1d
...
...
@@ -4,6 +4,7 @@ import android.graphics.Color
import
android.view.LayoutInflater
import
android.view.View
import
android.widget.ImageView
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentActivity
import
androidx.recyclerview.widget.DividerItemDecoration
import
androidx.recyclerview.widget.RecyclerView
...
...
@@ -16,12 +17,12 @@ import com.mints.street.main.home.HomeFragment
import
com.mints.street.main.home.HomeViewModel
import
com.mints.street.widget.GridItemDecoration
class
HotViewDialog
(
context
:
FragmentActivity
,
viewModel
:
HomeViewModel
,
mCurrentLat
:
Double
,
mCurrentLon
:
Double
,
homeFragment
:
Home
Fragment
)
{
class
HotViewDialog
(
context
:
FragmentActivity
,
viewModel
:
HomeViewModel
,
mCurrentLat
:
Double
,
mCurrentLon
:
Double
,
fragment
:
Fragment
)
{
private
var
mBottomSheetDialog
:
BottomSheetDialog
?
=
null
private
var
context
:
FragmentActivity
private
var
viewModel
:
HomeViewModel
?
=
null
private
var
homeFragment
:
Home
Fragment
?
=
null
private
var
fragment
:
Fragment
?
=
null
private
var
mCurrentLat
:
Double
?
=
null
private
var
mCurrentLon
:
Double
?
=
null
...
...
@@ -33,7 +34,7 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
init
{
this
.
context
=
context
this
.
viewModel
=
viewModel
this
.
homeFragment
=
homeF
ragment
this
.
fragment
=
f
ragment
this
.
mCurrentLat
=
mCurrentLat
this
.
mCurrentLon
=
mCurrentLon
}
...
...
@@ -53,15 +54,15 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
view1
.
findViewById
<
RecyclerView
>(
R
.
id
.
recycler_view
)
.
addItemDecoration
(
GridItemDecoration
(
context
,
DividerItemDecoration
.
VERTICAL
))
vLayout
=
VirtualLayoutManager
(
context
!!
);
vLayout
=
VirtualLayoutManager
(
context
)
mAdapter
=
DelegateAdapter
(
vLayout
,
false
)
recycler_view
.
layoutManager
=
vLayout
recycler_view
.
adapter
=
mAdapter
viewModel
?.
getHotView
()
viewModel
?.
hotviewData
?.
observe
(
homeF
ragment
!!
,
androidx
.
lifecycle
.
Observer
{
viewModel
?.
hotviewData
?.
observe
(
f
ragment
!!
,
androidx
.
lifecycle
.
Observer
{
if
(
itemHotViewAdapter
==
null
)
{
itemHotViewAdapter
=
ItemHotViewAdapter
(
context
!!
,
it
.
list
,
viewModel
!!
,
mCurrentLat
!!
,
mCurrentLon
!!
)
itemHotViewAdapter
=
ItemHotViewAdapter
(
context
,
it
.
list
,
viewModel
!!
,
mCurrentLat
!!
,
mCurrentLon
!!
)
mAdapter
?.
addAdapter
(
itemHotViewAdapter
)
}
mAdapter
?.
notifyDataSetChanged
()
...
...
app/src/main/res/layout/activity_google_map.xml
View file @
9efbbe1d
...
...
@@ -41,6 +41,26 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<ImageView
android:id=
"@+id/image_map_change_icon"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_marginBottom=
"220dp"
android:layout_marginTop=
"35dp"
android:src=
"@mipmap/map_change_icon"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<ImageView
android:id=
"@+id/ly_hotview"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:padding=
"3dp"
android:layout_marginTop=
"10dp"
android:src=
"@mipmap/icon_hotview"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/image_map_change_icon"
/>
<LinearLayout
android:id=
"@+id/map_a_d"
android:layout_width=
"31dp"
...
...
app/src/main/res/layout/fragment_home.xml
View file @
9efbbe1d
...
...
@@ -29,32 +29,22 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/bmapView"
/>
<ImageView
android:id=
"@+id/image_map_change"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_marginTop=
"15dp"
android:src=
"@mipmap/map_change_icon"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/image_map_history"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_marginTop=
"
1
5dp"
android:layout_marginTop=
"
2
5dp"
android:src=
"@mipmap/map_history_icon"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/image_map_change"
/>
app:layout_constraintTop_toBottomOf=
"@id/image_map_change
_icon
"
/>
<ImageView
android:id=
"@+id/ly_hotview"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:padding=
"3dp"
android:layout_marginTop=
"1
5
dp"
android:layout_marginTop=
"1
0
dp"
android:src=
"@mipmap/icon_hotview"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/image_map_change_icon"
/>
...
...
@@ -73,7 +63,7 @@
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_marginBottom=
"220dp"
android:layout_marginTop=
"
1
5dp"
android:layout_marginTop=
"
3
5dp"
android:src=
"@mipmap/map_change_icon"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
...
app/src/main/res/layout/item_hot_view_adapter.xml
View file @
9efbbe1d
...
...
@@ -50,7 +50,9 @@
android:textColor=
"@color/black"
android:textSize=
"18dp"
app:layout_constraintStart_toEndOf=
"@+id/image1"
app:layout_constraintTop_toTopOf=
"@+id/image1"
/>
app:layout_constraintTop_toTopOf=
"@+id/image1"
app:layout_constraintBottom_toTopOf=
"@id/line"
/>
<View
android:id=
"@+id/view"
...
...
@@ -76,6 +78,7 @@
tools:text=
"距离"
/>
<androidx.appcompat.widget.LinearLayoutCompat
android:id=
"@+id/line"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
...
...
@@ -91,7 +94,7 @@
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"5dp"
android
:text=
"景点介绍。。。"
tools
:text=
"景点介绍。。。"
android:textColor=
"#99000000"
android:textSize=
"12sp"
/>
...
...
config.gradle
View file @
9efbbe1d
...
...
@@ -13,7 +13,7 @@ ext {
minSdkVersion
:
21
,
targetSdkVersion
:
30
,
versionCode
:
1
,
versionName
:
"1.0.
0
"
,
versionName
:
"1.0.
1
"
,
]
java_version
=
[
...
...
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