Merge branch 'dev-5.0.0' of git.ghzs.com:halo/android/assistant-android into dev-5.0.0
This commit is contained in:
@ -101,8 +101,10 @@ class ForumArticleAskListFragment : ListFragment<AnswerEntity, ForumArticleAskLi
|
||||
override fun onLoadDone() {
|
||||
super.onLoadDone()
|
||||
AppExecutor.uiExecutor.executeWithDelay(Runnable {
|
||||
scroll()
|
||||
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, RecyclerView.SCROLL_STATE_IDLE)
|
||||
tryCatchInRelease {
|
||||
scroll()
|
||||
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, RecyclerView.SCROLL_STATE_IDLE)
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
@ -130,6 +132,8 @@ class ForumArticleAskListFragment : ListFragment<AnswerEntity, ForumArticleAskLi
|
||||
mAdapter.run {
|
||||
entityList.add(0, entity)
|
||||
notifyDataSetChanged()
|
||||
mViewModel?.videoList?.add(0, entity.transformForumVideoEntity())
|
||||
mListRv?.scrollToPosition(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ class ForumArticleAskListViewModel(application: Application, val bbsId: String =
|
||||
|
||||
var sort: String = "time.reply"
|
||||
var videoSort: String = "recommend"
|
||||
var videoList = listOf<ForumVideoEntity>()
|
||||
var videoList = arrayListOf<ForumVideoEntity>()
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<MutableList<AnswerEntity>> {
|
||||
return when (mPath) {
|
||||
@ -37,10 +37,10 @@ class ForumArticleAskListViewModel(application: Application, val bbsId: String =
|
||||
override fun mergeResultLiveData() {
|
||||
mResultLiveData.addSource(mListLiveData) { list ->
|
||||
|
||||
videoList = list.map {
|
||||
videoList = ArrayList(list.map {
|
||||
if (mPath == "视频") it.type = "video"
|
||||
it.transformForumVideoEntity()
|
||||
}
|
||||
})
|
||||
|
||||
mResultLiveData.postValue(list)
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ class ForumActivityAdapter(context: Context,
|
||||
// 奖励发放中
|
||||
currentTime > activityEntity.awardTime.start
|
||||
&& currentTime < activityEntity.awardTime.end -> {
|
||||
status = "发放中"
|
||||
statusTv.text = "发放中"
|
||||
status = "奖励发放中"
|
||||
statusTv.text = "奖励发放中"
|
||||
statusTv.setTextColor(R.color.theme_font.toColor())
|
||||
statusTv.setBackgroundResource(R.drawable.bg_forum_activity_status_blue)
|
||||
val startTime = TimeUtils.getFormatTime(activityEntity.awardTime.start, "yyyy.MM.dd")
|
||||
|
||||
@ -174,10 +174,8 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
} else {
|
||||
if (entity.questions.answerCount > 0) {
|
||||
commentCount.text = entity.questions.answerCount.toString()
|
||||
commentCount.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(itemView.context, R.drawable.community_question_answer_count), null, null, null)
|
||||
} else {
|
||||
commentCount.text = "我来回答"
|
||||
commentCount.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(itemView.context, R.drawable.community_question_answer_edit), null, null, null)
|
||||
}
|
||||
voteCount.text = "邀请回答"
|
||||
voteIcon.setImageDrawable(ContextCompat.getDrawable(itemView.context, R.drawable.community_invite_follow))
|
||||
|
||||
@ -138,8 +138,10 @@ class ForumArticleListFragment : LazyListFragment<ArticleEntity, ForumArticleLis
|
||||
super.onLoadDone()
|
||||
if (CheckLoginUtils.isLogin()) mHaveLoadLoginData = true
|
||||
AppExecutor.uiExecutor.executeWithDelay(Runnable {
|
||||
scroll()
|
||||
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, RecyclerView.SCROLL_STATE_IDLE)
|
||||
tryCatchInRelease {
|
||||
scroll()
|
||||
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, RecyclerView.SCROLL_STATE_IDLE)
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
@ -189,6 +191,8 @@ class ForumArticleListFragment : LazyListFragment<ArticleEntity, ForumArticleLis
|
||||
mAdapter?.run {
|
||||
entityList.add(0, entity)
|
||||
notifyDataSetChanged()
|
||||
mViewModel?.videoList?.add(0, entity.transformForumVideoEntity())
|
||||
scrollToTop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ class ForumArticleListViewModel(application: Application) : ListViewModel<Articl
|
||||
var recordForums = arrayListOf<ForumEntity>()
|
||||
var recordStatusForums = arrayListOf<ForumUnreadEntity>()
|
||||
var sort: String = "time.comment"//排序 time.edit 最新发布 time.comment 最新回复
|
||||
var videoList = listOf<ForumVideoEntity>()
|
||||
var videoList = arrayListOf<ForumVideoEntity>()
|
||||
|
||||
init {
|
||||
setOverLimitSize(0)
|
||||
@ -40,7 +40,7 @@ class ForumArticleListViewModel(application: Application) : ListViewModel<Articl
|
||||
override fun mergeResultLiveData() {
|
||||
mResultLiveData.addSource(mListLiveData) { list ->
|
||||
|
||||
videoList = list.map { it.transformForumVideoEntity() }
|
||||
videoList = ArrayList(list.map { it.transformForumVideoEntity() })
|
||||
|
||||
mResultLiveData.postValue(list)
|
||||
}
|
||||
|
||||
@ -217,6 +217,11 @@ class ForumFragment: LazyFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
val entityList = (hotForumRv.adapter as? HotForumsAdapter)?.list ?: return
|
||||
val findEntity = entityList.find { it.id == forumFollowChange.forumEntity.id } ?: return
|
||||
val index = entityList.indexOfFirst { it.id == forumFollowChange.forumEntity.id }
|
||||
findEntity.me.isFollowForum = forumFollowChange.isFollow
|
||||
hotForumRv.adapter?.notifyItemChanged(index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,11 +16,11 @@ import org.greenrobot.eventbus.EventBus
|
||||
class HotForumsAdapter(context: Context,
|
||||
private val entrance: String,
|
||||
private val mViewModel: ForumViewModel?,
|
||||
private var mList: List<ForumEntity>)
|
||||
var list: List<ForumEntity>)
|
||||
: BaseRecyclerAdapter<HotForumsAdapter.HotForumViewHolder>(context) {
|
||||
|
||||
|
||||
override fun getItemCount() = mList.size
|
||||
override fun getItemCount() = list.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int)
|
||||
= HotForumViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.hot_forum_item, parent, false))
|
||||
@ -28,7 +28,7 @@ class HotForumsAdapter(context: Context,
|
||||
|
||||
override fun onBindViewHolder(holder: HotForumViewHolder, position: Int) {
|
||||
holder.binding.run {
|
||||
val forumEntity = mList[position]
|
||||
val forumEntity = list[position]
|
||||
entity = forumEntity
|
||||
executePendingBindings()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user