Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
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_street
Commits
f488b893
Commit
f488b893
authored
Jul 31, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
谷歌和百度地图回调该gps定位功能已完成
parent
2de53ea8
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
95 additions
and
67 deletions
+95
-67
GridMapAdapter.kt
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
+9
-11
GridVrMapAdapter.kt
...rc/main/java/com/mints/street/adapter/GridVrMapAdapter.kt
+7
-2
GoogleMapFragment.kt
...java/com/mints/street/main/googlemap/GoogleMapFragment.kt
+6
-2
HomeFragment.kt
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
+4
-2
HomeViewModel.kt
...src/main/java/com/mints/street/main/home/HomeViewModel.kt
+3
-10
SearchAfterItem.kt
...c/main/java/com/mints/street/main/home/SearchAfterItem.kt
+2
-18
DetailedActivity.kt
...rc/main/java/com/mints/street/main/vr/DetailedActivity.kt
+1
-1
DetailedViewModel.kt
...c/main/java/com/mints/street/main/vr/DetailedViewModel.kt
+25
-0
FeaturedExperienceFragment.kt
...va/com/mints/street/main/vr/FeaturedExperienceFragment.kt
+10
-7
FreeZoneFragment.kt
...rc/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
+11
-6
RatingStar.java
app/src/main/java/com/mints/street/widget/RatingStar.java
+3
-0
activity_google_map.xml
app/src/main/res/layout/activity_google_map.xml
+12
-8
fragment_home.xml
app/src/main/res/layout/fragment_home.xml
+2
-0
No files found.
app/src/main/java/com/mints/street/adapter/GridMapAdapter.kt
View file @
f488b893
...
...
@@ -14,9 +14,11 @@ import com.fry.base.binding.setMargin
import
com.mints.street.R
import
com.mints.street.bean.VrmapBean
import
com.mints.street.databinding.ItemGridMapAdapterBinding
import
com.mints.street.main.vr.PanoramicActivity
import
com.mints.street.webview.MintsWebViewActivity
import
me.goldze.mvvmhabit.utils.AppUtils
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.RxUtils
/**
* Created by 冯瑞雨 on 2021/7/9.
...
...
@@ -24,7 +26,6 @@ import me.goldze.mvvmhabit.utils.KLog
class
GridMapAdapter
(
val
context
:
Context
,
var
list
:
List
<
VrmapBean
.
Internal
>?)
:
AbstractVLayoutBaseAdapter
<
ItemGridMapAdapterBinding
,
List
<
VrmapBean
.
Internal
>>(
context
,
list
,
2
)
{
private
var
datalist
:
List
<
VrmapBean
.
Internal
>?
=
list
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemGridMapAdapterBinding
>,
position
:
Int
...
...
@@ -38,23 +39,20 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
AppUtils
.
dp2Px
(
context
,
20F
),
0
,
null
,
null
,
null
)
}
datalist
?.
let
{
var
databean
=
it
[
position
]
list
?.
get
(
position
)
?.
apply
{
//设置图片
Glide
.
with
(
mContext
).
load
(
databean
.
img
).
into
(
holder
.
binding
.
image
)
Glide
.
with
(
mContext
).
load
(
img
).
into
(
holder
.
binding
.
image
)
//设置标题
holder
.
binding
.
tvName
.
text
=
databean
.
name
holder
.
binding
.
tvName
.
text
=
name
//设置点击跳转
holder
.
itemView
.
setOnClickListener
{
RxUtils
.
onMultiClick
(
holder
.
itemView
)
{
//页面跳转
MintsWebViewActivity
.
startWebView
(
databean
.
name
,
url
=
databean
.
url
)
MintsWebViewActivity
.
startWebView
(
name
,
url
=
url
)
}
holder
.
binding
.
llstart
.
setNumber
(
stars
?.
toInt
()
?:
5
)
}
// RxUtils.onMultiClick(holder.binding.bg) {
// PanoramicActivity.starPanoramicActivity(context, ""
// , PanoramicActivity.WGS84, lat = 39.906283536127169, lon = 116.39129554889048)
// }
}
...
...
app/src/main/java/com/mints/street/adapter/GridVrMapAdapter.kt
View file @
f488b893
...
...
@@ -15,9 +15,11 @@ import com.fry.base.utils.ImageLoader
import
com.mints.street.R
import
com.mints.street.bean.DetailedBean
import
com.mints.street.databinding.ItemGridVrmapAdapterBinding
import
com.mints.street.main.vr.DetailedViewModel
import
me.goldze.mvvmhabit.utils.AppUtils
import
me.goldze.mvvmhabit.utils.RxUtils
class
GridVrMapAdapter
(
val
context
:
Context
,
var
list
:
List
<
DetailedBean
.
DetailedItemBean
>?)
:
class
GridVrMapAdapter
(
val
context
:
Context
,
var
list
:
List
<
DetailedBean
.
DetailedItemBean
>?
,
val
viewModel
:
DetailedViewModel
)
:
AbstractVLayoutBaseAdapter
<
ItemGridVrmapAdapterBinding
,
List
<
DetailedBean
.
DetailedItemBean
>>(
context
,
list
,
2
)
{
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemGridVrmapAdapterBinding
>,
...
...
@@ -39,10 +41,13 @@ class GridVrMapAdapter(val context: Context, var list: List<DetailedBean.Detaile
ImageLoader
.
ImageBuilder
.
with
(
context
)
.
setUrl
(
it
[
position
].
img
).
setTargetView
(
holder
.
binding
.
image
).
start
()
}
RxUtils
.
onMultiClick
(
holder
.
binding
.
bg
){
viewModel
.
authorized
(
list
?.
get
(
position
)
?.
name
,
list
?.
get
(
position
)
?.
lat
,
list
?.
get
(
position
)
?.
lng
)
}
}
override
fun
getItemCount
()
=
list
!!
.
size
override
fun
getItemCount
()
=
list
?.
size
?:
0
override
fun
onCreateLayoutHelper
():
LayoutHelper
{
val
hp
:
GridLayoutHelper
=
GridLayoutHelper
(
2
)
...
...
app/src/main/java/com/mints/street/main/googlemap/GoogleMapFragment.kt
View file @
f488b893
...
...
@@ -139,7 +139,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
binding
.
click
.
setOnClickListener
{
binding
.
imageLocationIcon
.
setOnClickListener
{
initZsMap
()
}
RxUtils
.
onMultiClick
(
binding
.
stbBgSearch
)
{
...
...
@@ -213,8 +213,12 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
KLog
.
e
(
"file:///android_asset/w"
)
}
})
viewModel
.
pt
.
observe
(
this
,
Observer
{
binding
.
webview
.
callHandler
(
"initZsMap"
,
Gson
().
toJson
(
it
)
)
{
}
})
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
...
...
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
f488b893
...
...
@@ -27,6 +27,7 @@ import com.mints.street.R
import
com.mints.street.bean.PositioningBean
import
com.mints.street.databinding.FragmentHomeBinding
import
com.mints.street.manager.UmengManager
import
com.mints.street.utils.GPSConverterUtils
import
com.mints.street.webview.MintsWebViewActivity
import
com.mints.street.widget.ScrollLayout
import
me.goldze.mvvmhabit.base.AppManager
...
...
@@ -111,10 +112,11 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
}
override
fun
initViewObservable
()
{
viewModel
.
pt
.
observe
(
this
,
Observer
<
Map
<
String
,
Double
>>
{
viewModel
.
pt
.
observe
(
this
,
Observer
{
if
(
it
==
null
)
return
@Observer
// 默认 天安门
val
center
=
LatLng
(
it
[
"latitude"
]
?:
39.915071
,
it
[
"longitude"
]
?:
116.403907
)
val
gps
=
GPSConverterUtils
.
gcj02_To_Bd09
(
it
.
lat
,
it
.
lng
)
val
center
=
LatLng
(
gps
.
lat
,
gps
.
lng
)
setNewMapStatus
(
center
)
binding
.
scrollLayout
.
toggle
(
ScrollLayout
.
STATUS_DEFAULT
)
})
...
...
app/src/main/java/com/mints/street/main/home/HomeViewModel.kt
View file @
f488b893
...
...
@@ -7,10 +7,7 @@ import androidx.lifecycle.MutableLiveData
import
com.google.gson.Gson
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.bean.AuthorizedBean
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.MapBean
import
com.mints.street.bean.VipBean
import
com.mints.street.bean.*
import
com.mints.street.common.DeviceInfo
import
com.mints.street.manager.oaid.OaidManager
import
com.mints.street.model.ApiModel
...
...
@@ -34,7 +31,7 @@ class HomeViewModel(application: Application):BaseViewModel(application) {
var
addressList
=
ObservableArrayList
<
HomeButtonItemVM
?>()
var
addressItemBinding
=
ItemBinding
.
of
<
HomeButtonItemVM
>(
BR
.
viewModel
,
R
.
layout
.
item_home_button
)
var
pt
=
MutableLiveData
<
Map
<
String
,
Double
>
>()
var
pt
=
MutableLiveData
<
GPS
>()
val
authorizedBean
=
MutableLiveData
<
AuthorizedBean
>()
...
...
@@ -116,12 +113,8 @@ class HomeViewModel(application: Application):BaseViewModel(application) {
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
if
(
requestCode
==
200
&&
resultCode
==
SearchMapActivity
.
REQUEST_CODE
){
KLog
.
a
(
"homeFragment onActivityResult"
)
data
?.
let
{
val
map
=
HashMap
<
String
,
Double
>(
2
)
map
[
"latitude"
]
=
it
.
getDoubleExtra
(
"latitude"
,
0.0
)
map
[
"longitude"
]
=
it
.
getDoubleExtra
(
"longitude"
,
0.0
)
pt
.
value
=
map
pt
.
value
=
GPS
(
it
.
getDoubleExtra
(
"latitude"
,
0.0
),
it
.
getDoubleExtra
(
"longitude"
,
0.0
))
}
}
}
...
...
app/src/main/java/com/mints/street/main/home/SearchAfterItem.kt
View file @
f488b893
...
...
@@ -22,26 +22,10 @@ class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
*/
val
onClick
=
BindingCommand
<
Any
>(
BindingAction
{
viewModel
.
searchName
.
value
=
HistoryBean
(
name
=
this
.
name
,
latitude
=
pt
?.
lat
,
longitude
=
pt
?.
l
at
)
latitude
=
pt
?.
lat
,
longitude
=
pt
?.
l
ng
)
val
intent
=
Intent
()
intent
.
putExtra
(
"latitude"
,
pt
?.
lat
)
intent
.
putExtra
(
"longitude"
,
pt
?.
l
at
)
intent
.
putExtra
(
"longitude"
,
pt
?.
l
ng
)
viewModel
.
finishData
(
SearchMapActivity
.
REQUEST_CODE
,
intent
)
})
}
/*class SearchAfterItem(viewModel: SearchMapViewModel,val name:String?
, val address:String?,val pt: LatLng?=null) :
ItemViewModel<SearchMapViewModel>(viewModel) {
*//***
* 点击名称回调回调
*//*
val onClick = BindingCommand<Any>(BindingAction {
viewModel.searchName.value = HistoryBean(name = this.name,
latitude = pt?.latitude,longitude = pt?.longitude)
//不带参数、不跳转
// val intent = Intent()
// intent.putExtra("latitude",pt?.latitude)
// intent.putExtra("longitude",pt?.longitude)
// viewModel.finishData(SearchMapActivity.REQUEST_CODE,intent)
})
}*/
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/DetailedActivity.kt
View file @
f488b893
...
...
@@ -61,7 +61,7 @@ class DetailedActivity : BaseActivity<ActivityDetailedBinding, DetailedViewModel
super
.
initViewObservable
()
viewModel
.
detailbean
.
observe
(
this
,
Observer
{
if
(
gridVrMapAdapter
==
null
){
gridVrMapAdapter
=
GridVrMapAdapter
(
this
,
it
.
list
)
gridVrMapAdapter
=
GridVrMapAdapter
(
this
,
it
.
list
,
viewModel
)
mAdapter
?.
addAdapter
(
gridVrMapAdapter
)
}
gridVrMapAdapter
?.
list
=
it
.
list
...
...
app/src/main/java/com/mints/street/main/vr/DetailedViewModel.kt
View file @
f488b893
...
...
@@ -2,11 +2,14 @@ package com.mints.street.main.vr
import
android.app.Application
import
androidx.lifecycle.MutableLiveData
import
com.google.gson.Gson
import
com.mints.street.bean.AuthorizedBean
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.DetailedBean
import
com.mints.street.bean.VipBean
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
com.mints.street.webview.MintsWebViewActivity
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.utils.KLog
import
java.util.HashMap
...
...
@@ -15,6 +18,7 @@ class DetailedViewModel(application: Application) : BaseViewModel(application) {
val
detailbean
:
MutableLiveData
<
DetailedBean
>
=
MutableLiveData
()
fun
getChooseExperienceData
(
name
:
String
){
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"area"
]
=
name
...
...
@@ -32,4 +36,25 @@ class DetailedViewModel(application: Application) : BaseViewModel(application) {
}
)
}
fun
authorized
(
name
:
String
?,
lat
:
Double
?=
0.0
,
lng
:
Double
?=
0.0
)
{
ApiModel
.
authorized
().
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
AuthorizedBean
>>(
this
@DetailedViewModel
,
false
)
{
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
)
)
}
})
}
}
app/src/main/java/com/mints/street/main/vr/FeaturedExperienceFragment.kt
View file @
f488b893
...
...
@@ -39,11 +39,21 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
binding
.
srlMy
.
setOnRefreshListener
{
//获取VR全景数据
viewModel
.
getChooseExperienceHeadData
()
}
viewModel
.
getChooseExperienceHeadData
()
}
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
viewModel
.
VreperienceBean
.
observe
(
this
,
Observer
{
binding
.
srlMy
.
finishRefresh
(
true
)
// mAdapter?.addAdapter(ItemEnterDestinationAdapter(context!!, false,it.abroad))
if
(
itemEnterDestinationAdapter
==
null
){
itemEnterDestinationAdapter
=
ItemEnterDestinationAdapter
(
context
!!
,
false
,
it
.
data
)
...
...
@@ -53,11 +63,4 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
mAdapter
?.
notifyDataSetChanged
()
})
}
override
fun
onResume
()
{
super
.
onResume
()
// viewModel.vrPlaces()
//设置数据请求
viewModel
.
getChooseExperienceHeadData
()
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/FreeZoneFragment.kt
View file @
f488b893
...
...
@@ -13,6 +13,9 @@ import com.mints.street.adapter.EnterDestinationAdapter
import
com.mints.street.adapter.GridMapAdapter
import
com.mints.street.bean.VrmapBean
import
com.mints.street.databinding.FragmentFreeZoneBinding
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
me.goldze.mvvmhabit.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/9.
...
...
@@ -22,7 +25,6 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
private
var
vLayout
:
VirtualLayoutManager
?
=
null
private
var
mAdapter
:
DelegateAdapter
?
=
null
private
var
gridMapAdapter
:
GridMapAdapter
?
=
null
// private var enterDestinationAdapter: EnterDestinationAdapter? = null
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
...
...
@@ -31,11 +33,6 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
onResume
()
{
super
.
onResume
()
//获取VR全景数据
viewModel
.
vrPlaces
()
}
override
fun
initData
()
{
super
.
initData
()
...
...
@@ -47,12 +44,20 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
binding
.
srlMy
.
autoRefresh
()
//自动刷新
binding
.
srlMy
.
setOnRefreshListener
{
//获取VR全景数据
viewModel
.
vrPlaces
()
}
viewModel
.
vrPlaces
()
}
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
viewModel
.
VrmapBean
.
observe
(
this
,
Observer
<
VrmapBean
>
{
binding
.
srlMy
.
finishRefresh
(
true
)
/*if(enterDestinationAdapter == null){
enterDestinationAdapter = EnterDestinationAdapter(context!!,it.abroad )
mAdapter?.addAdapter(enterDestinationAdapter)
...
...
app/src/main/java/com/mints/street/widget/RatingStar.java
View file @
f488b893
...
...
@@ -53,6 +53,9 @@ public class RatingStar extends View {
i0
=
-
1
;
}
public
void
setNumber
(
int
number
){
this
.
number
=
number
;
}
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
...
...
app/src/main/res/layout/activity_google_map.xml
View file @
f488b893
...
...
@@ -14,19 +14,23 @@
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
android:
padding
Bottom=
"40dp"
android:
layout_margin
Bottom=
"40dp"
android:id=
"@+id/webview"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
/>
<Button
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:id=
"@+id/click"
android:layout_width=
"wrap_content"
android:layout_height=
"100dp"
android:text=
"点击"
<ImageView
android:id=
"@+id/image_location_icon"
android:layout_width=
"42dp"
android:layout_height=
"42dp"
android:layout_marginTop=
"125dp"
android:layout_marginEnd=
"6dp"
android:src=
"@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf=
"@+id/webview"
app:layout_constraintTop_toTopOf=
"@id/webview"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<com.mints.street.widget.ScrollLayout
android:id=
"@+id/scroll_layout"
...
...
app/src/main/res/layout/fragment_home.xml
View file @
f488b893
...
...
@@ -39,6 +39,8 @@
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:visibility=
"gone"
android:id=
"@+id/image_map_history"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
...
...
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