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
baf8b446
Commit
baf8b446
authored
Jul 23, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
918b73af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
FeaturedExperienceFragment.kt
...va/com/mints/street/main/vr/FeaturedExperienceFragment.kt
+9
-1
FeaturedExperienceViewModel.kt
...a/com/mints/street/main/vr/FeaturedExperienceViewModel.kt
+30
-0
No files found.
app/src/main/java/com/mints/street/main/vr/FeaturedExperienceFragment.kt
View file @
baf8b446
...
@@ -3,6 +3,7 @@ package com.mints.street.main.vr
...
@@ -3,6 +3,7 @@ package com.mints.street.main.vr
import
android.os.Bundle
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
android.view.ViewGroup
import
androidx.lifecycle.Observer
import
com.alibaba.android.vlayout.DelegateAdapter
import
com.alibaba.android.vlayout.DelegateAdapter
import
com.alibaba.android.vlayout.VirtualLayoutManager
import
com.alibaba.android.vlayout.VirtualLayoutManager
import
com.fry.base.base.BaseFragment
import
com.fry.base.base.BaseFragment
...
@@ -39,7 +40,14 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
...
@@ -39,7 +40,14 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
layoutManager
=
vLayout
binding
.
listView
.
adapter
=
mAdapter
binding
.
listView
.
adapter
=
mAdapter
viewModel
.
vrPlaces
()
}
override
fun
initViewObservable
()
{
super
.
initViewObservable
()
viewModel
.
VrmapBean
.
observe
(
this
,
Observer
{
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
!!
,
false
,
it
.
abroad
))
mAdapter
?.
addAdapter
(
ItemEnterDestinationAdapter
(
context
!!
,
false
,
null
)
)
}
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/mints/street/main/vr/FeaturedExperienceViewModel.kt
View file @
baf8b446
package
com.mints.street.main.vr
package
com.mints.street.main.vr
import
android.app.Application
import
android.app.Application
import
androidx.lifecycle.MutableLiveData
import
com.mints.street.bean.BaseResponse
import
com.mints.street.bean.VrmapBean
import
com.mints.street.db.ScenicSpotBean
import
com.mints.street.model.ApiModel
import
com.mints.street.netwrok.base.HttpSubscribeImpl
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.base.BaseViewModel
import
me.goldze.mvvmhabit.utils.KLog
/**
/**
* Created by 冯瑞雨 on 2021/7/9.
* Created by 冯瑞雨 on 2021/7/9.
*/
*/
class
FeaturedExperienceViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
class
FeaturedExperienceViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
//获取vr街景数据
val
VrmapBean
:
MutableLiveData
<
VrmapBean
>
=
MutableLiveData
()
fun
vrPlaces
(){
//无参数传递
ApiModel
.
vrPlaces
(
lifecycleProvider
).
safeSubscribe
(
object
:
HttpSubscribeImpl
<
BaseResponse
<
VrmapBean
>>(
this
@FeaturedExperienceViewModel
,
true
){
override
fun
onBusinessSuccess
(
response
:
BaseResponse
<
VrmapBean
>)
{
VrmapBean
.
value
=
response
.
result
val
a
:
MutableList
<
ScenicSpotBean
>
=
ArrayList
()
for
(
item
in
response
.
result
.
internal
!!
){
a
.
add
(
ScenicSpotBean
(
name
=
item
.
name
,
url
=
item
.
url
,
starRating
=
item
.
stars
,
images
=
item
.
img
)
)
}
}
override
fun
onError
(
e
:
Throwable
)
{
KLog
.
e
(
"vrPlaces"
,
"请求失败 : $e"
)
}
}
)
}
}
}
\ No newline at end of file
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