装扮商城新增充值入口
This commit is contained in:
@@ -52,6 +52,7 @@ class DecorationCommonFragment : BaseViewBindingFragment<FragmentDecorationCommo
|
||||
rvDelegate = RVDelegate.Builder<DecorationInfo>()
|
||||
.setAdapter(decorationAdapter)
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setRefreshLayout(binding.swipeRefresh)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyView(mContext, "暂无装扮"))
|
||||
.setLayoutManager(
|
||||
if (dressType == DecorationStoreActivity.TAB_USER_CARD) {
|
||||
@@ -61,6 +62,9 @@ class DecorationCommonFragment : BaseViewBindingFragment<FragmentDecorationCommo
|
||||
}
|
||||
)
|
||||
.build()
|
||||
binding.swipeRefresh.setOnRefreshListener {
|
||||
decorationViewModel.getDecorationInfoList(dressType)
|
||||
}
|
||||
decorationViewModel.getDecorationInfoList(dressType)
|
||||
decorationViewModel.decorationInfoListLiveData.observe(viewLifecycleOwner) {
|
||||
rvDelegate.loadData(it)
|
||||
|
@@ -17,11 +17,18 @@ import com.yizhuan.erban.decoration.view.widgets.CarMagicIndicator
|
||||
import com.yizhuan.erban.decoration.view.widgets.MyDecorationMagicIndicator
|
||||
import com.yizhuan.erban.decoration.viewmodel.DecorationViewModel
|
||||
import com.yizhuan.erban.home.helper.BannerHelper
|
||||
import com.yizhuan.erban.ui.pay.ChargeActivity
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.ViewPagerHelper
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import com.yizhuan.xchat_android_core.Constants
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
|
||||
import com.yizhuan.xchat_android_library.utils.FormatUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
@ActLayoutRes(R.layout.activity_decoration_store)
|
||||
class DecorationStoreActivity : BaseViewBindingActivity<ActivityDecorationStoreBinding>(),
|
||||
@@ -47,6 +54,7 @@ class DecorationStoreActivity : BaseViewBindingActivity<ActivityDecorationStoreB
|
||||
private val decorationViewModel: DecorationViewModel by viewModels()
|
||||
|
||||
override fun init() {
|
||||
EventBus.getDefault().register(this)
|
||||
initWhiteTitleBar("装扮商城")
|
||||
mTitleBar?.addAction(object : TitleBar.TextAction(
|
||||
"我的装扮", Color.parseColor("#999999")
|
||||
@@ -57,13 +65,17 @@ class DecorationStoreActivity : BaseViewBindingActivity<ActivityDecorationStoreB
|
||||
})
|
||||
mPosition = intent.getIntExtra(Constants.KEY_POSITION, 0)
|
||||
initViews()
|
||||
decorationViewModel.bannerLiveData.observe(this)
|
||||
{
|
||||
decorationViewModel.bannerLiveData.observe(this) {
|
||||
BannerHelper.setBanner(binding.rollView, it)
|
||||
}
|
||||
|
||||
binding.tvCharge.setOnClickListener {
|
||||
ChargeActivity.start(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
onWalletInfoUpdate(null)
|
||||
val viewPager = binding.viewpager
|
||||
val mMagicIndicator = binding.viewIndicator
|
||||
val tabInfoList: MutableList<TabInfo> = ArrayList(5)
|
||||
@@ -90,15 +102,6 @@ class DecorationStoreActivity : BaseViewBindingActivity<ActivityDecorationStoreB
|
||||
return DecorationCommonFragment.newInstance(position)
|
||||
}
|
||||
}
|
||||
viewPager.addOnPageChangeListener(object : SimpleOnPageChangeListener() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
if (position == 1) {
|
||||
mMagicIndicator.findViewById<View>(R.id.car_badge_garage).visibility =
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
})
|
||||
viewPager.currentItem = mPosition
|
||||
}
|
||||
|
||||
@@ -106,6 +109,12 @@ class DecorationStoreActivity : BaseViewBindingActivity<ActivityDecorationStoreB
|
||||
binding.viewpager.currentItem = position
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWalletInfoUpdate(event: UpdateWalletInfoEvent?) {
|
||||
binding.tvDiamondNum.text =
|
||||
FormatUtils.formatBigInteger(PayModel.get().currentWalletInfo?.diamondNum ?: 0.0)
|
||||
}
|
||||
|
||||
override fun needSteepStateBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
@@ -116,4 +125,10 @@ class DecorationStoreActivity : BaseViewBindingActivity<ActivityDecorationStoreB
|
||||
StatusBarUtil.StatusBarLightMode(this)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -423,8 +423,9 @@ class MeFragment : BaseFragment(), View.OnClickListener {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWalletInfoUpdate(event: UpdateWalletInfoEvent?) {
|
||||
mBinding.tvDiamondNum.text = PayModel.get().currentWalletInfo?.diamondNum?.toString()
|
||||
?: "0"
|
||||
mBinding.tvDiamondNum.text =
|
||||
FormatUtils.formatBigInteger(PayModel.get().currentWalletInfo?.diamondNum ?: 0.0)
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
|
@@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_normal_1c1b22">
|
||||
android:background="@color/bg_normal_1c1b22"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.yizhuan.erban.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
@@ -16,7 +17,6 @@
|
||||
android:id="@+id/fl_roll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/title_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView
|
||||
@@ -36,14 +36,60 @@
|
||||
android:id="@+id/view_indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_below="@+id/fl_roll_view"
|
||||
android:layout_marginTop="@dimen/dp_10" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/view_indicator" />
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:baselineAligned="true"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_charge_diamond"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="我的钻石"
|
||||
android:layout_marginStart="15dp"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_diamond_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textColor="#ffffbc51"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_charge"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="充值"
|
||||
android:background="@drawable/bg_common_confirm"
|
||||
android:gravity="center"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@@ -22,7 +22,9 @@
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/view_pic_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@@ -61,7 +61,7 @@ object DecorationModel : BaseModel() {
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dress/shop/send")
|
||||
@POST("/dress/shop/give")
|
||||
fun sendDecoration(
|
||||
@Field("dressType") dressType: Int,
|
||||
@Field("dressId") dressId: Int,
|
||||
|
Reference in New Issue
Block a user