光环助手V4.2.0-论坛详情功能(1,7,10) https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/956
This commit is contained in:
@ -6,14 +6,9 @@ import com.google.gson.annotations.SerializedName
|
||||
data class ForumDetailEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
var name: String = "",
|
||||
@SerializedName("game_id")
|
||||
var gameId: String = "",
|
||||
@SerializedName("game_name")
|
||||
var gameName: String = "",
|
||||
@SerializedName("game_icon")
|
||||
var gameIcon: String = "",
|
||||
var game: SimpleGame = SimpleGame(),
|
||||
var background: String = "",
|
||||
var name: String = "",
|
||||
var moderator: ArrayList<UserEntity> = arrayListOf(),
|
||||
var topLink: ArrayList<LinkEntity> = arrayListOf(),
|
||||
@SerializedName("zone_tab")
|
||||
|
||||
@ -5,14 +5,11 @@ import com.google.gson.annotations.SerializedName
|
||||
data class ForumEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
@SerializedName("game_id")
|
||||
var gameId: String = "",
|
||||
@SerializedName("game_name")
|
||||
var gameName: String = "",
|
||||
@SerializedName("game_icon")
|
||||
var gameIcon: String = "",
|
||||
var game: SimpleGame = SimpleGame(),
|
||||
var name: String = "",
|
||||
@SerializedName("is_follow")
|
||||
var isFollow: Boolean = false
|
||||
|
||||
)
|
||||
|
||||
data class ForumCategoryEntity(
|
||||
|
||||
@ -592,7 +592,8 @@ data class SimpleGame(
|
||||
@SerializedName("ori_icon")
|
||||
private var mRawIcon: String? = null,
|
||||
@SerializedName("icon_subscript")
|
||||
var iconSubscript: String? = null) : Parcelable {
|
||||
var iconSubscript: String? = null,
|
||||
var active: Boolean = false) : Parcelable {
|
||||
fun getIcon(): String {
|
||||
return mRawIcon ?: mIcon ?: ""
|
||||
}
|
||||
|
||||
@ -49,6 +49,8 @@ class ForumDetailFragment : BaseLazyTabFragment() {
|
||||
|
||||
private val mReuseLoading by bindView<LinearLayout>(R.id.reuse_ll_loading)
|
||||
private val mReuseNoConnection by bindView<View>(R.id.reuse_no_connection)
|
||||
private val mReuseNoData by bindView<View>(R.id.reuse_none_data)
|
||||
private val mReuseNoDataTv by bindView<TextView>(R.id.reuse_tv_none_data)
|
||||
|
||||
private var mAllForumArticleAskListFragment: ForumArticleAskListFragment? = null
|
||||
private var mEssenceForumArticleAskListFragment: ForumArticleAskListFragment? = null
|
||||
@ -102,7 +104,15 @@ class ForumDetailFragment : BaseLazyTabFragment() {
|
||||
} else {
|
||||
mBinding.communityEdit.visibility = View.GONE
|
||||
mBinding.forumContainer.visibility = View.GONE
|
||||
mReuseNoConnection.visibility = View.VISIBLE
|
||||
if (it.exception != null && it.exception.code() == 404) {
|
||||
mReuseNoDataTv.text = "页面为空"
|
||||
mReuseNoData.visibility = View.VISIBLE
|
||||
mReuseNoConnection.visibility = View.GONE
|
||||
ToastUtils.showToast("内容可能已被删除")
|
||||
} else {
|
||||
mReuseNoData.visibility = View.GONE
|
||||
mReuseNoConnection.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -213,21 +223,22 @@ class ForumDetailFragment : BaseLazyTabFragment() {
|
||||
R.id.gameZoneTv -> {
|
||||
if (mForumDetail?.zone != null) {
|
||||
MtaHelper.onEvent("论坛详情", "顶部区域", "游戏专区")
|
||||
GameDetailActivity.startGameDetailByShortcut(requireContext(), mForumDetail?.gameId
|
||||
GameDetailActivity.startGameDetailByShortcut(requireContext(), mForumDetail?.game?.id
|
||||
?: "", GameDetailFragment.INDEX_TRENDES, mEntrance)
|
||||
}
|
||||
}
|
||||
R.id.forumThumbBig, R.id.forumThumbSmall -> {
|
||||
MtaHelper.onEvent("论坛详情", "顶部区域", "游戏图标")
|
||||
GameDetailActivity.startGameDetailActivity(requireContext(), mForumDetail?.gameId
|
||||
?: "", mEntrance)
|
||||
if (mForumDetail?.game?.active == true) {
|
||||
GameDetailActivity.startGameDetailActivity(requireContext(), mForumDetail?.game?.id
|
||||
?: "", mEntrance)
|
||||
}
|
||||
}
|
||||
R.id.followTv -> {
|
||||
debounceActionWithInterval(R.id.followTv) {
|
||||
ifLogin(mEntrance) {
|
||||
val forumEntity = ForumEntity(mForumDetail?.id
|
||||
?: "", mForumDetail?.gameId ?: "", mForumDetail?.gameName
|
||||
?: "", mForumDetail?.gameIcon ?: "")
|
||||
?: "", mForumDetail?.game!!, mForumDetail?.name ?: "")
|
||||
|
||||
if (mForumDetail?.me?.isFollower == true) {
|
||||
mViewModel?.unFollowForum {
|
||||
|
||||
@ -43,7 +43,7 @@ class ForumMyFollowAdapter(context: Context, val mViewModel: ForumMyFollowViewMo
|
||||
showMoreWindow(it, forumEntity)
|
||||
}
|
||||
followViewHolder.itemView.setOnClickListener {
|
||||
MtaHelper.onEvent("论坛首页", "我关注的论坛", forumEntity.gameName)
|
||||
MtaHelper.onEvent("论坛首页", "我关注的论坛", forumEntity.name)
|
||||
mContext.startActivity(ForumDetailActivity.getIntent(mContext, forumEntity.id, "我的关注"))
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,9 +77,9 @@ class ForumFollowAdapter(context: Context) : BaseRecyclerAdapter<RecyclerView.Vi
|
||||
} else if (position > 1) {
|
||||
val forumEntity = entityList[position - 2]
|
||||
holder.binding.entity = forumEntity
|
||||
holder.binding.forumName.text = forumEntity.gameName
|
||||
holder.binding.forumName.text = forumEntity.name
|
||||
holder.itemView.setOnClickListener {
|
||||
MtaHelper.onEvent("论坛首页", "关注的论坛", forumEntity.gameName)
|
||||
MtaHelper.onEvent("论坛首页", "关注的论坛", forumEntity.name)
|
||||
mContext.startActivity(ForumDetailActivity.getIntent(mContext, forumEntity.id, "论坛"))
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,11 +19,11 @@ import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
class ModeratorListFragment : NormalFragment() {
|
||||
val mRefresh by bindView<SwipeRefreshLayout>(R.id.list_refresh)
|
||||
val mListRv by bindView<RecyclerView>(R.id.list_rv)
|
||||
val mReuseLoading by bindView<LinearLayout>(R.id.reuse_ll_loading)
|
||||
val mNoConnection by bindView<LinearLayout>(R.id.reuse_no_connection)
|
||||
val mNoneData by bindView<LinearLayout>(R.id.reuse_none_data)
|
||||
private val mRefresh by bindView<SwipeRefreshLayout>(R.id.list_refresh)
|
||||
private val mListRv by bindView<RecyclerView>(R.id.list_rv)
|
||||
private val mReuseLoading by bindView<LinearLayout>(R.id.reuse_ll_loading)
|
||||
private val mNoConnection by bindView<LinearLayout>(R.id.reuse_no_connection)
|
||||
private val mNoneData by bindView<LinearLayout>(R.id.reuse_none_data)
|
||||
private var mViewModel: ModeratorListViewModel? = null
|
||||
private var mAdapter: ModeratorListAdapter? = null
|
||||
|
||||
@ -37,7 +37,6 @@ class ModeratorListFragment : NormalFragment() {
|
||||
mViewModel = viewModelProvider(factory)
|
||||
|
||||
mViewModel?.moderators?.observe(this, Observer {
|
||||
mRefresh.isRefreshing = false
|
||||
mReuseLoading.visibility = View.GONE
|
||||
if (it != null) {
|
||||
mNoConnection.visibility = View.GONE
|
||||
@ -57,16 +56,12 @@ class ModeratorListFragment : NormalFragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
mRefresh.isEnabled = false
|
||||
mListRv.apply {
|
||||
layoutManager = LinearLayoutManager(requireContext())
|
||||
mAdapter = ModeratorListAdapter(requireContext(), mViewModel)
|
||||
adapter = mAdapter
|
||||
}
|
||||
|
||||
mRefresh.setOnRefreshListener {
|
||||
mViewModel?.getModerators()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMenuItemClick(menuItem: MenuItem?) {
|
||||
|
||||
@ -38,7 +38,7 @@ class ForumAdapter(context: Context, val mViewModel: ForumSelectViewModel?) : Ba
|
||||
val forumEntity = datas[position]
|
||||
holder.binding.entity = forumEntity
|
||||
holder.itemView.setOnClickListener {
|
||||
MtaHelper.onEvent("论坛首页", "选择论坛", forumEntity.gameName)
|
||||
MtaHelper.onEvent("论坛首页", "选择论坛", forumEntity.name)
|
||||
mContext.startActivity(ForumDetailActivity.getIntent(mContext, forumEntity.id, "论坛-选择论坛"))
|
||||
}
|
||||
holder.binding.followTv.setOnClickListener {
|
||||
|
||||
@ -44,8 +44,12 @@ class ForumSelectFragment : NormalFragment() {
|
||||
mViewModel?.getForumByCategoryId(it.data[0].id)
|
||||
}
|
||||
}
|
||||
mForumCategoryRv.visibility = View.VISIBLE
|
||||
mForumRv.visibility = View.VISIBLE
|
||||
mNoConnectionView.visibility = View.GONE
|
||||
} else {
|
||||
mForumCategoryRv.visibility = View.GONE
|
||||
mForumRv.visibility = View.GONE
|
||||
mNoConnectionView.visibility = View.VISIBLE
|
||||
}
|
||||
})
|
||||
@ -58,8 +62,12 @@ class ForumSelectFragment : NormalFragment() {
|
||||
} else {
|
||||
mNoneData.visibility = View.VISIBLE
|
||||
}
|
||||
mForumCategoryRv.visibility = View.VISIBLE
|
||||
mForumRv.visibility = View.VISIBLE
|
||||
mNoConnectionView.visibility = View.GONE
|
||||
} else {
|
||||
mForumCategoryRv.visibility = View.GONE
|
||||
mForumRv.visibility = View.GONE
|
||||
mNoConnectionView.visibility = View.VISIBLE
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user