Commit 2de53ea8 authored by fengruiyu's avatar fengruiyu

Merge branch 'branche_zsf' of http://39.97.65.143:81/android/android_street into fry_dev

 Conflicts:
	app/src/main/java/com/mints/street/main/MainActivity.kt
	app/src/main/res/layout/item_grid_map_adapter.xml
parents a847b934 ee9f7189
package com.mints.street.adapter package com.mints.street.adapter
import android.content.Context 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.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager import com.alibaba.android.vlayout.VirtualLayoutManager
import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.alibaba.android.vlayout.layout.LinearLayoutHelper import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder import com.fry.base.adapter.BindingViewHolder
import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.VreperienceBean
import com.mints.street.bean.VrmapBean import com.mints.street.bean.VrmapBean
import com.mints.street.databinding.EnterDestinationAdapterBinding 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. * Created by 冯瑞雨 on 2021/7/9.
*/ */
class EnterDestinationAdapter(val context: Context,val bean :List<VrmapBean.Abroad>?): class EnterDestinationAdapter(val context: Context,val bean :List<VreperienceBean.Data>?):
AbstractVLayoutBaseAdapter<EnterDestinationAdapterBinding, List<VrmapBean.Abroad>?>(context,bean,1) { AbstractVLayoutBaseAdapter<EnterDestinationAdapterBinding, List<VreperienceBean.Data>?>(context,bean,1) {
private var vLayout: VirtualLayoutManager? = null private var vLayout: VirtualLayoutManager? = null
...@@ -42,7 +30,7 @@ class EnterDestinationAdapter(val context: Context,val bean :List<VrmapBean.Abro ...@@ -42,7 +30,7 @@ class EnterDestinationAdapter(val context: Context,val bean :List<VrmapBean.Abro
holder.binding.listView.layoutManager = vLayout holder.binding.listView.layoutManager = vLayout
holder.binding.listView.adapter = mAdapter holder.binding.listView.adapter = mAdapter
mAdapter?.addAdapter(ItemEnterDestinationAdapter(context,true,bean)) mAdapter?.addAdapter(ItemEnterDestinationAdapter(context,true,bean!!))
} }
......
package com.mints.street.adapter package com.mints.street.adapter
import android.app.ActionBar
import android.content.Context import android.content.Context
import android.icu.number.IntegerWidth
import android.view.WindowManager
import android.widget.ImageView
import com.alibaba.android.vlayout.LayoutHelper import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.GridLayoutHelper import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
...@@ -12,6 +16,7 @@ import com.mints.street.bean.VrmapBean ...@@ -12,6 +16,7 @@ import com.mints.street.bean.VrmapBean
import com.mints.street.databinding.ItemGridMapAdapterBinding import com.mints.street.databinding.ItemGridMapAdapterBinding
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
import me.goldze.mvvmhabit.utils.AppUtils import me.goldze.mvvmhabit.utils.AppUtils
import me.goldze.mvvmhabit.utils.KLog
/** /**
* Created by 冯瑞雨 on 2021/7/9. * Created by 冯瑞雨 on 2021/7/9.
...@@ -26,11 +31,11 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?) ...@@ -26,11 +31,11 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
) { ) {
var a = holder.binding.bg.layoutParams var a = holder.binding.bg.layoutParams
if (position % 2 == 0) { if (position % 2 == 0) {
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F), holder.binding.bg.setMargin(AppUtils.dp2Px(context, 20F), AppUtils.dp2Px(context, 20F),
AppUtils.dp2Px(context, 5F), 0, null, null, null) AppUtils.dp2Px(context, 15F), 0, null, null, null)
} else { } else {
holder.binding.bg.setMargin(AppUtils.dp2Px(context, 5F), AppUtils.dp2Px(context, 10F), holder.binding.bg.setMargin(AppUtils.dp2Px(context, 15F), AppUtils.dp2Px(context, 20F),
AppUtils.dp2Px(context, 10F), 0, null, null, null) AppUtils.dp2Px(context, 20F), 0, null, null, null)
} }
datalist?.let { datalist?.let {
...@@ -39,12 +44,7 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?) ...@@ -39,12 +44,7 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
Glide.with(mContext).load(databean.img).into(holder.binding.image) Glide.with(mContext).load(databean.img).into(holder.binding.image)
//设置标题 //设置标题
holder.binding.tvName.text = databean.name holder.binding.tvName.text = databean.name
// //设置星星数量
// var i = 0
// while (i < 5) {
// holder.binding.lyStar.addView(View.inflate(context, R.layout.include_start_show, null))
// i += 1
// }
//设置点击跳转 //设置点击跳转
holder.itemView.setOnClickListener { holder.itemView.setOnClickListener {
//页面跳转 //页面跳转
...@@ -58,6 +58,8 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?) ...@@ -58,6 +58,8 @@ class GridMapAdapter(val context: Context, var list: List<VrmapBean.Internal>?)
} }
override fun getItemCount() = list!!.size override fun getItemCount() = list!!.size
override fun onCreateLayoutHelper(): LayoutHelper { override fun onCreateLayoutHelper(): LayoutHelper {
......
...@@ -11,12 +11,14 @@ import com.alibaba.android.vlayout.layout.GridLayoutHelper ...@@ -11,12 +11,14 @@ import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder import com.fry.base.adapter.BindingViewHolder
import com.fry.base.binding.setMargin import com.fry.base.binding.setMargin
import com.fry.base.utils.ImageLoader
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.DetailedBean
import com.mints.street.databinding.ItemGridVrmapAdapterBinding import com.mints.street.databinding.ItemGridVrmapAdapterBinding
import me.goldze.mvvmhabit.utils.AppUtils import me.goldze.mvvmhabit.utils.AppUtils
class GridVrMapAdapter(val context: Context, var list: List<String>?) : class GridVrMapAdapter(val context: Context, var list: List<DetailedBean.DetailedItemBean>?) :
AbstractVLayoutBaseAdapter<ItemGridVrmapAdapterBinding, List<String>>(context, list, 2) { AbstractVLayoutBaseAdapter<ItemGridVrmapAdapterBinding, List<DetailedBean.DetailedItemBean>>(context, list, 2) {
override fun onBindViewHolder( override fun onBindViewHolder(
holder: BindingViewHolder<ItemGridVrmapAdapterBinding>, holder: BindingViewHolder<ItemGridVrmapAdapterBinding>,
position: Int position: Int
...@@ -31,6 +33,13 @@ class GridVrMapAdapter(val context: Context, var list: List<String>?) : ...@@ -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), holder.binding.bg.setMargin(AppUtils.dp2Px(context, 6F), AppUtils.dp2Px(context, 10F), AppUtils.dp2Px(context, 10F),
0, null, null, null) 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 override fun getItemCount() = list!!.size
......
...@@ -7,9 +7,11 @@ import com.fry.base.adapter.AbstractVLayoutBaseAdapter ...@@ -7,9 +7,11 @@ import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder import com.fry.base.adapter.BindingViewHolder
import com.fry.base.utils.ImageLoader import com.fry.base.utils.ImageLoader
import com.mints.street.R 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.databinding.ItemEnterDestinationAdapterBinding
import com.mints.street.main.vr.DetailedActivity 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 ...@@ -19,8 +21,8 @@ import com.mints.street.main.vr.DetailedActivity
class ItemEnterDestinationAdapter( class ItemEnterDestinationAdapter(
val context: Context, val context: Context,
private val isMultipleLayout: Boolean, private val isMultipleLayout: Boolean,
val list: List<VrmapBean.Abroad>? var list: List<VreperienceBean.Data>?
) : AbstractVLayoutBaseAdapter<ItemEnterDestinationAdapterBinding, List<VrmapBean.Abroad>?>( ) : AbstractVLayoutBaseAdapter<ItemEnterDestinationAdapterBinding, List<VreperienceBean.Data>?>(
context, context,
list, list,
1 1
...@@ -36,19 +38,23 @@ class ItemEnterDestinationAdapter( ...@@ -36,19 +38,23 @@ class ItemEnterDestinationAdapter(
} else { } else {
bgLayoutParams.width = a.widthPixels bgLayoutParams.width = a.widthPixels
} }
holder.itemView.setOnClickListener {
RxUtils.onMultiClick(holder.itemView
){
var intent = Intent(context, DetailedActivity::class.java) var intent = Intent(context, DetailedActivity::class.java)
intent.putExtra("area",list?.get(position)?.area)
context.startActivity(intent) context.startActivity(intent)
} }
list?.let { it -> list?.let { it ->
holder.binding.tvName.text = it[position].name holder.binding.tvName.text = it[position].area
holder.binding.tvNumberPeople.text = "人数" holder.binding.tvNumberPeople.text = "人数"
it[position].img?.let { url -> it[position].url?.let { url ->
for (index in it.indices) { KLog.e("zsf__","==========${it.indices}")
for (index in 0..2) {
when (index) { when (index) {
0 -> { 0 -> {
ImageLoader.ImageBuilder.with(context) ImageLoader.ImageBuilder.with(context)
.setUrl(url[index]).setTargetView(holder.binding.image1).start() .setUrl(url[index]).setTargetView(holder.binding.image3).start()
} }
1 -> { 1 -> {
ImageLoader.ImageBuilder.with(context) ImageLoader.ImageBuilder.with(context)
...@@ -56,7 +62,7 @@ class ItemEnterDestinationAdapter( ...@@ -56,7 +62,7 @@ class ItemEnterDestinationAdapter(
} }
2 -> { 2 -> {
ImageLoader.ImageBuilder.with(context) ImageLoader.ImageBuilder.with(context)
.setUrl(url[index]).setTargetView(holder.binding.image3).start() .setUrl(url[index]).setTargetView(holder.binding.image1).start()
} }
} }
......
...@@ -117,4 +117,17 @@ interface MainApi { ...@@ -117,4 +117,17 @@ interface MainApi {
*/ */
@POST("api/mpgah") @POST("api/mpgah")
fun authorized():Observable<Response<BaseResponse<AuthorizedBean>>> fun authorized():Observable<Response<BaseResponse<AuthorizedBean>>>
/**
* 精选体验展示图
*/
@POST("na/getChooseExperienceHeadData")
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<DetailedBean>>>
} }
\ No newline at end of file
...@@ -6,9 +6,16 @@ import java.util.List; ...@@ -6,9 +6,16 @@ import java.util.List;
* Created by goldze on 2017/5/10. * 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 { ...@@ -18,7 +18,7 @@ public class BaseResponse<T> implements Serializable {
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class) // @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
@SerializedName("data") @SerializedName("data")
private @Nullable T result; protected @Nullable T result;
@SerializedName("result") @SerializedName("result")
private @Nullable List<T> resultList; 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>
)
}
...@@ -72,12 +72,18 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() { ...@@ -72,12 +72,18 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
) )
RxPermissions(this).request( RxPermissions(this).request(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else "", if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else "",
Manifest.permission.ACCESS_FINE_LOCATION).subscribe { Manifest.permission.ACCESS_FINE_LOCATION ,
} Manifest.permission.WRITE_EXTERNAL_STORAGE ,
Manifest.permission.READ_PHONE_STATE
)
.subscribe {
}
} }
var oldTime: Long = 0 var oldTime: Long = 0
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
when (keyCode) { when (keyCode) {
...@@ -115,6 +121,7 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 { ...@@ -115,6 +121,7 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 {
this.isUserInputEnabled = false this.isUserInputEnabled = false
//预加载 //预加载
this.offscreenPageLimit = 4 this.offscreenPageLimit = 4
//设置适配器 //设置适配器
adapter = object : FragmentStateAdapter(activity) { adapter = object : FragmentStateAdapter(activity) {
override fun createFragment(position: Int): Fragment { override fun createFragment(position: Int): Fragment {
......
...@@ -132,7 +132,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList ...@@ -132,7 +132,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
// 是否会员 // 是否会员
if (userManager.getVipFlag()) { if (userManager.getVipFlag()) {
tv_tips.text = "恭喜您,已经成为全球会员啦~" tv_tips.text = "恭喜您,成为全球会员啦~"
bt_try.visibility = View.INVISIBLE bt_try.visibility = View.INVISIBLE
} else { } else {
tv_tips.text = "恭喜你被全球会员卡砸中~" tv_tips.text = "恭喜你被全球会员卡砸中~"
......
...@@ -103,7 +103,4 @@ class MyViewModel(application: Application) : BaseViewModel(application) { ...@@ -103,7 +103,4 @@ class MyViewModel(application: Application) : BaseViewModel(application) {
}) })
} }
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.mints.street.main.my ...@@ -2,6 +2,7 @@ package com.mints.street.main.my
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Dialog import android.app.Dialog
import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
...@@ -33,12 +34,14 @@ import kotlinx.android.synthetic.main.fragment_my.* ...@@ -33,12 +34,14 @@ import kotlinx.android.synthetic.main.fragment_my.*
import kotlinx.android.synthetic.main.include_header.* import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.AppUtils import me.goldze.mvvmhabit.utils.AppUtils
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.ToastUtils import me.goldze.mvvmhabit.utils.ToastUtils
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>(), View.OnClickListener { class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>(), View.OnClickListener {
private val userManager by lazy { UserManager.INSTANCE }
private var vLayout: VirtualLayoutManager? = null private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null private var mAdapter: DelegateAdapter? = null
private var gridPaymentAdapter: GridPaymentAdapter? = null private var gridPaymentAdapter: GridPaymentAdapter? = null
...@@ -354,5 +357,19 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() ...@@ -354,5 +357,19 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
} }
override fun onResume() {
super.onResume()
KLog.e("OpenvipActivity","onResume")
// if(userManager.userIsLogin()&&userManager.getVipFlag()){
// finish()
// }
}
// override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
// super.onActivityResult(requestCode, resultCode, data)
// KLog.e("OpenvipActivity","onActivityResult")
// }
} }
package com.mints.street.main.vr package com.mints.street.main.vr
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
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.BaseActivity import com.fry.base.base.BaseActivity
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.adapter.GridMapAdapter
import com.mints.street.adapter.GridVrMapAdapter import com.mints.street.adapter.GridVrMapAdapter
import com.mints.street.databinding.ActivityDetailedBinding 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 { class DetailedActivity : BaseActivity<ActivityDetailedBinding, DetailedViewModel>(), View.OnClickListener {
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_detailed override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_detailed
private var myintent: Intent? =null
private var vLayout: VirtualLayoutManager? = null private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null private var mAdapter: DelegateAdapter? = null
private var gridVrMapAdapter: GridVrMapAdapter? = null private var gridVrMapAdapter: GridVrMapAdapter? = null
...@@ -47,17 +44,30 @@ class DetailedActivity : BaseActivity<ActivityDetailedBinding, DetailedViewModel ...@@ -47,17 +44,30 @@ class DetailedActivity : BaseActivity<ActivityDetailedBinding, DetailedViewModel
binding.listview.layoutManager = vLayout binding.listview.layoutManager = vLayout
binding.listview.adapter = mAdapter 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()
}
} }
override fun onClick(v: View?) { override fun onClick(v: View?) {
} }
override fun onResume() {
super.onResume()
myintent =getIntent();
viewModel.getChooseExperienceData(myintent?.getStringExtra("area")!!)
}
override fun initViewObservable() {
super.initViewObservable()
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 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.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 import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.utils.KLog
import java.util.HashMap
class DetailedViewModel(application: Application) : BaseViewModel(application) { class DetailedViewModel(application: Application) : BaseViewModel(application) {
val detailbean: MutableLiveData<DetailedBean> = MutableLiveData()
fun getChooseExperienceData(name:String){
val vo = HashMap<String, Any>()
vo["area"] = name
ApiModel.getChooseExperienceData(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<DetailedBean>>(
this@DetailedViewModel,true){
override fun onBusinessSuccess(response: BaseResponse<DetailedBean>) {
detailbean.value=response.result
KLog.e("getChooseExperienceData","成功=================")
}
override fun onError(e: Throwable) {
KLog.e("getChooseExperienceData","请求失败 : $e")
}
}
)
}
} }
...@@ -9,8 +9,6 @@ import com.alibaba.android.vlayout.VirtualLayoutManager ...@@ -9,8 +9,6 @@ import com.alibaba.android.vlayout.VirtualLayoutManager
import com.fry.base.base.BaseFragment import com.fry.base.base.BaseFragment
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R 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.adapter.ItemEnterDestinationAdapter
import com.mints.street.databinding.FragmentFeaturedExperienceBinding import com.mints.street.databinding.FragmentFeaturedExperienceBinding
...@@ -23,6 +21,7 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding ...@@ -23,6 +21,7 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding
private var vLayout: VirtualLayoutManager? = null private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null private var mAdapter: DelegateAdapter? = null
private var itemEnterDestinationAdapter:ItemEnterDestinationAdapter?=null
override fun initContentView( override fun initContentView(
inflater: LayoutInflater?, inflater: LayoutInflater?,
container: ViewGroup?, container: ViewGroup?,
...@@ -40,14 +39,25 @@ class FeaturedExperienceFragment:BaseFragment<FragmentFeaturedExperienceBinding ...@@ -40,14 +39,25 @@ 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() { override fun initViewObservable() {
super.initViewObservable() super.initViewObservable()
viewModel.VrmapBean.observe(this, Observer { viewModel.VreperienceBean.observe(this, Observer {
mAdapter?.addAdapter(ItemEnterDestinationAdapter(context!!, false,it.abroad)) // mAdapter?.addAdapter(ItemEnterDestinationAdapter(context!!, false,it.abroad))
if (itemEnterDestinationAdapter == null){
itemEnterDestinationAdapter = ItemEnterDestinationAdapter(context!!, false, it.data)
mAdapter?.addAdapter(itemEnterDestinationAdapter)
}
itemEnterDestinationAdapter?.list = it.data!!
mAdapter?.notifyDataSetChanged()
}) })
} }
override fun onResume() {
super.onResume()
// viewModel.vrPlaces()
//设置数据请求
viewModel.getChooseExperienceHeadData()
}
} }
\ No newline at end of file
...@@ -2,20 +2,25 @@ package com.mints.street.main.vr ...@@ -2,20 +2,25 @@ package com.mints.street.main.vr
import android.app.Application import android.app.Application
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.mints.street.bean.BaseArrayResponse
import com.mints.street.bean.BaseResponse import com.mints.street.bean.BaseResponse
import com.mints.street.bean.VreperienceBean
import com.mints.street.bean.VrmapBean import com.mints.street.bean.VrmapBean
import com.mints.street.db.ScenicSpotBean import com.mints.street.db.ScenicSpotBean
import com.mints.street.model.ApiModel import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl 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 import me.goldze.mvvmhabit.utils.KLog
import java.util.HashMap
/** /**
* 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街景数据 //获取vr详细街景数据
val VrmapBean: MutableLiveData<VrmapBean> = MutableLiveData() val VrmapBean: MutableLiveData<VrmapBean> = MutableLiveData()
val VreperienceBean: MutableLiveData<VreperienceBean> = MutableLiveData()
fun vrPlaces(){//无参数传递 fun vrPlaces(){//无参数传递
ApiModel.vrPlaces(lifecycleProvider).safeSubscribe( ApiModel.vrPlaces(lifecycleProvider).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<VrmapBean>>( object : HttpSubscribeImpl<BaseResponse<VrmapBean>>(
...@@ -38,4 +43,22 @@ class FeaturedExperienceViewModel(application: Application):BaseViewModel(applic ...@@ -38,4 +43,22 @@ class FeaturedExperienceViewModel(application: Application):BaseViewModel(applic
} }
) )
} }
fun getChooseExperienceHeadData(){
val vo = HashMap<String, Any>()
vo["pageNum"] = 1
vo["pageSize"] = 320
ApiModel.getChooseExperienceHeadData(lifecycleProvider,vo).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<VreperienceBean>>(
this@FeaturedExperienceViewModel,true){
override fun onBusinessSuccess(response: BaseResponse<VreperienceBean>) {
VreperienceBean.value=response.result
KLog.e("getChooseExperienceHeadData","成功=================")
}
override fun onError(e: Throwable) {
}
}
)
}
} }
\ No newline at end of file
...@@ -22,7 +22,7 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel ...@@ -22,7 +22,7 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
private var vLayout: VirtualLayoutManager? = null private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null private var mAdapter: DelegateAdapter? = null
private var gridMapAdapter: GridMapAdapter? = null private var gridMapAdapter: GridMapAdapter? = null
private var enterDestinationAdapter: EnterDestinationAdapter? = null // private var enterDestinationAdapter: EnterDestinationAdapter? = null
override fun initContentView( override fun initContentView(
inflater: LayoutInflater?, inflater: LayoutInflater?,
container: ViewGroup?, container: ViewGroup?,
...@@ -53,10 +53,10 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel ...@@ -53,10 +53,10 @@ class FreeZoneFragment : BaseFragment<FragmentFreeZoneBinding, FreeZoneViewModel
override fun initViewObservable() { override fun initViewObservable() {
super.initViewObservable() super.initViewObservable()
viewModel.VrmapBean.observe(this, Observer<VrmapBean> { viewModel.VrmapBean.observe(this, Observer<VrmapBean> {
if(enterDestinationAdapter == null){ /*if(enterDestinationAdapter == null){
enterDestinationAdapter = EnterDestinationAdapter(context!!,it.abroad ) enterDestinationAdapter = EnterDestinationAdapter(context!!,it.abroad )
mAdapter?.addAdapter(enterDestinationAdapter) mAdapter?.addAdapter(enterDestinationAdapter)
} }*/
if (gridMapAdapter == null){ if (gridMapAdapter == null){
gridMapAdapter = GridMapAdapter(context!!, it.internal) gridMapAdapter = GridMapAdapter(context!!, it.internal)
mAdapter?.addAdapter(gridMapAdapter) mAdapter?.addAdapter(gridMapAdapter)
......
...@@ -61,7 +61,7 @@ class VRFragment : BaseFragment<FragmentVrBinding, VRViewModel>() { ...@@ -61,7 +61,7 @@ class VRFragment : BaseFragment<FragmentVrBinding, VRViewModel>() {
binding.viewPager.init(this, fragments) binding.viewPager.init(this, fragments)
//初始化 magic_indicator //初始化 magic_indicator
binding.magicIndicator.bindViewPager2(binding.viewPager, tabNames, {}, 20f, true) binding.magicIndicator.bindViewPager2(binding.viewPager, tabNames, {}, 16f, true)
} }
......
...@@ -94,6 +94,19 @@ object ApiModel { ...@@ -94,6 +94,19 @@ object ApiModel {
.execute(lifecycleProvider,MainApi.newInstance().vrPlaces()) .execute(lifecycleProvider,MainApi.newInstance().vrPlaces())
} }
/**
* 精选体验展示图
*/
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<DetailedBean>>>{
return HttpManager.getInstance().execute(lifecycleProvider,MainApi.newInstance().getChooseExperienceData(map))
}
/** /**
* 绑定手机号登录 * 绑定手机号登录
*/ */
......
...@@ -19,7 +19,7 @@ class BackVipDialog(context: Context, private val listener: DialogListener) : ...@@ -19,7 +19,7 @@ class BackVipDialog(context: Context, private val listener: DialogListener) :
private val lp: WindowManager.LayoutParams private val lp: WindowManager.LayoutParams
private val tv_payment: TextView private val tv_payment: TextView
private val tv_close: TextView private val tv_close: ImageView
init { init {
setContentView(R.layout.dialog_backvip) setContentView(R.layout.dialog_backvip)
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#C19161"
android:startColor="#8E5832"
android:type="linear"
android:useLevel="true" />
</shape>
\ No newline at end of file
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
app:ctb_title="街景" /> app:ctb_title="街景" />
<TextView <TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="20dp" android:paddingTop="20dp"
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
android:textSize="16sp" /> android:textSize="16sp" />
<TextView <TextView
android:id="@+id/tv_introduce"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="15dp" android:paddingLeft="15dp"
......
This diff is collapsed.
...@@ -47,31 +47,30 @@ ...@@ -47,31 +47,30 @@
app:layout_constraintTop_toTopOf="@id/tv_name" app:layout_constraintTop_toTopOf="@id/tv_name"
app:layout_constraintBottom_toBottomOf="@id/tv_number_people" app:layout_constraintBottom_toBottomOf="@id/tv_number_people"
/> />
<ImageView <com.mints.street.widget.XCRoundRectImageView
android:id="@+id/image1" android:id="@+id/image1"
android:layout_width="0dp" android:layout_width="100dp"
android:layout_height="60dp" android:layout_height="70dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/image2" app:layout_constraintEnd_toStartOf="@id/image2"
tools:src="@mipmap/bg_fl" tools:src="@mipmap/bg_fl" />
/> <com.mints.street.widget.XCRoundRectImageView
<ImageView
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:id="@+id/image2" android:id="@+id/image2"
android:layout_width="0dp" android:layout_width="100dp"
android:layout_height="60dp" android:layout_height="70dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image1" app:layout_constraintStart_toEndOf="@id/image1"
app:layout_constraintEnd_toStartOf="@id/image3" app:layout_constraintEnd_toStartOf="@id/image3"
tools:src="@mipmap/bg_fl" tools:src="@mipmap/bg_fl"
/> />
<ImageView <com.mints.street.widget.XCRoundRectImageView
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:id="@+id/image3" android:id="@+id/image3"
android:layout_width="0dp" android:layout_width="100dp"
android:layout_height="60dp" android:layout_height="70dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/image2" app:layout_constraintStart_toEndOf="@id/image2"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
android:layout_margin="15dp" android:layout_margin="15dp"
android:id="@+id/bg" android:id="@+id/bg"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="230dp" android:layout_height="210dp"
android:background="@drawable/shape_bg_vrdata" android:background="@drawable/shape_bg_vrdata"
android:elevation="5dp" android:elevation="5dp"
android:orientation="vertical"> android:orientation="vertical">
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<com.mints.street.widget.XCRoundRectImageView <com.mints.street.widget.XCRoundRectImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="160dp" /> android:layout_height="130dp" />
<TextView <TextView
android:id="@+id/tv_name" android:id="@+id/tv_name"
...@@ -34,12 +34,12 @@ ...@@ -34,12 +34,12 @@
android:textSize="12sp" /> android:textSize="12sp" />
<com.mints.street.widget.RatingStar <com.mints.street.widget.RatingStar
android:id="@+id/llstart"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="10dp" android:layout_height="10dp"
app:starNormal="@mipmap/star_icon" app:starNormal="@mipmap/star_icon"
app:starNumber="5" app:starNumber="5"/>
/>
</LinearLayout> </LinearLayout>
</layout> </layout>
\ 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