Commit ee9f7189 authored by 张释方's avatar 张释方

提交精选体验以及进入目的地接口

parent c0644d67
package com.mints.street.adapter
import android.content.Context
import android.content.Intent
import android.view.View
import androidx.core.content.ContextCompat.startActivity
import androidx.databinding.ObservableArrayList
import androidx.databinding.ObservableList
import androidx.databinding.ViewDataBinding
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.bean.VreperienceBean
import com.mints.street.bean.VrmapBean
import com.mints.street.databinding.EnterDestinationAdapterBinding
import com.mints.street.main.vr.DetailedActivity
import com.mints.street.main.vr.FreeZoneViewModel
import com.mints.street.webview.MintsWebViewActivity
import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter
import me.tatarka.bindingcollectionadapter2.ItemBinding
/**
* Created by 冯瑞雨 on 2021/7/9.
*/
class EnterDestinationAdapter(val context: Context,val bean :List<VrmapBean.Abroad>?):
AbstractVLayoutBaseAdapter<EnterDestinationAdapterBinding, List<VrmapBean.Abroad>?>(context,bean,1) {
class EnterDestinationAdapter(val context: Context,val bean :List<VreperienceBean.Data>?):
AbstractVLayoutBaseAdapter<EnterDestinationAdapterBinding, List<VreperienceBean.Data>?>(context,bean,1) {
private var vLayout: VirtualLayoutManager? = null
......@@ -42,7 +30,7 @@ class EnterDestinationAdapter(val context: Context,val bean :List<VrmapBean.Abro
holder.binding.listView.layoutManager = vLayout
holder.binding.listView.adapter = mAdapter
mAdapter?.addAdapter(ItemEnterDestinationAdapter(context,true,bean))
mAdapter?.addAdapter(ItemEnterDestinationAdapter(context,true,bean!!))
}
......
......@@ -11,12 +11,14 @@ import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.fry.base.binding.setMargin
import com.fry.base.utils.ImageLoader
import com.mints.street.R
import com.mints.street.bean.DetailedBean
import com.mints.street.databinding.ItemGridVrmapAdapterBinding
import me.goldze.mvvmhabit.utils.AppUtils
class GridVrMapAdapter(val context: Context, var list: List<String>?) :
AbstractVLayoutBaseAdapter<ItemGridVrmapAdapterBinding, List<String>>(context, list, 2) {
class GridVrMapAdapter(val context: Context, var list: List<DetailedBean.DetailedItemBean>?) :
AbstractVLayoutBaseAdapter<ItemGridVrmapAdapterBinding, List<DetailedBean.DetailedItemBean>>(context, list, 2) {
override fun onBindViewHolder(
holder: BindingViewHolder<ItemGridVrmapAdapterBinding>,
position: Int
......@@ -31,6 +33,13 @@ class GridVrMapAdapter(val context: Context, var list: List<String>?) :
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 6F), AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F),
0, null, null, null)
}
list?.let { it ->
holder.binding.tvName.text = it[position].name
ImageLoader.ImageBuilder.with(context)
.setUrl(it[position].img).setTargetView(holder.binding.image).start()
}
}
override fun getItemCount() = list!!.size
......
......@@ -7,9 +7,11 @@ import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.fry.base.utils.ImageLoader
import com.mints.street.R
import com.mints.street.bean.VrmapBean
import com.mints.street.bean.VreperienceBean
import com.mints.street.databinding.ItemEnterDestinationAdapterBinding
import com.mints.street.main.vr.DetailedActivity
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
/**
......@@ -19,8 +21,8 @@ import com.mints.street.main.vr.DetailedActivity
class ItemEnterDestinationAdapter(
val context: Context,
private val isMultipleLayout: Boolean,
var list: List<VrmapBean.Abroad>?
) : AbstractVLayoutBaseAdapter<ItemEnterDestinationAdapterBinding, List<VrmapBean.Abroad>?>(
var list: List<VreperienceBean.Data>?
) : AbstractVLayoutBaseAdapter<ItemEnterDestinationAdapterBinding, List<VreperienceBean.Data>?>(
context,
list,
1
......@@ -36,19 +38,23 @@ class ItemEnterDestinationAdapter(
} else {
bgLayoutParams.width = a.widthPixels
}
holder.itemView.setOnClickListener {
RxUtils.onMultiClick(holder.itemView
){
var intent = Intent(context, DetailedActivity::class.java)
intent.putExtra("area",list?.get(position)?.area)
context.startActivity(intent)
}
list?.let { it ->
holder.binding.tvName.text = it[position].name
holder.binding.tvName.text = it[position].area
holder.binding.tvNumberPeople.text = "人数"
it[position].img?.let { url ->
for (index in it.indices) {
it[position].url?.let { url ->
KLog.e("zsf__","==========${it.indices}")
for (index in 0..2) {
when (index) {
0 -> {
ImageLoader.ImageBuilder.with(context)
.setUrl(url[index]).setTargetView(holder.binding.image1).start()
.setUrl(url[index]).setTargetView(holder.binding.image3).start()
}
1 -> {
ImageLoader.ImageBuilder.with(context)
......@@ -56,7 +62,7 @@ class ItemEnterDestinationAdapter(
}
2 -> {
ImageLoader.ImageBuilder.with(context)
.setUrl(url[index]).setTargetView(holder.binding.image3).start()
.setUrl(url[index]).setTargetView(holder.binding.image1).start()
}
}
......
......@@ -122,12 +122,12 @@ interface MainApi {
* 精选体验展示图
*/
@POST("na/getChooseExperienceHeadData")
fun getChooseExperienceHeadData(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<Any>>>
fun getChooseExperienceHeadData(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<VreperienceBean>>>
/**
* 精选体验详情
*/
@POST("na/getChooseExperienceData")
fun getChooseExperienceData(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<Any>>>
fun getChooseExperienceData(@Body vo:@JvmSuppressWildcards Map<String,Any>):Observable<Response<BaseResponse<DetailedBean>>>
}
\ No newline at end of file
......@@ -6,9 +6,16 @@ import java.util.List;
* Created by goldze on 2017/5/10.
* 该类仅供参考,实际业务返回的固定字段, 根据需求来定义,
*/
public class BaseArrayResponse<T> {
public class BaseArrayResponse<T> extends BaseResponse<List<T>>{
@Override
public List<T> getResult() {
return result;
}
@Override
public void setResult(List<T> result) {
this.result = result;
}
}
}
......@@ -18,7 +18,7 @@ public class BaseResponse<T> implements Serializable {
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
@SerializedName("data")
private @Nullable T result;
protected @Nullable T result;
@SerializedName("result")
private @Nullable List<T> resultList;
......
package com.mints.street.bean
import java.io.Serializable
class DetailedBean : Serializable {
val desc: String?=null
val list: List<DetailedItemBean>?=null
inner class DetailedItemBean: Serializable {
val img: String?=null
val lat: Double=0.0
val lng: Double=0.0
val name: String?=null
}
}
package com.mints.street.bean
import java.io.Serializable
class VreperienceBean: Serializable {
val data: List<Data>?=null
inner class Data(
val area: String,
val url: List<String>
)
}
......@@ -21,8 +21,10 @@ 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.oaid.OaidManager
import com.mints.street.utils.encry.AESUtils
import com.tbruyelle.rxpermissions2.RxPermissions
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.ToastUtils
......@@ -77,6 +79,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
)
.subscribe {
}
}
......
package com.mints.street.main.vr
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.lifecycle.Observer
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.adapter.GridMapAdapter
import com.mints.street.adapter.GridVrMapAdapter
import com.mints.street.adapter.ItemEnterDestinationAdapter
import com.mints.street.databinding.ActivityDetailedBinding
import com.mints.street.databinding.ActivityMoresettingsBinding
import com.mints.street.main.my.MoresettingsViewModel
import kotlinx.android.synthetic.main.activity_detailed.*
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class DetailedActivity : BaseActivity<ActivityDetailedBinding, DetailedViewModel>(), View.OnClickListener {
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_detailed
private var myintent: Intent? =null
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
private var gridVrMapAdapter: GridVrMapAdapter? = null
......@@ -48,13 +44,6 @@ class DetailedActivity : BaseActivity<ActivityDetailedBinding, DetailedViewModel
binding.listview.layoutManager = vLayout
binding.listview.adapter = mAdapter
if (gridVrMapAdapter == null) {
gridVrMapAdapter = GridVrMapAdapter(this,
listOf("1", "2", "3", "1", "2", "3", "1", "2", "3", "1", "2", "3", "1", "2", "3"))
KLog.e("aaa", "${this.window.decorView.width.toFloat()}")
mAdapter?.addAdapter(gridVrMapAdapter)
mAdapter?.notifyDataSetChanged()
}
}
......@@ -64,19 +53,21 @@ class DetailedActivity : BaseActivity<ActivityDetailedBinding, DetailedViewModel
override fun onResume() {
super.onResume()
viewModel.getChooseExperienceData()
myintent =getIntent();
viewModel.getChooseExperienceData(myintent?.getStringExtra("area")!!)
}
override fun initViewObservable() {
super.initViewObservable()
// viewModel.VrmapBean.observe(this, Observer {
//// mAdapter?.addAdapter(ItemEnterDestinationAdapter(context!!, false,it.abroad))
// if (gridVrMapAdapter == null){
// gridVrMapAdapter = ItemEnterDestinationAdapter(context!!, false,it.abroad)
// mAdapter?.addAdapter(gridVrMapAdapter)
// }
// gridVrMapAdapter?.list = it.abroad
// mAdapter?.notifyDataSetChanged()
// })
viewModel.detailbean.observe(this, Observer {
if (gridVrMapAdapter == null){
gridVrMapAdapter = GridVrMapAdapter(this, it.list)
mAdapter?.addAdapter(gridVrMapAdapter)
}
gridVrMapAdapter?.list = it.list
mAdapter?.notifyDataSetChanged()
binding.tvIntroduce.text=it.desc
binding.tvName.text=myintent?.getStringExtra("area")!!
})
}
}
\ 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.DetailedBean
import com.mints.street.bean.VipBean
import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl
import me.goldze.mvvmhabit.base.BaseViewModel
......@@ -9,13 +12,17 @@ import me.goldze.mvvmhabit.utils.KLog
import java.util.HashMap
class DetailedViewModel(application: Application) : BaseViewModel(application) {
fun getChooseExperienceData(){
val detailbean: MutableLiveData<DetailedBean> = MutableLiveData()
fun getChooseExperienceData(name:String){
val vo = HashMap<String, Any>()
vo["area"] = "北京"
vo["area"] = name
ApiModel.getChooseExperienceData(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
object : HttpSubscribeImpl<BaseResponse<DetailedBean>>(
this@DetailedViewModel,true){
override fun onBusinessSuccess(response: BaseResponse<Any>) {
override fun onBusinessSuccess(response: BaseResponse<DetailedBean>) {
detailbean.value=response.result
KLog.e("getChooseExperienceData","成功=================")
}
......
......@@ -9,8 +9,6 @@ import com.alibaba.android.vlayout.VirtualLayoutManager
import com.fry.base.base.BaseFragment
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.adapter.EnterDestinationAdapter
import com.mints.street.adapter.GridMapAdapter
import com.mints.street.adapter.ItemEnterDestinationAdapter
import com.mints.street.databinding.FragmentFeaturedExperienceBinding
......@@ -45,13 +43,13 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
override fun initViewObservable() {
super.initViewObservable()
viewModel.VrmapBean.observe(this, Observer {
viewModel.VreperienceBean.observe(this, Observer {
// mAdapter?.addAdapter(ItemEnterDestinationAdapter(context!!, false,it.abroad))
if (itemEnterDestinationAdapter == null){
itemEnterDestinationAdapter = ItemEnterDestinationAdapter(context!!, false,it.abroad)
itemEnterDestinationAdapter = ItemEnterDestinationAdapter(context!!, false, it.data)
mAdapter?.addAdapter(itemEnterDestinationAdapter)
}
itemEnterDestinationAdapter?.list = it.abroad
itemEnterDestinationAdapter?.list = it.data!!
mAdapter?.notifyDataSetChanged()
})
}
......
......@@ -2,7 +2,9 @@ package com.mints.street.main.vr
import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.mints.street.bean.BaseArrayResponse
import com.mints.street.bean.BaseResponse
import com.mints.street.bean.VreperienceBean
import com.mints.street.bean.VrmapBean
import com.mints.street.db.ScenicSpotBean
import com.mints.street.model.ApiModel
......@@ -15,8 +17,10 @@ import java.util.HashMap
* Created by 冯瑞雨 on 2021/7/9.
*/
class FeaturedExperienceViewModel(application: Application):BaseViewModel(application) {
//获取vr街景数据
//获取vr详细街景数据
val VrmapBean: MutableLiveData<VrmapBean> = MutableLiveData()
val VreperienceBean: MutableLiveData<VreperienceBean> = MutableLiveData()
fun vrPlaces(){//无参数传递
ApiModel.vrPlaces(lifecycleProvider).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<VrmapBean>>(
......@@ -43,16 +47,16 @@ class FeaturedExperienceViewModel(application: Application):BaseViewModel(applic
fun getChooseExperienceHeadData(){
val vo = HashMap<String, Any>()
vo["pageNum"] = 1
vo["pageSize"] = 2
vo["pageSize"] = 320
ApiModel.getChooseExperienceHeadData(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
object : HttpSubscribeImpl<BaseResponse<VreperienceBean>>(
this@FeaturedExperienceViewModel,true){
override fun onBusinessSuccess(response: BaseResponse<Any>) {
override fun onBusinessSuccess(response: BaseResponse<VreperienceBean>) {
VreperienceBean.value=response.result
KLog.e("getChooseExperienceHeadData","成功=================")
}
override fun onError(e: Throwable) {
KLog.e("getChooseExperienceHeadData","请求失败 : $e")
}
}
)
......
......@@ -22,7 +22,7 @@ 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
// private var enterDestinationAdapter: EnterDestinationAdapter? = null
override fun initContentView(
inflater: LayoutInflater?,
container: ViewGroup?,
......
......@@ -97,14 +97,14 @@ object ApiModel {
/**
* 精选体验展示图
*/
fun getChooseExperienceHeadData(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>):Observable<Response<BaseResponse<Any>>>{
fun getChooseExperienceHeadData(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>):Observable<Response<BaseResponse<VreperienceBean>>>{
return HttpManager.getInstance().execute(lifecycleProvider,MainApi.newInstance().getChooseExperienceHeadData(map))
}
/**
* 精选体验详情
*/
fun getChooseExperienceData(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>):Observable<Response<BaseResponse<Any>>>{
fun getChooseExperienceData(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>):Observable<Response<BaseResponse<DetailedBean>>>{
return HttpManager.getInstance().execute(lifecycleProvider,MainApi.newInstance().getChooseExperienceData(map))
}
/**
......
......@@ -34,6 +34,7 @@
app:ctb_title="街景" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="20dp"
......@@ -43,6 +44,7 @@
android:textSize="16sp" />
<TextView
android:id="@+id/tv_introduce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
......
......@@ -47,31 +47,30 @@
app:layout_constraintTop_toTopOf="@id/tv_name"
app:layout_constraintBottom_toBottomOf="@id/tv_number_people"
/>
<ImageView
<com.mints.street.widget.XCRoundRectImageView
android:id="@+id/image1"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_width="100dp"
android:layout_height="70dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/image2"
tools:src="@mipmap/bg_fl"
/>
<ImageView
tools:src="@mipmap/bg_fl" />
<com.mints.street.widget.XCRoundRectImageView
android:layout_marginStart="10dp"
android:id="@+id/image2"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_width="100dp"
android:layout_height="70dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image1"
app:layout_constraintEnd_toStartOf="@id/image3"
tools:src="@mipmap/bg_fl"
/>
<ImageView
<com.mints.street.widget.XCRoundRectImageView
android:layout_marginStart="10dp"
android:id="@+id/image3"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_width="100dp"
android:layout_height="70dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image2"
app:layout_constraintEnd_toEndOf="parent"
......
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