|
|
@@ -2,36 +2,27 @@ package com.adealink.weparty.profile.userprofile
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
import androidx.activity.viewModels
|
|
|
-import androidx.lifecycle.lifecycleScope
|
|
|
import com.adealink.frame.aab.util.getCompatColor
|
|
|
import com.adealink.frame.aab.util.getCompatString
|
|
|
import com.adealink.frame.base.fastLazy
|
|
|
+import com.adealink.frame.data.json.froJsonErrorNull
|
|
|
import com.adealink.frame.mvvm.view.viewBinding
|
|
|
import com.adealink.frame.router.Router
|
|
|
import com.adealink.frame.router.annotation.BindExtra
|
|
|
import com.adealink.frame.router.annotation.RouterUri
|
|
|
-import com.adealink.frame.util.onClick
|
|
|
-import com.adealink.weparty.R
|
|
|
import com.adealink.weparty.commonui.BaseActivity
|
|
|
import com.adealink.weparty.commonui.ext.dp
|
|
|
import com.adealink.weparty.commonui.ext.gone
|
|
|
-import com.adealink.weparty.commonui.ext.onSuccess
|
|
|
-import com.adealink.weparty.commonui.ext.show
|
|
|
import com.adealink.weparty.commonui.toast.util.showToast
|
|
|
import com.adealink.weparty.commonui.widget.banner.adapter.PreviewImageViewBannerAdapter
|
|
|
import com.adealink.weparty.commonui.widget.banner.indicator.CircleIndicator
|
|
|
import com.adealink.weparty.module.level.LevelModule
|
|
|
import com.adealink.weparty.module.profile.Profile
|
|
|
import com.adealink.weparty.module.profile.ProfileModule
|
|
|
-import com.adealink.weparty.module.profile.data.SVIPLevel
|
|
|
-import com.adealink.weparty.module.profile.data.SVIPLevel.Companion.isSatisfyLevel
|
|
|
-import com.adealink.weparty.module.webview.Web
|
|
|
import com.adealink.weparty.profile.databinding.ActivityProfileCoverPreviewBinding
|
|
|
import com.adealink.weparty.profile.viewmodel.ProfileViewModel
|
|
|
import com.adealink.weparty.profile.viewmodel.ProfileViewModelFactory
|
|
|
-import com.adealink.weparty.url.UrlConfig
|
|
|
import com.qmuiteam.qmui.widget.util.QMUIStatusBarHelper
|
|
|
-import kotlinx.coroutines.launch
|
|
|
import com.adealink.weparty.R as APP_R
|
|
|
|
|
|
@RouterUri(path = [Profile.UserProfileCover.PATH], desc = "个人封面背景预览")
|
|
|
@@ -59,8 +50,9 @@ class ProfileCoverPreviewActivity : BaseActivity() {
|
|
|
setNavigationBarColor(APP_R.color.black)
|
|
|
setContentView(binding.root)
|
|
|
binding.topBar.setToTransparentMode()
|
|
|
- addSVipSkipBtn()
|
|
|
|
|
|
+
|
|
|
+ binding.tvChangeProfileCover.gone()
|
|
|
binding.tvChangeProfileCover.setOnClickListener {
|
|
|
val myLevel = ProfileModule.getMyUserInfo()?.level ?: 0
|
|
|
if (myLevel < LevelModule.LEVEL_CUSTOM_PROFILE_BG) {
|
|
|
@@ -79,7 +71,6 @@ class ProfileCoverPreviewActivity : BaseActivity() {
|
|
|
|
|
|
if (uid != ProfileModule.getMyUid()) {
|
|
|
binding.tvChangeProfileCover.gone()
|
|
|
- binding.clSvipSkip.gone()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -107,39 +98,17 @@ class ProfileCoverPreviewActivity : BaseActivity() {
|
|
|
}
|
|
|
|
|
|
private fun setCover() {
|
|
|
- profileViewModel.getUidUserInfo(uid = uid, true).observe(this) {
|
|
|
- it.onSuccess { userInfo ->
|
|
|
- lifecycleScope.launch {
|
|
|
- val coverList = profileViewModel.getUserCoverList(userInfo)
|
|
|
- images.clear()
|
|
|
- images.addAll(coverList)
|
|
|
- binding.vpImages.setDatas(images)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- private val images = mutableListOf<String>()
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加SVIP跳转按钮
|
|
|
- * 满足1:用户资料卡封面;2:Gif图;3:没有满足SVIP等级才显示SVIP跳转按钮
|
|
|
- */
|
|
|
- private fun addSVipSkipBtn() {
|
|
|
- val isSatisfyLevel =
|
|
|
- SVIPLevel.SEVEN.isSatisfyLevel(ProfileModule.getMyUserInfo()?.sVipLevel)
|
|
|
- if (!isSatisfyLevel) {
|
|
|
- binding.clSvipSkip.show()
|
|
|
- val builder = StringBuilder()
|
|
|
- .append(getCompatString(R.string.imageselect_open_svip_tips))
|
|
|
- .append(" ")
|
|
|
- .append(getString(R.string.imageselect_open_svip_go))
|
|
|
- binding.clSvipSkip.text = builder.toString()
|
|
|
- binding.clSvipSkip.onClick {
|
|
|
- Router.build(this, Web.FullScreen.PATH)
|
|
|
- .putExtra(Web.Common.EXTRA_URL, UrlConfig.svip)
|
|
|
- .start()
|
|
|
- }
|
|
|
- }
|
|
|
+ val userInfo = ProfileModule.getMyUserInfo() ?: return
|
|
|
+ val avatarUrl = userInfo.url
|
|
|
+ val avatarIndex = userInfo.avatarIndex //头像在照片墙中的位置
|
|
|
+ val photoWallList = froJsonErrorNull<List<String>>(userInfo.photoWall) ?: listOf()
|
|
|
+
|
|
|
+ val bannerList = mutableListOf<String>()
|
|
|
+ bannerList.addAll(photoWallList)
|
|
|
+ bannerList.add(avatarIndex, avatarUrl)
|
|
|
+ binding.vpImages.setDatas(bannerList)
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|