[Modify]完成兑换权限功能
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
package com.yizhuan.erban.association
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.association.AssociationModel
|
||||
import com.yizhuan.xchat_android_core.association.HallListInfo
|
||||
import com.yizhuan.xchat_android_core.association.ClanListInfo
|
||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
|
||||
class AssociationViewModel : BaseViewModel() {
|
||||
|
||||
//公会列表
|
||||
private val _clanListLiveData = MutableLiveData<List<ClanListInfo>?>()
|
||||
val clanListLiveData: MutableLiveData<List<ClanListInfo>?> = _clanListLiveData
|
||||
|
||||
//牌照房列表
|
||||
private val _hallListLiveData = MutableLiveData<List<HallListInfo>?>()
|
||||
val hallListLiveData: MutableLiveData<List<HallListInfo>?> = _hallListLiveData
|
||||
|
||||
fun getClanList() {
|
||||
safeLaunch(
|
||||
block = {
|
||||
_clanListLiveData.value = AssociationModel.getClanList()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getHallList() {
|
||||
safeLaunch(
|
||||
block = {
|
||||
_hallListLiveData.value = AssociationModel.getHallList()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -8,8 +8,8 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.netease.nim.uikit.StatusBarUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.association.fragment.AssociationFragment
|
||||
import com.yizhuan.erban.association.fragment.AssociationRoomFragment
|
||||
import com.yizhuan.erban.module_hall.hall.fragment.AssociationFragment
|
||||
import com.yizhuan.erban.module_hall.hall.fragment.AssociationRoomFragment
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.common.CommonPagerAdapter
|
||||
import com.yizhuan.erban.databinding.ActivityAssociationBinding
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/ic_close_exchange.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_close_exchange.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 718 B |
BIN
app/src/main/res/drawable-xhdpi/ic_close_exchange_tip.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_close_exchange_tip.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 936 B |
13
app/src/main/res/drawable/bg_common_confirm_15.xml
Normal file
13
app/src/main/res/drawable/bg_common_confirm_15.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#19EBFF"
|
||||
android:startColor="#ED66FF"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners android:radius="@dimen/dp_15" />
|
||||
|
||||
</shape>
|
13
app/src/main/res/drawable/bg_common_confirm_30.xml
Normal file
13
app/src/main/res/drawable/bg_common_confirm_30.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#19EBFF"
|
||||
android:startColor="#ED66FF"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
|
||||
</shape>
|
8
app/src/main/res/drawable/bg_common_confirm_gray_15.xml
Normal file
8
app/src/main/res/drawable/bg_common_confirm_gray_15.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/color_E6E6F0" />
|
||||
<corners android:radius="@dimen/dp_15" />
|
||||
|
||||
</shape>
|
8
app/src/main/res/drawable/bg_common_confirm_gray_30.xml
Normal file
8
app/src/main/res/drawable/bg_common_confirm_gray_30.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/color_E6E6F0" />
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
|
||||
</shape>
|
121
app/src/main/res/layout/layout_close_exchange_dialog.xml
Normal file
121
app/src/main/res/layout/layout_close_exchange_dialog.xml
Normal file
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="310dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/shape_white_12dp_round">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:src="@drawable/ic_close_exchange"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_25"
|
||||
android:gravity="center"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/close_exchange"
|
||||
android:textColor="@color/text_title_color"
|
||||
android:textSize="@dimen/sp_17"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_close_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:src="@drawable/ic_close_exchange_tip"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_sure_close"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_sure_close"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_sure_close" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_sure_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:text="@string/sure_to_close"
|
||||
android:textColor="@color/text_title_color"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_name"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_close_tip"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_message" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_9168FA"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/tv_sure_close"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_sure_tip"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_sure_close"
|
||||
tools:text="PEKO小新" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_sure_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:text="@string/gold_exchange_power"
|
||||
android:textColor="@color/text_title_color"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/tv_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_name" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_sure_tip">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginEnd="@dimen/dp_28"
|
||||
android:background="@drawable/bg_common_confirm_gray_30"
|
||||
android:gravity="center"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_ok"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="38dp"
|
||||
android:background="@drawable/bg_common_confirm"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_ok"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_bottom"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -5061,6 +5061,9 @@
|
||||
<string name="exchangeable">可兌換</string>
|
||||
<string name="no_more_members_with_gold_for_now">暫無更多不可兌換金幣的成員~</string>
|
||||
<string name="open_exchange">開啓兌換</string>
|
||||
<string name="close_exchange">關閉兌換</string>
|
||||
<string name="gold_coin_balance">金幣餘額:%s</string>
|
||||
<string name="sure_to_close">確定關閉</string>
|
||||
<string name="gold_exchange_power">的金幣兌換權限嗎?</string>
|
||||
|
||||
</resources>
|
@@ -2,11 +2,19 @@ package com.yizhuan.erban.module_hall.hall.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.netease.nim.uikit.StatusBarUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.common.util.Utils
|
||||
import com.yizhuan.erban.databinding.ActivityExchangePermissionBinding
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.EnableExchangeAdapter
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.NoExchangeAdapter
|
||||
import com.yizhuan.erban.module_hall.hall.view.dialog.CloseExchangeTipDialog
|
||||
import com.yizhuan.erban.module_hall.viewmodel.AssociationViewModel
|
||||
import com.yizhuan.erban.ui.widget.recyclerview.decoration.ColorDecoration
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
|
||||
/**
|
||||
@@ -17,6 +25,10 @@ class ExchangePermissionActivity : BaseViewBindingActivity<ActivityExchangePermi
|
||||
|
||||
private val mNoExchangeAdapter by lazy { NoExchangeAdapter() }
|
||||
|
||||
private val mEnableExchangeAdapter by lazy { EnableExchangeAdapter() }
|
||||
|
||||
private val associationViewModel: AssociationViewModel by viewModels()
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context) {
|
||||
@@ -27,6 +39,65 @@ class ExchangePermissionActivity : BaseViewBindingActivity<ActivityExchangePermi
|
||||
|
||||
override fun init() {
|
||||
initWhiteTitleBar(ResUtil.getString(R.string.exchange_permission_setting))
|
||||
|
||||
binding.mRecyclerViewNo.addItemDecoration(
|
||||
ColorDecoration(
|
||||
ContextCompat.getColor(this, R.color.color_F3F5FA),
|
||||
0, Utils.dip2px(this, 1f), false
|
||||
)
|
||||
)
|
||||
binding.mRecyclerViewNo.adapter = mNoExchangeAdapter
|
||||
binding.mRecyclerViewEnable.addItemDecoration(
|
||||
ColorDecoration(
|
||||
ContextCompat.getColor(this, R.color.color_F3F5FA),
|
||||
0, Utils.dip2px(this, 1f), false
|
||||
)
|
||||
)
|
||||
binding.mRecyclerViewEnable.adapter = mEnableExchangeAdapter
|
||||
|
||||
mNoExchangeAdapter.setOnItemChildClickListener { _, _, position ->
|
||||
associationViewModel.operateMemberExchange(
|
||||
0,
|
||||
mEnableExchangeAdapter.data[position].uid
|
||||
)
|
||||
}
|
||||
|
||||
mEnableExchangeAdapter.setOnItemChildClickListener { _, _, position ->
|
||||
CloseExchangeTipDialog(context).apply {
|
||||
setName(mEnableExchangeAdapter.data[position].nick)
|
||||
setOnActionListener(object : CloseExchangeTipDialog.OnActionListener {
|
||||
override fun onOk() {
|
||||
associationViewModel.operateMemberExchange(
|
||||
0,
|
||||
mEnableExchangeAdapter.data[position].uid
|
||||
)
|
||||
}
|
||||
})
|
||||
}.show()
|
||||
}
|
||||
|
||||
associationViewModel.loadingLiveData.observe(this) { loading ->
|
||||
if (loading) dialogManager.showProgressDialog(this)
|
||||
else dialogManager.dismissDialog()
|
||||
}
|
||||
|
||||
associationViewModel.operateMemberExchangeLiveData.observe(this) {
|
||||
associationViewModel.getMemberExchangeList()
|
||||
}
|
||||
|
||||
associationViewModel.memberExchangeLiveData.observe(this) { list ->
|
||||
list?.let { memberExchangeInfo ->
|
||||
val noList = memberExchangeInfo.filter { it.exchangeAuthStatus == 0 }
|
||||
.sortedByDescending { it.golds }
|
||||
val enableList = memberExchangeInfo.filter { it.exchangeAuthStatus == 1 }
|
||||
.sortedByDescending { it.golds }
|
||||
mNoExchangeAdapter.setNewData(noList)
|
||||
mEnableExchangeAdapter.setNewData(enableList)
|
||||
binding.group.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
associationViewModel.getMemberExchangeList()
|
||||
}
|
||||
|
||||
override fun needSteepStateBar(): Boolean {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.yizhuan.erban.association.adapter;
|
||||
package com.yizhuan.erban.module_hall.hall.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
@@ -8,7 +8,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||
import com.yizhuan.xchat_android_core.association.ClanListInfo;
|
||||
import com.yizhuan.xchat_android_core.association.bean.ClanListInfo;
|
||||
|
||||
/**
|
||||
* Created by yudi
|
@@ -1,13 +1,12 @@
|
||||
package com.yizhuan.erban.association.adapter;
|
||||
package com.yizhuan.erban.module_hall.hall.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||
import com.yizhuan.xchat_android_core.association.HallListInfo;
|
||||
import com.yizhuan.xchat_android_core.association.bean.HallListInfo;
|
||||
|
||||
/**
|
||||
* Created by yudi
|
@@ -1,30 +1,50 @@
|
||||
package com.yizhuan.erban.module_hall.hall.adapter
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.SuperAdminInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import com.yizhuan.xchat_android_core.association.bean.MemberExchangeInfo
|
||||
|
||||
/**
|
||||
* 可兑换
|
||||
* Created by wushaocheng on 2023/2/13.
|
||||
*/
|
||||
class EnableExchangeAdapter :
|
||||
BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_hall_exchange) {
|
||||
BaseQuickAdapter<MemberExchangeInfo, BaseViewHolder>(R.layout.item_hall_exchange) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: String) {
|
||||
override fun convert(helper: BaseViewHolder, item: MemberExchangeInfo) {
|
||||
|
||||
// ImageLoadUtils.loadAvatar(item.avatar, helper.getView(R.id.iv_avatar))
|
||||
// helper.setText(R.id.tv_nickname, item.nick)
|
||||
// .setText(R.id.tv_id, item.erbanNo)
|
||||
// .setText(R.id.tv_set, if (item.hasSet) ResUtil.getString(R.string.hall_adapter_searchadminadapter_01) else ResUtil.getString(R.string.hall_adapter_searchadminadapter_02))
|
||||
// .setEnabled(R.id.tv_set, !item.hasSet)
|
||||
// .setImageResource(
|
||||
// R.id.iv_gender,
|
||||
// if (item.gender == 1) R.drawable.ic_gender_male else R.drawable.ic_gender_female
|
||||
// )
|
||||
// .addOnClickListener(R.id.tv_set)
|
||||
ImageLoadUtils.loadAvatar(item.avatar, helper.getView(R.id.iv_avatar))
|
||||
ImageLoadUtils.loadImage(
|
||||
mContext,
|
||||
item.userLevelVo?.experUrl,
|
||||
helper.getView(R.id.iv_user_level)
|
||||
)
|
||||
ImageLoadUtils.loadImage(
|
||||
mContext,
|
||||
item.userLevelVo?.charmUrl,
|
||||
helper.getView(R.id.iv_user_charm)
|
||||
)
|
||||
helper.getView<AppCompatTextView>(R.id.tv_confirm).background = ContextCompat.getDrawable(
|
||||
mContext,
|
||||
R.drawable.bg_common_confirm_gray_15
|
||||
)
|
||||
helper.setText(R.id.tv_confirm, mContext.getString(R.string.close_exchange))
|
||||
.setTextColor(R.id.tv_confirm, ContextCompat.getColor(mContext, R.color.color_B3B3C3))
|
||||
.setText(R.id.tv_nickname, item.nick)
|
||||
.setImageResource(
|
||||
R.id.iv_gender,
|
||||
if (item.gender == 1) R.drawable.ic_gender_male else R.drawable.ic_gender_female
|
||||
)
|
||||
.setText(R.id.tv_id, mContext.getString(R.string.text_user_id, item.erbanNo.toString()))
|
||||
.setText(R.id.tv_room_name, item.hallName)
|
||||
.setText(
|
||||
R.id.tv_gold_balance,
|
||||
mContext.getString(R.string.gold_coin_balance, item.golds.toString())
|
||||
)
|
||||
.addOnClickListener(R.id.tv_confirm)
|
||||
}
|
||||
}
|
@@ -4,27 +4,30 @@ import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.SuperAdminInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import com.yizhuan.xchat_android_core.association.bean.MemberExchangeInfo
|
||||
|
||||
/**
|
||||
* 不可兑换
|
||||
* Created by wushaocheng on 2023/2/13.
|
||||
*/
|
||||
class NoExchangeAdapter :
|
||||
BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_hall_exchange) {
|
||||
BaseQuickAdapter<MemberExchangeInfo, BaseViewHolder>(R.layout.item_hall_exchange) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: String) {
|
||||
|
||||
// ImageLoadUtils.loadAvatar(item.avatar, helper.getView(R.id.iv_avatar))
|
||||
// helper.setText(R.id.tv_nickname, item.nick)
|
||||
// .setText(R.id.tv_id, item.erbanNo)
|
||||
// .setText(R.id.tv_set, if (item.hasSet) ResUtil.getString(R.string.hall_adapter_searchadminadapter_01) else ResUtil.getString(R.string.hall_adapter_searchadminadapter_02))
|
||||
// .setEnabled(R.id.tv_set, !item.hasSet)
|
||||
// .setImageResource(
|
||||
// R.id.iv_gender,
|
||||
// if (item.gender == 1) R.drawable.ic_gender_male else R.drawable.ic_gender_female
|
||||
// )
|
||||
// .addOnClickListener(R.id.tv_set)
|
||||
override fun convert(helper: BaseViewHolder, item: MemberExchangeInfo) {
|
||||
ImageLoadUtils.loadAvatar(item.avatar, helper.getView(R.id.iv_avatar))
|
||||
ImageLoadUtils.loadImage(mContext, item.userLevelVo?.experUrl, helper.getView(R.id.iv_user_level))
|
||||
ImageLoadUtils.loadImage(mContext, item.userLevelVo?.charmUrl, helper.getView(R.id.iv_user_charm))
|
||||
helper.setText(R.id.tv_nickname, item.nick)
|
||||
.setImageResource(
|
||||
R.id.iv_gender,
|
||||
if (item.gender == 1) R.drawable.ic_gender_male else R.drawable.ic_gender_female
|
||||
)
|
||||
.setText(R.id.tv_id, mContext.getString(R.string.text_user_id, item.erbanNo.toString()))
|
||||
.setText(R.id.tv_room_name, item.hallName)
|
||||
.setText(
|
||||
R.id.tv_gold_balance,
|
||||
mContext.getString(R.string.gold_coin_balance, item.golds.toString())
|
||||
)
|
||||
.addOnClickListener(R.id.tv_confirm)
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.yizhuan.erban.association.fragment
|
||||
package com.yizhuan.erban.module_hall.hall.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@@ -6,14 +6,14 @@ import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.association.AssociationViewModel
|
||||
import com.yizhuan.erban.association.adapter.AssociationAdapter
|
||||
import com.yizhuan.erban.module_hall.viewmodel.AssociationViewModel
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.AssociationAdapter
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentAssociationBinding
|
||||
import com.yizhuan.erban.module_hall.hall.activity.ModuleClanActivity
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.association.ClanListInfo
|
||||
import com.yizhuan.xchat_android_core.association.bean.ClanListInfo
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper
|
||||
@@ -39,7 +39,8 @@ class AssociationFragment : BaseViewBindingFragment<FragmentAssociationBinding>(
|
||||
private val associationViewModel: AssociationViewModel by viewModels()
|
||||
|
||||
override fun init() {
|
||||
associationAdapter = AssociationAdapter()
|
||||
associationAdapter =
|
||||
AssociationAdapter()
|
||||
associationAdapter.onItemClickListener =
|
||||
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
|
||||
val info = associationAdapter.getItem(position)
|
@@ -1,4 +1,4 @@
|
||||
package com.yizhuan.erban.association.fragment
|
||||
package com.yizhuan.erban.module_hall.hall.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
@@ -14,17 +14,14 @@ import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.association.AssociationViewModel
|
||||
import com.yizhuan.erban.association.adapter.AssociationRoomAdapter
|
||||
import com.yizhuan.erban.module_hall.viewmodel.AssociationViewModel
|
||||
import com.yizhuan.erban.module_hall.hall.adapter.AssociationRoomAdapter
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentAssociationRoomBinding
|
||||
import com.yizhuan.erban.module_hall.hall.activity.ModuleHallActivity
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.association.HallListInfo
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper
|
||||
import com.yizhuan.xchat_android_core.association.bean.HallListInfo
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
|
||||
|
||||
@@ -95,7 +92,8 @@ class AssociationRoomFragment : BaseViewBindingFragment<FragmentAssociationRoomB
|
||||
}
|
||||
false
|
||||
})
|
||||
associationRoomAdapter = AssociationRoomAdapter()
|
||||
associationRoomAdapter =
|
||||
AssociationRoomAdapter()
|
||||
associationRoomAdapter.onItemClickListener =
|
||||
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
|
||||
val info = associationRoomAdapter.getItem(position)
|
@@ -0,0 +1,85 @@
|
||||
package com.yizhuan.erban.module_hall.hall.view.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.widget.dialog.BaseDialog;
|
||||
|
||||
/**
|
||||
* @author wushaocheng
|
||||
* @Description 关闭兑换弹窗
|
||||
* @Date 2013/2/14
|
||||
*/
|
||||
public class CloseExchangeTipDialog extends BaseDialog {
|
||||
|
||||
private String name = "";
|
||||
|
||||
public CloseExchangeTipDialog(Context context) {
|
||||
super(context, R.style.dialog);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.setCancelable(true);
|
||||
this.setCanceledOnTouchOutside(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.layout_close_exchange_dialog);
|
||||
|
||||
TextView name = findViewById(R.id.tv_name);
|
||||
if (name != null) {
|
||||
name.setText(this.name);
|
||||
}
|
||||
|
||||
ImageView close = findViewById(R.id.iv_close);
|
||||
if (close != null) {
|
||||
close.setOnClickListener(view -> {
|
||||
this.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
TextView ok = findViewById(R.id.btn_ok);
|
||||
if (ok != null) {
|
||||
ok.setOnClickListener(v -> {
|
||||
this.dismiss();
|
||||
if (l != null) {
|
||||
l.onOk();
|
||||
}
|
||||
});
|
||||
}
|
||||
TextView cancel = findViewById(R.id.btn_cancel);
|
||||
if (cancel != null) {
|
||||
cancel.setOnClickListener(v -> {
|
||||
this.dismiss();
|
||||
if (l != null) {
|
||||
l.onCancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private OnActionListener l;
|
||||
|
||||
public void setOnActionListener(OnActionListener l) {
|
||||
this.l = l;
|
||||
}
|
||||
|
||||
public interface OnActionListener {
|
||||
default void onOk() {
|
||||
}
|
||||
|
||||
default void onCancel() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -8,19 +8,10 @@ import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.FragmentAssociationBinding
|
||||
import com.yizhuan.erban.earn.EarnRecordViewModel
|
||||
import com.yizhuan.erban.earn.adapter.GoldDetailAdapter
|
||||
import com.yizhuan.erban.earn.adapter.GoldRecordAdapter
|
||||
import com.yizhuan.erban.module_hall.hall.activity.ModuleClanActivity
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.xchat_android_core.association.ClanListInfo
|
||||
import com.yizhuan.xchat_android_core.earn.bean.GoldRecordInfo
|
||||
import com.yizhuan.xchat_android_core.earn.bean.HallMemberGoldFlowInfo
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper
|
||||
import com.yizhuan.xchat_android_library.common.util.Logger
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil
|
||||
import java.math.BigDecimal
|
||||
|
||||
/**
|
||||
* 金币明细
|
||||
|
@@ -0,0 +1,63 @@
|
||||
package com.yizhuan.erban.module_hall.viewmodel
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.association.bean.ClanListInfo
|
||||
import com.yizhuan.xchat_android_core.association.bean.HallListInfo
|
||||
import com.yizhuan.xchat_android_core.association.bean.MemberExchangeInfo
|
||||
import com.yizhuan.xchat_android_core.association.model.AssociationModel
|
||||
|
||||
class AssociationViewModel : BaseViewModel() {
|
||||
|
||||
//公会列表
|
||||
private val _clanListLiveData = MutableLiveData<List<ClanListInfo>?>()
|
||||
val clanListLiveData: MutableLiveData<List<ClanListInfo>?> = _clanListLiveData
|
||||
|
||||
//牌照房列表
|
||||
private val _hallListLiveData = MutableLiveData<List<HallListInfo>?>()
|
||||
val hallListLiveData: MutableLiveData<List<HallListInfo>?> = _hallListLiveData
|
||||
|
||||
//获取家族下的兑换权限管理的成员列表
|
||||
private val _memberExchangeLiveData = MutableLiveData<List<MemberExchangeInfo>?>()
|
||||
val memberExchangeLiveData: MutableLiveData<List<MemberExchangeInfo>?> = _memberExchangeLiveData
|
||||
|
||||
//修改兑换权限管理
|
||||
private val _operateMemberExchangeLiveData = MutableLiveData<String>()
|
||||
val operateMemberExchangeLiveData: MutableLiveData<String> = _operateMemberExchangeLiveData
|
||||
|
||||
fun getClanList() {
|
||||
safeLaunch(
|
||||
block = {
|
||||
_clanListLiveData.value = AssociationModel.getClanList()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getHallList() {
|
||||
safeLaunch(
|
||||
block = {
|
||||
_hallListLiveData.value = AssociationModel.getHallList()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun getMemberExchangeList() {
|
||||
safeLaunch(
|
||||
true,
|
||||
block = {
|
||||
_memberExchangeLiveData.value = AssociationModel.getMemberExchangeList()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun operateMemberExchange(status: Int, targetUid: Long) {
|
||||
safeLaunch(
|
||||
true,
|
||||
block = {
|
||||
_operateMemberExchangeLiveData.value =
|
||||
AssociationModel.operateMemberExchange(status, targetUid)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@@ -4,13 +4,15 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_F3F5FA"
|
||||
tools:context=".module_hall.hall.activity.ExchangePermissionActivity">
|
||||
|
||||
<com.yizhuan.erban.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:background="@color/color_white"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -66,4 +68,11 @@
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvExchangeable" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group"
|
||||
android:visibility="invisible"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="tvInconvertibility,mRecyclerViewNo,tvNoMore,tvExchangeable,mRecyclerViewEnable" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
tools:background="@color/bg_secondary_2a2a39">
|
||||
android:background="@color/color_white">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
@@ -40,7 +40,7 @@
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_user_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="17dp"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:adjustViewBounds="true"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_gender"
|
||||
@@ -50,7 +50,7 @@
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_user_charm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="17dp"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:adjustViewBounds="true"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_user_level"
|
||||
@@ -111,11 +111,11 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/view_room_name" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_set"
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:background="@drawable/bg_common_confirm"
|
||||
android:background="@drawable/bg_common_confirm_15"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/dp_8"
|
||||
android:paddingEnd="@dimen/dp_8"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.yizhuan.xchat_android_core.association;
|
||||
package com.yizhuan.xchat_android_core.association.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.yizhuan.xchat_android_core.association;
|
||||
package com.yizhuan.xchat_android_core.association.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package com.yizhuan.xchat_android_core.association.bean
|
||||
|
||||
import lombok.Data
|
||||
|
||||
@Data
|
||||
data class MemberExchangeInfo(
|
||||
val avatar: String = "",
|
||||
val erbanNo: Int = 0,
|
||||
val exchangeAuthStatus: Int = 0,
|
||||
val gender: Int = 0,
|
||||
val golds: Int = 0,
|
||||
val hallName: String = "",
|
||||
val hallRoleType: Int = 0,
|
||||
val isClanElder: Boolean = false,
|
||||
val manageHall: Boolean = false,
|
||||
val nick: String = "",
|
||||
val roleType: Int = 0,
|
||||
val uid: Long = 0L,
|
||||
val userLevelVo: UserLevelInfo? = null
|
||||
)
|
@@ -0,0 +1,17 @@
|
||||
package com.yizhuan.xchat_android_core.association.bean
|
||||
|
||||
import lombok.Data
|
||||
|
||||
@Data
|
||||
data class UserLevelInfo(
|
||||
val charmAmount: Int = 0,
|
||||
val charmLevelGrp: String = "",
|
||||
val charmLevelName: String = "",
|
||||
val charmLevelSeq: Int = 0,
|
||||
val charmUrl: String = "",
|
||||
val experAmount: Int = 0,
|
||||
val experLevelGrp: String = "",
|
||||
val experLevelName: String = "",
|
||||
val experLevelSeq: Int = 0,
|
||||
val experUrl: String = ""
|
||||
)
|
@@ -0,0 +1,68 @@
|
||||
package com.yizhuan.xchat_android_core.association.model
|
||||
|
||||
import com.yizhuan.xchat_android_core.association.bean.ClanListInfo
|
||||
import com.yizhuan.xchat_android_core.association.bean.HallListInfo
|
||||
import com.yizhuan.xchat_android_core.association.bean.MemberExchangeInfo
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult
|
||||
import com.yizhuan.xchat_android_core.utils.net.launchRequest
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet
|
||||
import retrofit2.http.*
|
||||
|
||||
object AssociationModel : BaseModel() {
|
||||
|
||||
private val api = RxNet.create(Api::class.java)
|
||||
|
||||
suspend fun getClanList(): List<ClanListInfo>? =
|
||||
launchRequest {
|
||||
api.getClanList()
|
||||
}
|
||||
|
||||
suspend fun getHallList(): List<HallListInfo>? =
|
||||
launchRequest {
|
||||
api.getHallList()
|
||||
}
|
||||
|
||||
suspend fun getMemberExchangeList(): List<MemberExchangeInfo>? =
|
||||
launchRequest {
|
||||
api.getMemberExchangeList()
|
||||
}
|
||||
|
||||
suspend fun operateMemberExchange(status: Int, targetUid: Long): String? =
|
||||
launchRequest {
|
||||
api.operateMemberExchange(status, targetUid)
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 获取公會周榜
|
||||
*/
|
||||
@GET("/clan/list")
|
||||
suspend fun getClanList(): ServiceResult<List<ClanListInfo>>
|
||||
|
||||
/**
|
||||
* 获取牌照房
|
||||
*/
|
||||
@GET("/hall/list")
|
||||
suspend fun getHallList(): ServiceResult<List<HallListInfo>>
|
||||
|
||||
/**
|
||||
* 获取家族下的兑换权限管理的成员列表
|
||||
*/
|
||||
@GET("/clan/memberExchangeAuth/list")
|
||||
suspend fun getMemberExchangeList(): ServiceResult<List<MemberExchangeInfo>>
|
||||
|
||||
/**
|
||||
* 修改兑换权限管理
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/clan/memberExchangeAuth/operate")
|
||||
suspend fun operateMemberExchange(
|
||||
@Field("status") status: Int,
|
||||
@Field("targetUid") targetUid: Long
|
||||
): ServiceResult<String>
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.association
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel
|
||||
import com.yizhuan.xchat_android_core.bean.response.ListResult
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult
|
||||
import com.yizhuan.xchat_android_core.utils.net.launchRequest
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet
|
||||
import retrofit2.http.GET
|
||||
|
||||
object AssociationModel : BaseModel() {
|
||||
|
||||
private val api = RxNet.create(Api::class.java)
|
||||
|
||||
suspend fun getClanList(): List<ClanListInfo>? =
|
||||
launchRequest {
|
||||
api.getClanList()
|
||||
}
|
||||
|
||||
suspend fun getHallList(): List<HallListInfo>? =
|
||||
launchRequest {
|
||||
api.getHallList()
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 获取公會周榜
|
||||
*/
|
||||
@GET("/clan/list")
|
||||
suspend fun getClanList(): ServiceResult<List<ClanListInfo>>
|
||||
|
||||
/**
|
||||
* 获取牌照房
|
||||
*/
|
||||
@GET("/hall/list")
|
||||
suspend fun getHallList(): ServiceResult<List<HallListInfo>>
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user