1:修改系统和官方公告展示html出现标签展示的问题
2:添加群全员禁言和单个禁言的功能 3:将道具商城做成原生的 4:添加应用更新的时候,添加版本判断和重新刷新手机文本,预防出现安装缓存(自己测试十几次,未在出现问题,还需要大量测试)
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
package com.xscm.modulemain.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.widget.CompoundButton
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.tencent.imsdk.v2.V2TIMCallback
|
||||
import com.tencent.imsdk.v2.V2TIMGroupManager
|
||||
import com.tencent.imsdk.v2.V2TIMManager
|
||||
import com.xscm.modulemain.BaseMvpActivity
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.activity.msg.NewsContacts
|
||||
import com.xscm.modulemain.activity.msg.NewsPresenter
|
||||
import com.xscm.modulemain.adapter.GroupAdapter
|
||||
import com.xscm.modulemain.databinding.ActivityGroupChatSettingsBinding
|
||||
import com.xscm.moduleutil.bean.GroupBean
|
||||
import com.xscm.moduleutil.bean.GroupUserListBean
|
||||
import com.xscm.moduleutil.bean.NewsMessageList
|
||||
import com.xscm.moduleutil.utils.ImageUtils
|
||||
|
||||
/**
|
||||
* @Author
|
||||
* @Time 2026/1/2 14:57
|
||||
* @Description 群聊设置
|
||||
*/
|
||||
class GroupChatSettingsActivity :
|
||||
BaseMvpActivity<NewsPresenter, ActivityGroupChatSettingsBinding>(),
|
||||
NewsContacts.View {
|
||||
|
||||
var groupAdapter: GroupAdapter? = GroupAdapter()
|
||||
val v2TIMGroupManager: V2TIMGroupManager?= V2TIMManager.getGroupManager()
|
||||
var groupId: String = ""
|
||||
var isOwner : Boolean = false
|
||||
|
||||
var groupBean : GroupBean= GroupBean()
|
||||
|
||||
override fun bindPresenter(): NewsPresenter {
|
||||
return NewsPresenter(this, this)
|
||||
}
|
||||
|
||||
|
||||
override fun initData() {
|
||||
mBinding?.topBar?.tvTitle?.text = "群聊设置"
|
||||
MvpPre?.getGuildInfo(groupId)
|
||||
// 设置布局管理器
|
||||
mBinding?.rvGroupMember?.apply {
|
||||
layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
// 可选:设置是否固定大小
|
||||
setHasFixedSize(true)
|
||||
// 设置适配器
|
||||
adapter = groupAdapter
|
||||
}
|
||||
|
||||
mBinding?.tvGroupCount?.setOnClickListener {
|
||||
val intent = Intent(this, GroupUserListActivity::class.java).apply {
|
||||
putExtra("groupId", groupId)
|
||||
putExtra("isOwner", isOwner)
|
||||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
mBinding?.tvConfirm?.setOnClickListener {
|
||||
if(mBinding?.evGroupName?.text.toString().equals(groupBean.name) && mBinding?.etG?.text.toString().equals(groupBean.notification)){
|
||||
finish()
|
||||
}else if (mBinding?.evGroupName?.text.toString().equals(groupBean.name) && !mBinding?.etG?.text.toString().equals(groupBean.notification)){
|
||||
MvpPre?.setGuildInfo(groupId, "", mBinding?.etG?.text.toString(), "")
|
||||
}else if (!mBinding?.evGroupName?.text.toString().equals(groupBean.name) && mBinding?.etG?.text.toString().equals(groupBean.notification)){
|
||||
MvpPre?.setGuildInfo(groupId, mBinding?.evGroupName?.text.toString(), "", "")
|
||||
}else {
|
||||
MvpPre?.setGuildInfo(
|
||||
groupId,
|
||||
mBinding?.evGroupName?.text.toString(),
|
||||
mBinding?.etG?.text.toString(),
|
||||
""
|
||||
)
|
||||
}
|
||||
}
|
||||
mBinding?.switJy?.setOnCheckedChangeListener { compoundButton, b ->
|
||||
v2TIMGroupManager?.muteAllGroupMembers(groupId, b, object : V2TIMCallback {
|
||||
override fun onSuccess() {
|
||||
|
||||
}
|
||||
|
||||
override fun onError(code: Int, desc: String?) {
|
||||
mBinding?.switJy?.isChecked = !b
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.activity_group_chat_settings
|
||||
}
|
||||
|
||||
override fun showNews(newsList: List<NewsMessageList?>?) {
|
||||
}
|
||||
|
||||
override fun finishRefresh() {
|
||||
}
|
||||
|
||||
override fun postInvite() {
|
||||
}
|
||||
|
||||
override fun getGuildInfo(groupBean: GroupBean?) {
|
||||
if (groupBean == null) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
this.groupBean=groupBean
|
||||
mBinding?.groupName?.text = groupBean.name
|
||||
ImageUtils.loadHead(groupBean.guild_cover, mBinding?.imGroup)
|
||||
if (groupBean.is_deacon == 1) {
|
||||
isOwner=true
|
||||
mBinding?.llGroup?.visibility = View.VISIBLE
|
||||
mBinding?.switJy?.isChecked = groupBean.mute_all_member == 1
|
||||
mBinding?.etG?.isEnabled = true
|
||||
mBinding?.evGroupName?.isEnabled = true
|
||||
} else {
|
||||
isOwner=false
|
||||
mBinding?.llGroup?.visibility = View.GONE
|
||||
mBinding?.etG?.isEnabled = false
|
||||
mBinding?.evGroupName?.isEnabled = false
|
||||
}
|
||||
mBinding?.etG?.text?.append(groupBean.notification)
|
||||
mBinding?.evGroupName?.text?.append(groupBean.name)
|
||||
|
||||
groupAdapter?.setNewData(groupBean.user_list)
|
||||
|
||||
}
|
||||
|
||||
override fun setGuildInfo(s: String?) {
|
||||
ToastUtils.showLong(s)
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun memberList(groupUserListBean: GroupUserListBean?) {
|
||||
|
||||
}
|
||||
|
||||
override fun doDone() {
|
||||
super.doDone()
|
||||
groupId = intent.getStringExtra("groupId").toString()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.xscm.modulemain.activity
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
||||
import com.tencent.imsdk.v2.V2TIMCallback
|
||||
import com.tencent.imsdk.v2.V2TIMGroupManager
|
||||
import com.tencent.imsdk.v2.V2TIMManager
|
||||
import com.xscm.modulemain.BaseMvpActivity
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.activity.msg.NewsContacts
|
||||
import com.xscm.modulemain.activity.msg.NewsPresenter
|
||||
import com.xscm.modulemain.adapter.GroupUserListAdapter
|
||||
import com.xscm.modulemain.databinding.ActivityGroupUserListBinding
|
||||
import com.xscm.moduleutil.bean.CommentBean.CommentDetailsBean
|
||||
import com.xscm.moduleutil.bean.CommentBean.CommentDetailsBean.Replies
|
||||
import com.xscm.moduleutil.bean.GroupBean
|
||||
import com.xscm.moduleutil.bean.GroupUserListBean
|
||||
import com.xscm.moduleutil.bean.NewsMessageList
|
||||
import com.xscm.moduleutil.utils.SpUtil
|
||||
|
||||
/**
|
||||
* @Author qx
|
||||
* @Time 2026/1/3 11:44
|
||||
* @Description 群成员列表
|
||||
*/
|
||||
class GroupUserListActivity : BaseMvpActivity<NewsPresenter, ActivityGroupUserListBinding>(),
|
||||
NewsContacts.View {
|
||||
|
||||
val groupUserListAdapter: GroupUserListAdapter by lazy { GroupUserListAdapter() }
|
||||
val v2TIMGroupManager: V2TIMGroupManager? = V2TIMManager.getGroupManager()
|
||||
|
||||
var groupId: String? = null
|
||||
var isOwner: Boolean = false
|
||||
var page: Int = 1
|
||||
var search: String = ""
|
||||
var groupUserBean: List<GroupBean.GroupUserBean> = ArrayList()
|
||||
|
||||
override fun bindPresenter(): NewsPresenter {
|
||||
return NewsPresenter(this, this)
|
||||
}
|
||||
|
||||
|
||||
override fun doDone() {
|
||||
super.doDone()
|
||||
groupId = intent.getStringExtra("groupId").toString()
|
||||
isOwner = intent.getBooleanExtra("isOwner", false)
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
mBinding?.topBar?.tvTitle?.text = "群聊成员"
|
||||
mBinding?.recycleView?.layoutManager =
|
||||
androidx.recyclerview.widget.LinearLayoutManager(this)
|
||||
mBinding?.recycleView?.adapter = groupUserListAdapter
|
||||
|
||||
groupUserListAdapter.setOnItemClickListener(object :
|
||||
GroupUserListAdapter.OnItemClickListener {
|
||||
override fun onItemClick(ismute: Int, item: GroupBean.GroupUserBean?) {
|
||||
if (ismute == 1) {
|
||||
v2TIMGroupManager?.muteGroupMember(
|
||||
groupId,
|
||||
"u" + item?.user_id.toString(),
|
||||
0,
|
||||
object :
|
||||
V2TIMCallback {
|
||||
override fun onSuccess() {
|
||||
if (item?.is_mute == 1) {
|
||||
item.is_mute = 0
|
||||
} else {
|
||||
item?.is_mute = 1
|
||||
}
|
||||
groupUserListAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onError(code: Int, desc: String?) {
|
||||
ToastUtils.showLong(desc)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
onCommentLongClick(item)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
mBinding.tvCancel.setOnClickListener { view ->
|
||||
search = mBinding.editQuery.text.toString()
|
||||
MvpPre?.memberList(page.toString(), "10", groupId, search)
|
||||
}
|
||||
|
||||
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(object :
|
||||
OnRefreshLoadMoreListener {
|
||||
override fun onLoadMore(refreshLayout: RefreshLayout) {
|
||||
page++
|
||||
MvpPre?.memberList(page.toString(), "10", groupId, "")
|
||||
}
|
||||
|
||||
override fun onRefresh(refreshLayout: RefreshLayout) {
|
||||
page = 1
|
||||
MvpPre?.memberList(page.toString(), "10", groupId, "")
|
||||
}
|
||||
})
|
||||
|
||||
if (isOwner) {
|
||||
mBinding.llSearch.visibility = View.VISIBLE
|
||||
} else {
|
||||
mBinding.llSearch.visibility = View.GONE
|
||||
}
|
||||
|
||||
MvpPre?.memberList(page.toString(), "10", groupId, "")
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.activity_group_user_list
|
||||
}
|
||||
|
||||
fun onCommentLongClick(item: GroupBean.GroupUserBean?) {
|
||||
val options: Array<String?>? =
|
||||
arrayOf<String>(
|
||||
"禁言一天",
|
||||
"禁言五天",
|
||||
"禁言十天",
|
||||
"禁言三十天",
|
||||
"取消"
|
||||
) as Array<String?>?
|
||||
|
||||
// 创建底部对话框
|
||||
val bottomSheetDialog = BottomSheetDialog(this)
|
||||
val dialogView = getLayoutInflater().inflate(
|
||||
com.xscm.moduleutil.R.layout.dialog_bottom_sheet_actions,
|
||||
null
|
||||
)
|
||||
|
||||
// 初始化视图
|
||||
val container =
|
||||
dialogView.findViewById<LinearLayout?>(com.xscm.moduleutil.R.id.ll_options_container)
|
||||
|
||||
// 动态添加选项
|
||||
for (i in options!!.indices) {
|
||||
val textView = TextView(this)
|
||||
textView.setText(options[i])
|
||||
textView.setTextSize(16f)
|
||||
textView.setPadding(
|
||||
getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_16),
|
||||
getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_14),
|
||||
getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_16),
|
||||
getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_14)
|
||||
)
|
||||
|
||||
// 设置点击效果
|
||||
textView.setBackgroundResource(com.xscm.moduleutil.R.drawable.bg_bottom_sheet_item)
|
||||
val optionIndex = i
|
||||
textView.setOnClickListener(View.OnClickListener { v: View? ->
|
||||
handleOptionClick(optionIndex, item)
|
||||
bottomSheetDialog.dismiss()
|
||||
})
|
||||
container.addView(textView)
|
||||
|
||||
// 添加分割线(除了最后一个)
|
||||
if (i < options.size - 1) {
|
||||
val divider = View(this)
|
||||
divider.setBackgroundColor(
|
||||
ContextCompat.getColor(
|
||||
this,
|
||||
com.xscm.moduleutil.R.color.color_FFEEEEEE
|
||||
)
|
||||
)
|
||||
val params = LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_1)
|
||||
)
|
||||
divider.setLayoutParams(params)
|
||||
container.addView(divider)
|
||||
}
|
||||
}
|
||||
|
||||
bottomSheetDialog.setContentView(dialogView)
|
||||
bottomSheetDialog.show()
|
||||
}
|
||||
|
||||
private fun handleOptionClick(
|
||||
optionIndex: Int,
|
||||
item: GroupBean.GroupUserBean?,
|
||||
) {
|
||||
var seconds: Int = 0
|
||||
when (optionIndex) {
|
||||
0 ->
|
||||
seconds = 86400
|
||||
|
||||
1 ->
|
||||
seconds = 432000
|
||||
|
||||
2 ->
|
||||
seconds = 864000
|
||||
|
||||
3 ->
|
||||
seconds = 2592000
|
||||
|
||||
4 ->
|
||||
seconds = 0
|
||||
}
|
||||
v2TIMGroupManager?.muteGroupMember(
|
||||
groupId,
|
||||
"u" + item?.user_id.toString(),
|
||||
seconds,
|
||||
object :
|
||||
V2TIMCallback {
|
||||
override fun onSuccess() {
|
||||
if (item?.is_mute == 1) {
|
||||
item?.is_mute = 0
|
||||
} else {
|
||||
item?.is_mute = 1
|
||||
}
|
||||
groupUserListAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onError(code: Int, desc: String?) {
|
||||
ToastUtils.showLong(desc)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun showNews(newsList: List<NewsMessageList?>?) {
|
||||
}
|
||||
|
||||
override fun finishRefresh() {
|
||||
}
|
||||
|
||||
override fun postInvite() {
|
||||
}
|
||||
|
||||
override fun getGuildInfo(groupBean: GroupBean?) {
|
||||
}
|
||||
|
||||
override fun setGuildInfo(s: String?) {
|
||||
}
|
||||
|
||||
override fun memberList(groupUserListBean: GroupUserListBean?) {
|
||||
mBinding.smartRefreshLayout.finishRefresh()
|
||||
mBinding.smartRefreshLayout.finishLoadMore()
|
||||
if (groupUserListBean == null) {
|
||||
return
|
||||
}
|
||||
groupUserBean = groupUserListBean.list!!
|
||||
groupUserListAdapter.updateOwnerStatus(isOwner)
|
||||
if (page == 1) {
|
||||
|
||||
groupUserListAdapter.setNewData(groupUserBean)
|
||||
} else {
|
||||
groupUserListAdapter.addData(groupUserBean)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,12 +726,13 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
@Override
|
||||
public void appUpdate(AppUpdateModel appUpdateModel) {
|
||||
if (appUpdateModel.getCode() > getCurrentVersionCode(this)) {
|
||||
String apkName="yusheng"+appUpdateModel.getCode()+".apk";
|
||||
// 1. 禁止屏幕自动息屏(核心逻辑)
|
||||
keepScreenOn(true);
|
||||
// 初始化DownloadManager(注意:需确保DownloadManager类的包名正确)
|
||||
manager = new DownloadManager.Builder(this)
|
||||
.apkUrl(appUpdateModel.getUrl())
|
||||
.apkName("yusheng.apk")
|
||||
.apkName(apkName)
|
||||
.smallIcon(R.mipmap.ic_launcher_foreground)
|
||||
.showNewerToast(false)
|
||||
.apkVersionCode(appUpdateModel.getCode())
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.GroupBean;
|
||||
import com.xscm.moduleutil.bean.GroupUserListBean;
|
||||
import com.xscm.moduleutil.bean.NewsMessageList;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,12 +16,23 @@ public class NewsContacts {
|
||||
void finishRefresh();
|
||||
|
||||
void postInvite();
|
||||
|
||||
void getGuildInfo(GroupBean groupBean);
|
||||
void setGuildInfo(String s);
|
||||
|
||||
void memberList(GroupUserListBean groupUserListBean);
|
||||
}
|
||||
public interface IHomePre extends IPresenter {
|
||||
|
||||
void getMessagetitle(String type,String page,String pageLimit);
|
||||
|
||||
void postInvite(String apply_id, String type);
|
||||
|
||||
void getGuildInfo(String guild_id);
|
||||
|
||||
void setGuildInfo(String groupId,String name,String notice,String avatar);
|
||||
|
||||
void memberList(String page,String pageLimit, String guild_id,String search);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.xscm.modulemain.activity.msg;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.xscm.moduleutil.bean.GroupBean;
|
||||
import com.xscm.moduleutil.bean.GroupUserListBean;
|
||||
import com.xscm.moduleutil.bean.NewsMessageList;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
@@ -58,4 +60,61 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGuildInfo(String guild_id) {
|
||||
api.getGuildInfo(guild_id, new BaseObserver<GroupBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GroupBean groupBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().getGuildInfo(groupBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuildInfo(String groupId, String name, String notice, String avatar) {
|
||||
api.setGuildInfo(groupId, name, notice, avatar, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().setGuildInfo(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void memberList(String page, String pageLimit, String guild_id, String search) {
|
||||
api.memberList(page, pageLimit, guild_id, search, new BaseObserver<GroupUserListBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(GroupUserListBean groupUserListBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().memberList(groupUserListBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.ActivityOfficialNoticeBinding;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.bean.GroupBean;
|
||||
import com.xscm.moduleutil.bean.GroupUserListBean;
|
||||
import com.xscm.moduleutil.bean.NewsMessageList;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.TimeUtils;
|
||||
@@ -66,7 +68,7 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
|
||||
helper.getView(R.id.ll_system).setVisibility(GONE);
|
||||
helper.getView(R.id.ll_gh).setVisibility(VISIBLE);
|
||||
|
||||
helper.setText(R.id.tv_sys_cons, item.getContent());
|
||||
helper.setText(R.id.tv_sys_cons, Html.fromHtml(item.getContent()));
|
||||
if (item.getGuild_invited_status() == 0) {
|
||||
helper.getView(R.id.ll_but).setVisibility(VISIBLE);
|
||||
helper.getView(R.id.tv_cancel2).setVisibility(GONE);
|
||||
@@ -108,7 +110,7 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
|
||||
helper.getView(R.id.ll_gh).setVisibility(GONE);
|
||||
if (item.getImage() == null || item.getImage().isEmpty()) {
|
||||
helper.getView(R.id.tv_sys_con).setVisibility(VISIBLE);
|
||||
helper.setText(R.id.tv_sys_con, item.getContent());
|
||||
helper.setText(R.id.tv_sys_con, Html.fromHtml(item.getContent()));
|
||||
helper.getView(R.id.ll_system_official).setVisibility(GONE);
|
||||
} else {
|
||||
helper.getView(R.id.tv_sys_con).setVisibility(GONE);
|
||||
@@ -176,4 +178,19 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
|
||||
public void postInvite() {
|
||||
MvpPre.getMessagetitle(type, "1", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGuildInfo(GroupBean groupBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuildInfo(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void memberList(GroupUserListBean groupUserListBean) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.xscm.modulemain.activity.msg.fragment;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -131,12 +132,14 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
@Override
|
||||
public void getOfficialNoticeList(NewsDataBean newsDataBeans) {
|
||||
if (newsDataBeans.getAnnouncement_last_message()!=null){
|
||||
mBinding.tvNr.setText(newsDataBeans.getAnnouncement_last_message().getContent()!=null?newsDataBeans.getAnnouncement_last_message().getContent():"");
|
||||
mBinding.tvNr.setText(Html.fromHtml(newsDataBeans.getAnnouncement_last_message().getContent()!=null?newsDataBeans.getAnnouncement_last_message().getContent():""));
|
||||
// mBinding.tvNr.setText(newsDataBeans.getAnnouncement_last_message().getContent()!=null?newsDataBeans.getAnnouncement_last_message().getContent():"");
|
||||
}else {
|
||||
mBinding.tvNr.setText("");
|
||||
}
|
||||
if (newsDataBeans.getSystem_last_message()!=null){
|
||||
mBinding.tvXtNr.setText(newsDataBeans.getSystem_last_message().getContent()!=null?newsDataBeans.getSystem_last_message().getContent():"");
|
||||
mBinding.tvXtNr.setText(Html.fromHtml(newsDataBeans.getSystem_last_message().getContent()!=null?newsDataBeans.getSystem_last_message().getContent():""));
|
||||
// mBinding.tvXtNr.setText(newsDataBeans.getSystem_last_message().getContent()!=null?newsDataBeans.getSystem_last_message().getContent():"");
|
||||
}else {
|
||||
mBinding.tvXtNr.setText("");
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ import com.xscm.modulemain.BaseMvpActivity;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.adapter.MyPagerAdapter;
|
||||
import com.xscm.moduleutil.base.WebUrlConstants;
|
||||
import com.xscm.moduleutil.bean.BannerModel;
|
||||
import com.xscm.moduleutil.bean.PersonaltyBean;
|
||||
import com.xscm.moduleutil.bean.PersonaltyListBean;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
@@ -100,6 +102,17 @@ public class PersonalityActivity extends BaseMvpActivity<PersonalityPresenter, A
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBanners(List<BannerModel> bannerModels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPersonaltyListBean(List<PersonaltyListBean> personaltyListBeans) {
|
||||
|
||||
}
|
||||
|
||||
private void refreshCurrentGiftFragment(String id,int position) {
|
||||
if (getCurrentGiftFragment()!=null){
|
||||
getCurrentGiftFragment().loadDataIfNeeded(Integer.parseInt(id), position);
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.xscm.modulemain.activity.user.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.stx.xhb.xbanner.XBanner
|
||||
import com.stx.xhb.xbanner.XBanner.XBannerAdapter
|
||||
import com.xscm.modulemain.BaseMvpActivity
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.activity.WebViewActivity
|
||||
import com.xscm.modulemain.activity.user.activity.ui.main.PlaceholderFragment
|
||||
import com.xscm.modulemain.activity.user.activity.ui.main.SectionsPagerAdapter
|
||||
import com.xscm.modulemain.activity.user.conacts.PersonalityConacts
|
||||
import com.xscm.modulemain.activity.user.presenter.PersonalityPresenter
|
||||
import com.xscm.modulemain.databinding.ActivityPropMallBinding
|
||||
import com.xscm.moduleutil.bean.BannerModel
|
||||
import com.xscm.moduleutil.bean.PersonaltyBean
|
||||
import com.xscm.moduleutil.bean.PersonaltyListBean
|
||||
import com.xscm.moduleutil.utils.ColorManager
|
||||
import com.xscm.moduleutil.utils.ImageUtils
|
||||
|
||||
/**
|
||||
* @Author qx
|
||||
* @Time 2026/1/3 17:08
|
||||
* @Description 道具商城
|
||||
*/
|
||||
class PropMallActivity : BaseMvpActivity<PersonalityPresenter, ActivityPropMallBinding>(), PersonalityConacts.View {
|
||||
|
||||
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter
|
||||
|
||||
override fun bindPresenter(): PersonalityPresenter {
|
||||
return PersonalityPresenter(this,this)
|
||||
}
|
||||
|
||||
|
||||
override fun initData() {
|
||||
// 加载道具商城数据
|
||||
|
||||
mBinding.topBar.tvTitle.text="道具商城"
|
||||
MvpPre.getBanners("7")
|
||||
MvpPre.getPersonaltyList()
|
||||
|
||||
mBinding.banner.loadImage(object : XBannerAdapter {
|
||||
override fun loadBanner(banner: XBanner?, model: Any?, view: View?, position: Int) {
|
||||
val bannerModel = model as BannerModel
|
||||
ImageUtils.loadCenterCrop(
|
||||
bannerModel.getXBannerUrl() as String?,
|
||||
view as ImageView?
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
mBinding.banner.setOnItemClickListener(object : XBanner.OnItemClickListener {
|
||||
override fun onItemClick(banner: XBanner?, model: Any?, view: View?, position: Int) {
|
||||
/**
|
||||
* type=1时,该值表示房间id;type=2时,表示文章id
|
||||
*/
|
||||
val bannerModel = model as BannerModel
|
||||
val intent = Intent(this@PropMallActivity, WebViewActivity::class.java)
|
||||
intent.putExtra("url", bannerModel.getUrl())
|
||||
intent.putExtra("title", "商城横幅")
|
||||
startActivity(intent)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.activity_prop_mall
|
||||
}
|
||||
|
||||
|
||||
override fun getPersonaltyList(personaltyBean: List<PersonaltyBean?>?) {
|
||||
|
||||
sectionsPagerAdapter = SectionsPagerAdapter( this,
|
||||
personaltyBean as List<PersonaltyBean>
|
||||
)
|
||||
mBinding.viewPager.adapter = sectionsPagerAdapter
|
||||
// 创建适配器
|
||||
mBinding.slidingTabLayout.setSelectedTabIndicatorColor(
|
||||
ColorManager.getInstance().getPrimaryColorInt()
|
||||
)
|
||||
if (!personaltyBean.isEmpty()) mBinding.viewPager.setOffscreenPageLimit(personaltyBean.size - 1)
|
||||
|
||||
// 设置 TabLayout 与 ViewPager2 的关联
|
||||
TabLayoutMediator(
|
||||
mBinding.slidingTabLayout, mBinding.viewPager,
|
||||
TabLayoutMediator.TabConfigurationStrategy { tab: TabLayout.Tab?, position: Int ->
|
||||
// 边界检查
|
||||
if (position >= 0 && position < personaltyBean.size && personaltyBean.get(position) != null) {
|
||||
// 创建自定义布局
|
||||
val customView = LayoutInflater.from(this)
|
||||
.inflate(R.layout.custom_tab_layout, null)
|
||||
val textView = customView.findViewById<TextView?>(R.id.tab_text)
|
||||
textView.setText(personaltyBean.get(position).name)
|
||||
|
||||
// 设置初始状态
|
||||
if (position == 0) {
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
|
||||
textView.setTextColor(getResources().getColor(android.R.color.black))
|
||||
} else {
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12f)
|
||||
textView.setTextColor(Color.parseColor("#999999"))
|
||||
}
|
||||
|
||||
tab!!.setCustomView(customView)
|
||||
}
|
||||
}
|
||||
).attach()
|
||||
|
||||
mBinding.slidingTabLayout.addOnTabSelectedListener(object :
|
||||
TabLayout.OnTabSelectedListener {
|
||||
override fun onTabSelected(tab: TabLayout.Tab) {
|
||||
val position = tab.getPosition()
|
||||
// 边界检查
|
||||
if (position >= 0 && position < personaltyBean.size) {
|
||||
val customView = tab.getCustomView()
|
||||
if (customView != null) {
|
||||
val textView = customView.findViewById<TextView?>(R.id.tab_text)
|
||||
if (textView != null) {
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
|
||||
textView.setTextColor(getResources().getColor(android.R.color.black))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTabUnselected(tab: TabLayout.Tab) {
|
||||
// 直接通过 TabLayout 设置未选中状态的文字大小
|
||||
val customView = tab.getCustomView()
|
||||
if (customView != null) {
|
||||
val textView = customView.findViewById<TextView?>(R.id.tab_text)
|
||||
if (textView != null) {
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12f)
|
||||
textView.setTextColor(Color.parseColor("#999999"))
|
||||
}
|
||||
customView.setBackgroundResource(com.xscm.moduleutil.R.drawable.tab_unselected_background)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTabReselected(tab: TabLayout.Tab?) {
|
||||
}
|
||||
})
|
||||
|
||||
// 初始加载第一个tab的数据
|
||||
mBinding.viewPager.post {
|
||||
val firstFragment = sectionsPagerAdapter.getFragment(0)
|
||||
if (firstFragment is PlaceholderFragment) {
|
||||
firstFragment.loadDataIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
// 添加ViewPager2页面切换监听,实现按需加载数据
|
||||
mBinding.viewPager.registerOnPageChangeCallback(object : androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
// 通知当前选中的Fragment加载数据
|
||||
val fragment = sectionsPagerAdapter.getFragment(position)
|
||||
if (fragment is PlaceholderFragment) {
|
||||
fragment.loadDataIfNeeded()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun setBanners(bannerModels: List<BannerModel?>?) {
|
||||
mBinding.banner.setBannerData(R.layout.index_image_banner, bannerModels!!)
|
||||
}
|
||||
|
||||
override fun getPersonaltyListBean(personaltyListBeans: List<PersonaltyListBean?>?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.xscm.modulemain.activity.user.activity.ui.main
|
||||
|
||||
import android.graphics.Paint
|
||||
import android.text.TextUtils
|
||||
import android.widget.TextView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.adapter.GroupUserListAdapter
|
||||
import com.xscm.moduleutil.bean.GroupBean
|
||||
import com.xscm.moduleutil.bean.PersonaltyListBean
|
||||
import com.xscm.moduleutil.utils.ImageUtils
|
||||
|
||||
/**
|
||||
* @Author qx
|
||||
* @Time 2026/1/3 19:17
|
||||
* @Description 商城展示适配器
|
||||
*/
|
||||
class PersonaltyAdapter :
|
||||
BaseQuickAdapter<PersonaltyListBean, BaseViewHolder>(R.layout.item_personalty) {
|
||||
interface OnItemClickListener {
|
||||
fun onItemClick( item: PersonaltyListBean?)
|
||||
}
|
||||
|
||||
private var onItemClickListener: OnItemClickListener? = null
|
||||
|
||||
fun setOnItemClickListener(listener: OnItemClickListener?) {
|
||||
this.onItemClickListener = listener
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
helper: BaseViewHolder,
|
||||
item: PersonaltyListBean?
|
||||
) {
|
||||
helper.setText(R.id.tv_name_period, item?.title)
|
||||
helper.setText(R.id.discount,item?.price.toString())
|
||||
helper.setText(R.id.original_price, item?.original_price.toString())
|
||||
helper.getView<TextView>(R.id.original_price).paintFlags= Paint.STRIKE_THRU_TEXT_FLAG
|
||||
ImageUtils.loadHead(item?.base_image,helper.getView(R.id.iv_img))
|
||||
if (TextUtils.isEmpty(item?.discount_str)){
|
||||
helper.getView<TextView>(R.id.discount_str).visibility=TextView.GONE
|
||||
}else{
|
||||
helper.getView<TextView>(R.id.discount_str).visibility=TextView.VISIBLE
|
||||
}
|
||||
helper.setText(R.id.discount_str,item?.discount_str)
|
||||
|
||||
helper.itemView.setOnClickListener {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener?.onItemClick( item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.xscm.modulemain.activity.user.activity.ui.main
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.stx.xhb.xbanner.XBanner
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.activity.user.conacts.PersonalityConacts
|
||||
import com.xscm.modulemain.activity.user.presenter.PersonalityPresenter
|
||||
import com.xscm.modulemain.databinding.FragmentPropMallBinding
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment
|
||||
import com.xscm.moduleutil.bean.BannerModel
|
||||
import com.xscm.moduleutil.bean.PersonaltyBean
|
||||
import com.xscm.moduleutil.bean.PersonaltyListBean
|
||||
|
||||
/**
|
||||
* @Author qx
|
||||
* @Time 2026/1/3 17:57
|
||||
* @Description 道具商城的fragemnt
|
||||
*/
|
||||
class PlaceholderFragment : BaseMvpFragment<PersonalityPresenter,FragmentPropMallBinding>(),
|
||||
PersonalityConacts.View {
|
||||
|
||||
private lateinit var personaltyAdapter: PersonaltyAdapter
|
||||
|
||||
var type: String =""
|
||||
|
||||
// 标记数据是否已加载
|
||||
private var isDataLoaded = false
|
||||
|
||||
|
||||
override fun bindPresenter(): PersonalityPresenter? {
|
||||
return PersonalityPresenter(this,activity)
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The fragment argument representing the section number for this
|
||||
* fragment.
|
||||
*/
|
||||
private const val ARG_SECTION_NUMBER = "0"
|
||||
|
||||
/**
|
||||
* Returns a new instance of this fragment for the given section
|
||||
* number.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun newInstance(sectionNumber: Int): PlaceholderFragment {
|
||||
return PlaceholderFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putInt(ARG_SECTION_NUMBER, sectionNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
type= arguments?.getInt(ARG_SECTION_NUMBER).toString()
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
// 不再自动加载数据,改为按需加载
|
||||
// MvpPre.getPersonaltyListBean(type)
|
||||
}
|
||||
|
||||
/**
|
||||
* 按需加载数据
|
||||
* 只有在需要时且数据未加载时才加载
|
||||
*/
|
||||
fun loadDataIfNeeded() {
|
||||
if (!isDataLoaded ) {
|
||||
MvpPre.getPersonaltyListBean(type)
|
||||
isDataLoaded = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
mBinding.recyclerView.layoutManager = GridLayoutManager(context, 3)
|
||||
personaltyAdapter = PersonaltyAdapter()
|
||||
mBinding.recyclerView.adapter = personaltyAdapter
|
||||
|
||||
personaltyAdapter.setOnItemClickListener(object : PersonaltyAdapter.OnItemClickListener{
|
||||
override fun onItemClick(item: PersonaltyListBean?) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_prop_mall
|
||||
}
|
||||
|
||||
override fun getPersonaltyList(personaltyBean: List<PersonaltyBean?>?) {
|
||||
// 隐藏加载进度
|
||||
}
|
||||
|
||||
override fun setBanners(bannerModels: List<BannerModel?>?) {
|
||||
}
|
||||
|
||||
override fun getPersonaltyListBean(personaltyListBeans: List<PersonaltyListBean?>?) {
|
||||
personaltyAdapter.setNewData(personaltyListBeans)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.xscm.modulemain.activity.user.activity.ui.main
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.xscm.modulemain.activity.user.activity.PropMallActivity
|
||||
import com.xscm.moduleutil.bean.PersonaltyBean
|
||||
|
||||
|
||||
/**
|
||||
* 道具商城的FragmentStateAdapter
|
||||
* 用于ViewPager2展示不同类型的道具商城页面
|
||||
*/
|
||||
class SectionsPagerAdapter(
|
||||
fragmentActivity: FragmentActivity,
|
||||
private val personalityList: List<PersonaltyBean>,
|
||||
) : FragmentStateAdapter(fragmentActivity) {
|
||||
|
||||
/**
|
||||
* 获取页面总数
|
||||
* @return 页面数量
|
||||
*/
|
||||
override fun getItemCount(): Int = personalityList.size
|
||||
|
||||
/**
|
||||
* 创建指定位置的Fragment
|
||||
* @param position Fragment位置
|
||||
* @return 对应的Fragment实例
|
||||
*/
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
val personality = personalityList[position]
|
||||
return PlaceholderFragment.newInstance(
|
||||
sectionNumber =personality.id.toInt(),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定位置的标题
|
||||
* @param position 位置索引
|
||||
* @return 标题文本
|
||||
*/
|
||||
fun getPageTitle(position: Int): String? {
|
||||
return if (position >= 0 && position < personalityList.size) {
|
||||
personalityList[position].name
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定位置的Fragment
|
||||
* @param position Fragment位置
|
||||
* @return 对应的Fragment实例
|
||||
*/
|
||||
fun getFragment(position: Int): Fragment? {
|
||||
try {
|
||||
// 通过反射获取Fragment实例
|
||||
val fragmentManager = (ActivityUtils.getTopActivity() as PropMallActivity).supportFragmentManager
|
||||
val fragment = fragmentManager.findFragmentByTag("f" + getItemId(position))
|
||||
return fragment
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,23 @@ import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.BannerModel;
|
||||
import com.xscm.moduleutil.bean.PersonaltyBean;
|
||||
import com.xscm.moduleutil.bean.PersonaltyListBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PersonalityConacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void getPersonaltyList(List<PersonaltyBean> personaltyBean);
|
||||
void setBanners(List<BannerModel> bannerModels);
|
||||
|
||||
void getPersonaltyListBean(List<PersonaltyListBean> personaltyListBeans);
|
||||
|
||||
}
|
||||
public interface IMePre extends IPresenter {
|
||||
void getPersonaltyList();
|
||||
|
||||
void getPersonaltyListBean(String type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.user.activity.BosomFriendActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.GiftWallActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.NobleTitleActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.PropMallActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.RechargeActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.SingerVerificationActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.UserFamilyActivity;
|
||||
@@ -232,11 +233,13 @@ public class VocalRangeFragment extends BaseMvpFragment<MePresenter, FragmentVoc
|
||||
intent.putExtra("url", String.format(WebUrlConstants.INSTANCE.getWEB_GUILD_URL(),SpUtil.getToken(),""));
|
||||
intent.putExtra("title", "公会");
|
||||
startActivity(intent);
|
||||
}else if (id==R.id.ll_my_shopping){
|
||||
Intent intent=new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", String.format(WebUrlConstants.INSTANCE.getWEB_PROP_MALL_URL(),SpUtil.getToken()));
|
||||
intent.putExtra("title", "道具商城");
|
||||
startActivity(intent);
|
||||
}else if (id==R.id.ll_my_shopping){//道具商城
|
||||
startActivity(new Intent(getContext(), PropMallActivity.class));
|
||||
|
||||
// Intent intent=new Intent(getContext(), WebViewActivity.class);
|
||||
// intent.putExtra("url", String.format(WebUrlConstants.INSTANCE.getWEB_PROP_MALL_URL(),SpUtil.getToken()));
|
||||
// intent.putExtra("title", "道具商城");
|
||||
// startActivity(intent);
|
||||
} else if (id == R.id.ll_fans) {//粉丝
|
||||
Intent intent = new Intent(getContext(), BlacklistActivity.class);
|
||||
intent.putExtra("type", 2);
|
||||
|
||||
@@ -2,18 +2,26 @@ package com.xscm.modulemain.activity.user.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.xscm.modulemain.activity.user.conacts.MeConacts;
|
||||
import com.xscm.modulemain.activity.user.conacts.PersonalityConacts;
|
||||
import com.xscm.moduleutil.bean.BannerModel;
|
||||
import com.xscm.moduleutil.bean.PersonaltyBean;
|
||||
import com.xscm.moduleutil.bean.PersonaltyListBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class PersonalityPresenter extends BasePresenter<PersonalityConacts.View> implements PersonalityConacts.IMePre{
|
||||
public class PersonalityPresenter extends BasePresenter<PersonalityConacts.View> implements PersonalityConacts.IMePre {
|
||||
PersonalityConacts.View mView;
|
||||
|
||||
public PersonalityPresenter(PersonalityConacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,4 +38,44 @@ public class PersonalityPresenter extends BasePresenter<PersonalityConacts.View>
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPersonaltyListBean(String type) {
|
||||
api.getPersonaltyListBean(type, new BaseObserver<List<PersonaltyListBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<PersonaltyListBean> personaltyListBeans) {
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().getPersonaltyListBean(personaltyListBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getBanners(String s) {
|
||||
// Type listType = new TypeToken<List<BannerModel>>() {}.getType();
|
||||
// List<BannerModel> restoredRoomModels = GsonUtils.getGSON().fromJson(SpUtils.getHomeBanner(), listType);
|
||||
// MvpRef.get().setBanners(restoredRoomModels);
|
||||
RetrofitClient.getInstance().getBanners(s, new BaseObserver<List<BannerModel>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<BannerModel> bannerModels) {
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().setBanners(bannerModels);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xscm.modulemain.adapter
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.moduleutil.bean.GroupBean
|
||||
import com.xscm.moduleutil.utils.ImageUtils
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2026/1/3 10:58
|
||||
* 用途:群聊设置中的用户展示
|
||||
*/
|
||||
class GroupAdapter : BaseQuickAdapter<GroupBean.GroupUserBean, BaseViewHolder>(R.layout.item_group_member) {
|
||||
|
||||
override fun convert(
|
||||
helper: BaseViewHolder,
|
||||
item: GroupBean.GroupUserBean?
|
||||
) {
|
||||
helper.setText(R.id.tv_group_name, item?.nickname)
|
||||
ImageUtils.loadHead(item?.avatar, helper.getView(R.id.im_group))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.xscm.modulemain.adapter
|
||||
|
||||
import android.graphics.Color
|
||||
import android.widget.TextView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.moduleutil.bean.BlackUserBean
|
||||
import com.xscm.moduleutil.bean.GroupBean
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils
|
||||
import com.xscm.moduleutil.utils.MeHeadView
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2026/1/3 14:17
|
||||
* 用途:
|
||||
*/
|
||||
class GroupUserListAdapter : BaseQuickAdapter<GroupBean.GroupUserBean, BaseViewHolder>(R.layout.item_group_user) {
|
||||
interface OnItemClickListener {
|
||||
fun onItemClick(ismute: Int, item: GroupBean.GroupUserBean?)
|
||||
}
|
||||
|
||||
|
||||
|
||||
private var onItemClickListener: OnItemClickListener? = null
|
||||
|
||||
fun setOnItemClickListener(listener: OnItemClickListener?) {
|
||||
this.onItemClickListener = listener
|
||||
}
|
||||
var isOwner = false
|
||||
var ismute: Int = 0
|
||||
|
||||
// 在适配器中添加设置方法
|
||||
fun updateOwnerStatus(isOwner: Boolean) {
|
||||
this.isOwner = isOwner
|
||||
notifyDataSetChanged() // 如果需要刷新视图
|
||||
}
|
||||
|
||||
|
||||
override fun convert(
|
||||
helper: BaseViewHolder,
|
||||
item: GroupBean.GroupUserBean?
|
||||
) {
|
||||
helper.getView<MeHeadView>(R.id.im_user).setData(item?.avatar, "","")
|
||||
helper.setText(R.id.tv_nick_name, item?.nickname)
|
||||
|
||||
if (isOwner){
|
||||
helper.setVisible(R.id.im_g, true)
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(
|
||||
helper.getView<TextView>(R.id.im_g),
|
||||
Color.parseColor("#333333"),
|
||||
34
|
||||
)
|
||||
helper.getView<TextView>(R.id.im_g).setTextColor(Color.WHITE)
|
||||
if (item?.is_mute==1){
|
||||
helper.getView<TextView>(R.id.im_g).text = "解禁"
|
||||
ismute=1
|
||||
}else{
|
||||
helper.getView<TextView>(R.id.im_g).text = "禁言"
|
||||
ismute=0
|
||||
}
|
||||
helper.getView<TextView>(R.id.im_g).setOnClickListener {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener?.onItemClick(ismute,item)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
helper.setVisible(R.id.im_g, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user