首页banner修改
This commit is contained in:
@@ -12,8 +12,6 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.lifecycle.ViewModelStore
|
import androidx.lifecycle.ViewModelStore
|
||||||
import androidx.lifecycle.ViewModelStoreOwner
|
import androidx.lifecycle.ViewModelStoreOwner
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
|
||||||
import com.lzy.ninegrid.NineGridView
|
import com.lzy.ninegrid.NineGridView
|
||||||
import com.orhanobut.logger.AndroidLogAdapter
|
import com.orhanobut.logger.AndroidLogAdapter
|
||||||
import com.orhanobut.logger.Logger
|
import com.orhanobut.logger.Logger
|
||||||
@@ -47,7 +45,6 @@ import com.xjjk.healthyclients.utils.updateplugin.CustomDownloadNotifier
|
|||||||
import com.xjjk.healthyclients.utils.updateplugin.CustomInstallNotifier
|
import com.xjjk.healthyclients.utils.updateplugin.CustomInstallNotifier
|
||||||
import com.xjjk.healthyclients.utils.updateplugin.CustomUpdateNotifier
|
import com.xjjk.healthyclients.utils.updateplugin.CustomUpdateNotifier
|
||||||
import com.xjjk.healthyclients.view.AppraiseDialog
|
import com.xjjk.healthyclients.view.AppraiseDialog
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.lzh.framework.updatepluginlib.UpdateConfig
|
import org.lzh.framework.updatepluginlib.UpdateConfig
|
||||||
@@ -98,9 +95,6 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
|||||||
registerActivityLifecycleCallbacks(AdjustLifecycleCallbacks())
|
registerActivityLifecycleCallbacks(AdjustLifecycleCallbacks())
|
||||||
val androidId = DevicesInfoUtils.getAndroidId(this)
|
val androidId = DevicesInfoUtils.getAndroidId(this)
|
||||||
println("设备id:${androidId}")
|
println("设备id:${androidId}")
|
||||||
if (UrlConfig.testDeviceList.contains(androidId)) {
|
|
||||||
UrlConfig.isTestDevice = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(base: Context) {
|
override fun attachBaseContext(base: Context) {
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ interface HomeApi {
|
|||||||
/**
|
/**
|
||||||
* 首页banner
|
* 首页banner
|
||||||
*/
|
*/
|
||||||
@GET("/sys/api/banner/selectBannerList")
|
// @GET("/sys/api/banner/selectBannerList")
|
||||||
|
@GET("/sys/api/banner/selectAllBannerList")
|
||||||
suspend fun getHomeBannerList(@QueryMap params: MutableMap<String, Any?>): ApiResponse<MutableList<HomeBannerBean>>
|
suspend fun getHomeBannerList(@QueryMap params: MutableMap<String, Any?>): ApiResponse<MutableList<HomeBannerBean>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,4 +65,10 @@ interface HomeApi {
|
|||||||
@POST("/health-system/bank/userPoints/app/pointCheckIn")
|
@POST("/health-system/bank/userPoints/app/pointCheckIn")
|
||||||
suspend fun postUserPointsCheckIn(@Body requestBody: RequestBody): ApiResponse<CheckInBean>
|
suspend fun postUserPointsCheckIn(@Body requestBody: RequestBody): ApiResponse<CheckInBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心理帮助图片url
|
||||||
|
*/
|
||||||
|
@GET("/health-consultation/consultation/conSession/getPicUrl")
|
||||||
|
suspend fun getConSessionPicUrl(@QueryMap params: MutableMap<String, Any?>): ApiResponse<String>
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,9 +37,9 @@ object HomeRepository : BaseRepository() {
|
|||||||
return apiCall { service.getHomeNoticeDetail(map) }
|
return apiCall { service.getHomeNoticeDetail(map) }
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getHomeBannerList(showLocation: String): ApiResponse<MutableList<HomeBannerBean>> {
|
suspend fun getHomeBannerList(): ApiResponse<MutableList<HomeBannerBean>> {
|
||||||
val map = mutableMapOf<String, Any?>()
|
val map = mutableMapOf<String, Any?>()
|
||||||
map["showLocation"] = showLocation
|
// map["showLocation"] = showLocation
|
||||||
return apiCall { service.getHomeBannerList(map) }
|
return apiCall { service.getHomeBannerList(map) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,4 +75,9 @@ object HomeRepository : BaseRepository() {
|
|||||||
suspend fun postUserPointsCheckIn(checkInBean: CheckInBean): ApiResponse<CheckInBean> {
|
suspend fun postUserPointsCheckIn(checkInBean: CheckInBean): ApiResponse<CheckInBean> {
|
||||||
return apiCall { service.postUserPointsCheckIn(checkInBean.toJson().toRequestBody()) }
|
return apiCall { service.postUserPointsCheckIn(checkInBean.toJson().toRequestBody()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getConSessionPicUrl(): ApiResponse<String> {
|
||||||
|
val map = mutableMapOf<String, Any?>()
|
||||||
|
return apiCall { service.getConSessionPicUrl(map) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,9 +18,8 @@ import com.xjjk.healthyclients.databinding.FragmentHomeBinding
|
|||||||
import com.xjjk.healthyclients.event.HomeTabChangeEvent
|
import com.xjjk.healthyclients.event.HomeTabChangeEvent
|
||||||
import com.xjjk.healthyclients.event.RefreshEvent
|
import com.xjjk.healthyclients.event.RefreshEvent
|
||||||
import com.xjjk.healthyclients.superfuntion.initColors
|
import com.xjjk.healthyclients.superfuntion.initColors
|
||||||
import com.xjjk.healthyclients.superfuntion.load
|
import com.xjjk.healthyclients.superfuntion.showBanner
|
||||||
import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity
|
import com.xjjk.healthyclients.superfuntion.startAppointmentWaitAffirmActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startEmergencySeekDoctorActivity
|
|
||||||
import com.xjjk.healthyclients.superfuntion.startGroupChat
|
import com.xjjk.healthyclients.superfuntion.startGroupChat
|
||||||
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
import com.xjjk.healthyclients.superfuntion.startLoginActivity
|
||||||
import com.xjjk.healthyclients.superfuntion.startMyGuidanceActivity
|
import com.xjjk.healthyclients.superfuntion.startMyGuidanceActivity
|
||||||
@@ -113,41 +112,57 @@ class HomeFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
mBinding.headImg.setOnClickListener {
|
mBinding.homeMarqueeView.setOnItemClickListener { position, textView ->
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
toActivity(HomeNoticeListActivity::class.java)
|
toActivity(HomeNoticeListActivity::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
mBinding.apply {
|
mBinding.apply {
|
||||||
addClickViews(
|
addClickViews(layoutItem4.imgLeft, layoutItem4.imgRight,
|
||||||
image1, image2, image3, image4, layoutItem4.imgLeft, layoutItem4.imgRight,
|
|
||||||
layoutItem1.homeHeadTab1, layoutItem1.homeHeadTab2, layoutItem1.homeHeadTab3,
|
layoutItem1.homeHeadTab1, layoutItem1.homeHeadTab2, layoutItem1.homeHeadTab3,
|
||||||
layoutItem1.homeHeadTab4, homeMarqueeView, layoutItem3.tvDoctorMore
|
layoutItem1.homeHeadTab4, layoutItem3.tvDoctorMore
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
when (v?.id) {
|
when (v?.id) {
|
||||||
R.id.img_left, R.id.img_right, R.id.home_head_tab1, R.id.home_head_tab2, R.id.home_head_tab4,
|
R.id.img_left -> {
|
||||||
R.id.image1, R.id.image4 -> {
|
val bundle = Bundle()
|
||||||
toActivity(EmptyActivity::class.java)
|
bundle.putString("title","智慧体重")
|
||||||
|
toActivity(EmptyActivity::class.java,bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.image2 -> {
|
R.id.img_right -> {
|
||||||
toActivity(HomeBannerDetailActivity::class.java)
|
val bundle = Bundle()
|
||||||
|
bundle.putString("title","一人一案")
|
||||||
|
toActivity(EmptyActivity::class.java,bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.image3 -> {
|
R.id.home_head_tab1 -> {
|
||||||
EventBus.getDefault().post(HomeTabChangeEvent().apply { index=1 })
|
val bundle = Bundle()
|
||||||
|
bundle.putString("title","健康档案")
|
||||||
|
toActivity(EmptyActivity::class.java,bundle)
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.home_head_tab2 -> {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("title","健康体检")
|
||||||
|
toActivity(EmptyActivity::class.java,bundle)
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.home_head_tab4 -> {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("title","健康银行")
|
||||||
|
toActivity(EmptyActivity::class.java,bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.home_head_tab3 -> {
|
R.id.home_head_tab3 -> {
|
||||||
startEmergencySeekDoctorActivity(requireContext())
|
|
||||||
}
|
|
||||||
|
|
||||||
R.id.home_marqueeView -> {
|
|
||||||
if (DataStoreManager.isLogin()) {
|
if (DataStoreManager.isLogin()) {
|
||||||
toActivity(HomeNoticeListActivity::class.java)
|
EventBus.getDefault().post(HomeTabChangeEvent().apply { index = 2 })
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,10 +187,10 @@ class HomeFragment :
|
|||||||
super.onResume()
|
super.onResume()
|
||||||
if (DataStoreManager.isLogin()) {
|
if (DataStoreManager.isLogin()) {
|
||||||
mBinding.tvHi.visibility = View.VISIBLE
|
mBinding.tvHi.visibility = View.VISIBLE
|
||||||
mBinding.homeMarqueeView.visibility = View.VISIBLE
|
mBinding.layoutNotice.visibility = View.VISIBLE
|
||||||
mBinding.tvHi.text = "hi~ ${DataStoreManager.getUserInfo().realname}"
|
mBinding.tvHi.text = "hi~ ${DataStoreManager.getUserInfo().realname}"
|
||||||
} else {
|
} else {
|
||||||
mBinding.homeMarqueeView.visibility = View.GONE
|
mBinding.layoutNotice.visibility = View.GONE
|
||||||
mBinding.tvHi.visibility = View.GONE
|
mBinding.tvHi.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,10 +203,47 @@ class HomeFragment :
|
|||||||
if (it.isNullOrEmpty()) {
|
if (it.isNullOrEmpty()) {
|
||||||
return@collectLatest
|
return@collectLatest
|
||||||
}
|
}
|
||||||
mBinding.image1.load(it.get(0).photoUrl, false)
|
val bannerList1 = it.filter { homeBannerBean ->
|
||||||
mBinding.image2.load(it.get(1).photoUrl, false)
|
homeBannerBean.showLocation.equals("1")
|
||||||
mBinding.image3.load(it.get(2).photoUrl, false)
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
mBinding.image4.load(it.get(3).photoUrl, false)
|
|
||||||
|
val bannerList2 = it.filter { homeBannerBean ->
|
||||||
|
homeBannerBean.showLocation.equals("2")
|
||||||
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
|
|
||||||
|
val bannerList3 = it.filter { homeBannerBean ->
|
||||||
|
homeBannerBean.showLocation.equals("3")
|
||||||
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
|
|
||||||
|
val bannerList4 = it.filter { homeBannerBean ->
|
||||||
|
homeBannerBean.showLocation.equals("4")
|
||||||
|
}.sortedBy { homeBannerBean -> homeBannerBean.sort }
|
||||||
|
|
||||||
|
showBanner(mBinding.banner1,bannerList1){
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("title","体检套餐")
|
||||||
|
toActivity(EmptyActivity::class.java,bundle)
|
||||||
|
|
||||||
|
}
|
||||||
|
showBanner(mBinding.banner2,bannerList2){
|
||||||
|
|
||||||
|
toActivity(HomeBannerDetailActivity::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
showBanner(mBinding.banner3, bannerList3) {
|
||||||
|
if (DataStoreManager.isLogin()) {
|
||||||
|
EventBus.getDefault().post(HomeTabChangeEvent().apply { index = 1 })
|
||||||
|
} else {
|
||||||
|
startLoginActivity(requireContext())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showBanner(mBinding.banner4, bannerList4) {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("title", "AI随访")
|
||||||
|
toActivity(EmptyActivity::class.java, bundle)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,6 +261,8 @@ class HomeFragment :
|
|||||||
mBinding.homeMarqueeView.stopFlipping()
|
mBinding.homeMarqueeView.stopFlipping()
|
||||||
delay(100)
|
delay(100)
|
||||||
mBinding.homeMarqueeView.startWithList(stringList)
|
mBinding.homeMarqueeView.startWithList(stringList)
|
||||||
|
delay(1000 * 120)
|
||||||
|
mViewModel.getHomeNoticeListRepeat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,11 +290,13 @@ class HomeFragment :
|
|||||||
|
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
mViewModel.getHomeBannerList("2")
|
onRefresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRefresh() {
|
override fun onRefresh() {
|
||||||
mBinding.swipeRefresh.isRefreshing = false
|
mBinding.swipeRefresh.isRefreshing = false
|
||||||
|
mViewModel.getHomeBannerList()
|
||||||
|
|
||||||
if (ConstantUtils.mCheckToken) {
|
if (ConstantUtils.mCheckToken) {
|
||||||
mViewModel.selectDoctorRecommendHome()
|
mViewModel.selectDoctorRecommendHome()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class UserInfoFragment :
|
|||||||
mList.clear()
|
mList.clear()
|
||||||
mList.add(UserMenuBean(1, "咨询人管理", R.drawable.ic_user_personnel_manager, View.VISIBLE))
|
mList.add(UserMenuBean(1, "咨询人管理", R.drawable.ic_user_personnel_manager, View.VISIBLE))
|
||||||
mList.add(UserMenuBean(3, "应急就医", R.drawable.ic_user_sos, View.VISIBLE))
|
mList.add(UserMenuBean(3, "应急就医", R.drawable.ic_user_sos, View.VISIBLE))
|
||||||
mList.add(UserMenuBean(4, "消息通知", R.drawable.icon_home_xiaolaba, View.VISIBLE))
|
mList.add(UserMenuBean(8,"紧急联系人",R.drawable.ic_user_contacts,View.VISIBLE))
|
||||||
mList.add(UserMenuBean(8,"紧急联系人",R.drawable.ic_user_contacts,View.INVISIBLE))
|
mList.add(UserMenuBean(4, "消息通知", R.drawable.ic_user_message, View.INVISIBLE))
|
||||||
|
|
||||||
|
|
||||||
mUserMenuAdapter =
|
mUserMenuAdapter =
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ object UrlConfig {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://192.168.1.23/" // 开发环境
|
private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://192.168.1.47" // 开发环境
|
||||||
private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://api-xj.tri.dt.io/" // 开发环境
|
// private const val DEBUG_DEFAULT_IP_ADDRESS_REMOTE = "http://api-xj.tri.dt.io/" // 开发环境
|
||||||
private const val TEST_DEFAULT_IP_ADDRESS_REMOTE = "https://xj-api.mcrm.vip:8888" // 测试环境
|
private const val TEST_DEFAULT_IP_ADDRESS_REMOTE = "https://xj-api.mcrm.vip:8888" // 测试环境
|
||||||
// private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api.xjygjk.com" // 正式环境
|
// private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api.xjygjk.com" // 正式环境
|
||||||
private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api-jkglpt.iosp.ydpt.tech" // 正式环境
|
private const val PRODUCT_DEFAULT_IP_ADDRESS_REMOTE = "https://api-jkglpt.iosp.ydpt.tech" // 正式环境
|
||||||
@@ -32,8 +32,6 @@ object UrlConfig {
|
|||||||
|
|
||||||
val baseUrlType: BaseUrlType = BaseUrlType.TEST
|
val baseUrlType: BaseUrlType = BaseUrlType.TEST
|
||||||
|
|
||||||
var testDeviceList = mutableListOf("7e8e7e49a26340b1","bb2d17cc138d109f")//测试设备列表 荣耀 oppo vivo
|
|
||||||
var isTestDevice: Boolean = false
|
|
||||||
var isOpenIm: Boolean = true
|
var isOpenIm: Boolean = true
|
||||||
|
|
||||||
enum class BaseUrlType(val type: Int) {
|
enum class BaseUrlType(val type: Int) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import com.youth.banner.indicator.CircleIndicator
|
|||||||
|
|
||||||
fun Fragment.showBanner(
|
fun Fragment.showBanner(
|
||||||
banner: Banner<Any, BannerAdapter<Any, *>>,
|
banner: Banner<Any, BannerAdapter<Any, *>>,
|
||||||
bannerDataList: MutableList<HomeBannerBean>,
|
bannerDataList: List<HomeBannerBean>,
|
||||||
listener: ((HomeBannerBean)-> Unit)? = null
|
listener: ((HomeBannerBean)-> Unit)? = null
|
||||||
) {
|
) {
|
||||||
val bannerImageAdapter = object : BannerImageAdapter<HomeBannerBean>(bannerDataList) {
|
val bannerImageAdapter = object : BannerImageAdapter<HomeBannerBean>(bannerDataList) {
|
||||||
@@ -37,6 +37,8 @@ fun Fragment.showBanner(
|
|||||||
)
|
)
|
||||||
imageView.layoutParams = params
|
imageView.layoutParams = params
|
||||||
// imageView.scaleType = ImageView.ScaleType.CENTER_CROP
|
// imageView.scaleType = ImageView.ScaleType.CENTER_CROP
|
||||||
|
imageView.adjustViewBounds = true
|
||||||
|
imageView.scaleType = ImageView.ScaleType.FIT_XY
|
||||||
return BannerImageHolder(imageView)
|
return BannerImageHolder(imageView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +49,7 @@ fun Fragment.showBanner(
|
|||||||
.isAutoLoop(true)
|
.isAutoLoop(true)
|
||||||
.setIndicator(CircleIndicator(requireContext()))
|
.setIndicator(CircleIndicator(requireContext()))
|
||||||
.setIndicatorGravity(IndicatorConfig.Direction.CENTER)
|
.setIndicatorGravity(IndicatorConfig.Direction.CENTER)
|
||||||
.setIndicatorSelectedWidth(10)
|
.setIndicatorSelectedWidth(15)
|
||||||
|
|
||||||
banner.setOnBannerListener { data, position ->
|
banner.setOnBannerListener { data, position ->
|
||||||
data as HomeBannerBean
|
data as HomeBannerBean
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ class EmptyActivity :
|
|||||||
|
|
||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
|
val stringExtra = intent.getStringExtra("title")
|
||||||
|
mBinding.toolbarLay.title=stringExtra
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
@@ -22,7 +24,6 @@ class EmptyActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -209,7 +209,7 @@ class UserMyGuidanceActivity : BaseVMBActivity<MyGuidanceActivityViewModel, Acti
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1 待开始 3 进行中 5已完成
|
* 1 待开始 3 进行中 5已完成 6 历史
|
||||||
*/
|
*/
|
||||||
fun orderState(state:Int){
|
fun orderState(state:Int){
|
||||||
mTitleState="$state"
|
mTitleState="$state"
|
||||||
|
|||||||
+17
-2
@@ -2,10 +2,16 @@ package com.xjjk.healthyclients.ui.activity.home
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.xjjk.healthyclients.R
|
import com.xjjk.healthyclients.R
|
||||||
import com.xjjk.healthyclients.base.BaseVMBActivity
|
import com.xjjk.healthyclients.base.BaseVMBActivity
|
||||||
import com.xjjk.healthyclients.databinding.ActivityHomeBannerBinding
|
import com.xjjk.healthyclients.databinding.ActivityHomeBannerBinding
|
||||||
|
import com.xjjk.healthyclients.superfuntion.load
|
||||||
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
import com.xjjk.healthyclients.ui.viewmodel.HomeViewModel
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页banner
|
* 首页banner
|
||||||
@@ -19,7 +25,7 @@ class HomeBannerDetailActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
|
mViewModel.getConSessionPicUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
@@ -27,7 +33,16 @@ class HomeBannerDetailActivity :
|
|||||||
|
|
||||||
override fun createObserve() {
|
override fun createObserve() {
|
||||||
super.createObserve()
|
super.createObserve()
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
|
mViewModel.sessionPicUrl.collectLatest {
|
||||||
|
if (it.isNullOrEmpty()) {
|
||||||
|
return@collectLatest
|
||||||
|
}
|
||||||
|
mBinding.imgBanner.load(it,false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun processClick(paramView: View?) {
|
override fun processClick(paramView: View?) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.xjjk.healthyclients.ui.viewmodel
|
package com.xjjk.healthyclients.ui.viewmodel
|
||||||
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
import com.xjjk.healthyclients.base.viewmodel.BaseViewModel
|
||||||
import com.xjjk.healthyclients.bean.guidance.GuidanceListBean
|
import com.xjjk.healthyclients.bean.guidance.GuidanceListBean
|
||||||
import com.xjjk.healthyclients.bean.home.HomeBannerBean
|
import com.xjjk.healthyclients.bean.home.HomeBannerBean
|
||||||
@@ -9,10 +8,8 @@ import com.xjjk.healthyclients.data.repository.GuidanceRepository
|
|||||||
import com.xjjk.healthyclients.data.repository.HomeRepository
|
import com.xjjk.healthyclients.data.repository.HomeRepository
|
||||||
import com.xjjk.healthyclients.superfuntion.handleRequest
|
import com.xjjk.healthyclients.superfuntion.handleRequest
|
||||||
import com.xjjk.healthyclients.superfuntion.launch
|
import com.xjjk.healthyclients.superfuntion.launch
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
class HomeViewModel : BaseViewModel() {
|
class HomeViewModel : BaseViewModel() {
|
||||||
|
|
||||||
@@ -22,6 +19,7 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
var homeNoticeList = MutableSharedFlow<MutableList<HomeNoticeBean>?>()
|
var homeNoticeList = MutableSharedFlow<MutableList<HomeNoticeBean>?>()
|
||||||
var homeNoticeDetail = MutableSharedFlow<HomeNoticeBean?>()
|
var homeNoticeDetail = MutableSharedFlow<HomeNoticeBean?>()
|
||||||
var homeBannerList = MutableSharedFlow<MutableList<HomeBannerBean>?>()
|
var homeBannerList = MutableSharedFlow<MutableList<HomeBannerBean>?>()
|
||||||
|
var sessionPicUrl = MutableSharedFlow<String?>()
|
||||||
|
|
||||||
|
|
||||||
var isRefreshing = MutableStateFlow(false)
|
var isRefreshing = MutableStateFlow(false)
|
||||||
@@ -88,17 +86,16 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
* 首页消息轮询
|
* 首页消息轮询
|
||||||
*/
|
*/
|
||||||
fun getHomeNoticeListRepeat() {
|
fun getHomeNoticeListRepeat() {
|
||||||
viewModelScope.launch {
|
launch(
|
||||||
repeat(100) {
|
showDialog = false,
|
||||||
|
{
|
||||||
handleRequest(
|
handleRequest(
|
||||||
HomeRepository.getHomeNoticeList(1, 10),
|
HomeRepository.getHomeNoticeList(1, 10),
|
||||||
successBlock = {
|
successBlock = {
|
||||||
homeNoticeRepeat.emit(it.result)
|
homeNoticeRepeat.emit(it.result)
|
||||||
})
|
})
|
||||||
delay(1000 * 120)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,11 +111,11 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getHomeBannerList(showLocation: String) {
|
fun getHomeBannerList() {
|
||||||
launch(
|
launch(
|
||||||
{
|
{
|
||||||
handleRequest(
|
handleRequest(
|
||||||
HomeRepository.getHomeBannerList(showLocation),
|
HomeRepository.getHomeBannerList(),
|
||||||
successBlock = {
|
successBlock = {
|
||||||
homeBannerList.emit(it.result)
|
homeBannerList.emit(it.result)
|
||||||
})
|
})
|
||||||
@@ -126,4 +123,17 @@ class HomeViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getConSessionPicUrl() {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.getConSessionPicUrl(),
|
||||||
|
successBlock = {
|
||||||
|
sessionPicUrl.emit(it.result)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 633 B |
@@ -15,8 +15,7 @@
|
|||||||
<include
|
<include
|
||||||
android:id="@+id/toolbar_lay"
|
android:id="@+id/toolbar_lay"
|
||||||
layout="@layout/lay_title_bar"
|
layout="@layout/lay_title_bar"
|
||||||
app:darkStyle="@{true}"
|
app:darkStyle="@{true}" />
|
||||||
app:title="@{@string/app_name}" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
@@ -18,21 +18,16 @@
|
|||||||
app:title="@{@string/title_user_banner}" />
|
app:title="@{@string/title_user_banner}" />
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1300dp"
|
|
||||||
android:scaleType="fitXY"
|
|
||||||
android:src="@mipmap/ic_home_banner_detail" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
<ImageView
|
||||||
|
android:id="@+id/img_banner"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:adjustViewBounds="true" />
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
app:mvAnimDuration="1000"
|
app:mvAnimDuration="1000"
|
||||||
app:mvDirection="bottom_to_top"
|
app:mvDirection="bottom_to_top"
|
||||||
app:mvInterval="3000"
|
app:mvInterval="3000"
|
||||||
app:mvSingleLine="false"
|
app:mvSingleLine="true"
|
||||||
app:mvTextColor="#77849E"
|
app:mvTextColor="#77849E"
|
||||||
app:mvTextSize="14sp" />
|
app:mvTextSize="14sp" />
|
||||||
|
|
||||||
@@ -97,36 +97,26 @@
|
|||||||
android:layout_marginHorizontal="6dp"
|
android:layout_marginHorizontal="6dp"
|
||||||
android:layout_marginTop="10dp" />
|
android:layout_marginTop="10dp" />
|
||||||
|
|
||||||
<!-- <com.youth.banner.Banner-->
|
<com.youth.banner.Banner
|
||||||
<!-- android:id="@+id/banner1"-->
|
android:id="@+id/banner1"
|
||||||
<!-- android:layout_width="match_parent"-->
|
|
||||||
<!-- android:layout_height="120dp"-->
|
|
||||||
<!-- android:layout_below="@+id/layout_item1"-->
|
|
||||||
<!-- android:layout_marginHorizontal="12dp"-->
|
|
||||||
<!-- android:layout_marginTop="10dp" />-->
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image1"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="65dp"
|
||||||
android:layout_marginHorizontal="12dp"
|
android:layout_marginHorizontal="12dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="10dp" />
|
||||||
android:background="@mipmap/ic_home_image1" />
|
|
||||||
|
|
||||||
<ImageView
|
<com.youth.banner.Banner
|
||||||
android:id="@+id/image2"
|
android:id="@+id/banner2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:layout_marginHorizontal="12dp"
|
android:layout_marginHorizontal="12dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="10dp" />
|
||||||
android:background="@mipmap/ic_home_image2" />
|
|
||||||
|
|
||||||
<ImageView
|
<com.youth.banner.Banner
|
||||||
android:id="@+id/image3"
|
android:id="@+id/banner3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="120dp"
|
||||||
android:layout_marginHorizontal="12dp"
|
android:layout_marginHorizontal="12dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="10dp" />
|
||||||
android:background="@mipmap/ic_home_image3" />
|
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/layout_item3"
|
android:id="@+id/layout_item3"
|
||||||
@@ -142,20 +132,12 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<!-- <com.youth.banner.Banner-->
|
<com.youth.banner.Banner
|
||||||
<!-- android:id="@+id/banner2"-->
|
android:id="@+id/banner4"
|
||||||
<!-- android:layout_width="match_parent"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:layout_below="@+id/layout_item4"-->
|
|
||||||
<!-- android:layout_marginHorizontal="12dp"-->
|
|
||||||
<!-- android:layout_marginTop="10dp" />-->
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image4"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="120dp"
|
||||||
android:layout_marginHorizontal="12dp"
|
android:layout_marginHorizontal="12dp" />
|
||||||
android:background="@mipmap/ic_home_image4" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -12,8 +12,9 @@
|
|||||||
android:layout_marginTop="10dp">
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="24dp"
|
android:layout_width="20dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
android:background="@mipmap/ic_xiaolaba" />
|
android:background="@mipmap/ic_xiaolaba" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -22,8 +23,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lines="2"
|
android:maxLines="2"
|
||||||
android:textColor="@color/color_theme_or_black_33"
|
android:textColor="@color/color_theme_or_black_33"
|
||||||
|
android:textStyle="bold"
|
||||||
tools:text="这是一个测试通知的内容,主要内容就是写一些文字,然后看看写的怎么样.这是一个测试通知的内容,主要内容就是写一些文字,然后看看写的怎么样" />
|
tools:text="这是一个测试通知的内容,主要内容就是写一些文字,然后看看写的怎么样.这是一个测试通知的内容,主要内容就是写一些文字,然后看看写的怎么样" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -32,9 +34,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/tv_title"
|
android:layout_below="@+id/tv_title"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:textColor="@color/color_theme_or_black_33"
|
android:textColor="@color/color_theme_or_black_33"
|
||||||
android:textSize="@dimen/txt12"
|
android:textSize="@dimen/txt12"
|
||||||
tools:text="2025-01-01" />
|
tools:text="2025-01-01" />
|
||||||
@@ -43,6 +45,6 @@
|
|||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="0.5dp"
|
||||||
android:background="@color/text_black_99" />
|
android:background="@color/text_black_99" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
Reference in New Issue
Block a user