Commit 8bdad791 authored by 张释方's avatar 张释方

Merge branch 'dev_1.0.0' of http://gitlab.mints-id.com/android/android_street into branche_zsf

parents 494c548a baf8b446
......@@ -3,6 +3,7 @@ package com.mints.street.main.vr
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.lifecycle.Observer
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.fry.base.base.BaseFragment
......@@ -39,7 +40,14 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
binding.listView.layoutManager = vLayout
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
package com.mints.street.main.vr
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.utils.KLog
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment