Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev

This commit is contained in:
张玉久
2020-09-04 09:24:28 +08:00
7 changed files with 12 additions and 10 deletions

View File

@ -8,7 +8,7 @@ import kotlinx.android.parcel.Parcelize
data class ArticleCommentParent(val user: User = User(),
val active: Boolean = true,
val comment: String = "",
var me: MeEntity) : Parcelable
var me: MeEntity? = MeEntity()) : Parcelable
@Parcelize
data class User(

View File

@ -837,7 +837,7 @@ class GameDetailFragment : NormalFragment() {
GdtHelper.logAction(ActionType.SHARE, GdtHelper.CONTENT_TYPE, "GAME", GdtHelper.CONTENT_ID, mGameEntity!!.id)
val url = "http://www.ghzs666.com/game/" + it.shareCode
val url = "http://m.ghzs666.com/game/" + it.shareCode
if (activity is BaseActivity) {
var shareEntrance: ShareUtils.ShareEntrance = ShareUtils.ShareEntrance.game

View File

@ -50,7 +50,7 @@ class ArticleDetailViewModel(application: Application,
}
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData) { mergeListData(it, displayFloor = true, inAscOrder = currentSortType == SortType.OLDEST) }
mResultLiveData.addSource(mListLiveData) { mergeListData(it, displayFloor = true) }
}
fun getArticleDetail() {
@ -63,7 +63,7 @@ class ArticleDetailViewModel(application: Application,
topItemData = CommentItemData(articleDetail = response)
commentCount = response?.count?.comment ?: 0
loadResultLiveData.postValue(LoadResult.SUCCESS)
mergeListData(mListLiveData.value, displayFloor = true, inAscOrder = currentSortType == SortType.OLDEST)
mergeListData(mListLiveData.value, displayFloor = true)
}
override fun onFailure(e: HttpException?) {

View File

@ -209,7 +209,7 @@ abstract class BaseArticleDetailCommentAdapter(context: Context,
// 帖子详情页面用的样式
updateSubComment(comment.subCommentList, viewModel.topItemData?.articleDetail?.user?.id
?: "")
binding.floorHintTv.text = if (comment.floor != 0) "${comment.floor}" else CommentUtils.getCommentTime(comment.time)
binding.floorHintTv.text = if (comment.floor != 0) "${comment.floor}" else ""
binding.root.setOnClickListener {
ArticleDetailCommentActivity.getIntent(binding.root.context, comment.id!!, viewModel.communityId, viewModel.articleId, false, comment.floor, entrance, PATH_ARTICLE_DETAIL).apply {
binding.root.context.startActivity(this)

View File

@ -69,7 +69,7 @@ abstract class BaseArticleDetailCommentViewModel(application: Application, var a
}
}
fun mergeListData(commentList: List<CommentEntity>?, displayFloor: Boolean = false, inAscOrder: Boolean = false) {
fun mergeListData(commentList: List<CommentEntity>?, displayFloor: Boolean = false) {
topItemData?.let {
val mergedList = arrayListOf<CommentItemData>().apply {
if (mResultLiveData.value?.firstOrNull() != null) {
@ -85,15 +85,14 @@ abstract class BaseArticleDetailCommentViewModel(application: Application, var a
} else if (commentList.isNullOrEmpty() && mLoadStatusLiveData.value == LoadStatus.INIT_FAILED) {
add(CommentItemData(errorConnection = true))
} else {
// 草,这里的楼数有问题,接口来不及改,干脆倒序的时候不显示楼层好了
var floor = if (inAscOrder) 1 else commentCount + 1
var floor = 1
commentList?.forEach {
if (displayFloor) {
it.floor = if (inAscOrder) floor else 0
it.floor = floor
}
add(CommentItemData(commentNormal = it))
if (displayFloor) {
if (inAscOrder) floor++
floor++
}
}
add(CommentItemData(footer = true))

View File

@ -34,6 +34,7 @@ class ArticleDetailCommentFragment : BaseArticleDetailCommentFragment<CommentIte
super.onCreate(savedInstanceState)
mViewModel.getComment()
mViewModel.positionInOriginList = arguments?.getInt(EntranceUtils.KEY_POSITION) ?: -1
}
override fun getLayoutId() = R.layout.fragment_article_detail_comment

View File

@ -21,6 +21,7 @@ class ArticleDetailCommentViewModel(application: Application,
: BaseArticleDetailCommentViewModel(application, articleId, communityId) {
var commentDetail: CommentEntity? = null
var positionInOriginList = -1
override fun provideDataObservable(page: Int): Observable<List<CommentEntity>>? = null
@ -41,6 +42,7 @@ class ArticleDetailCommentViewModel(application: Application,
@SuppressLint("CheckResult")
override fun onSuccess(data: CommentEntity) {
commentDetail = data
commentDetail?.floor = positionInOriginList
commentCount = data.reply
topItemData = CommentItemData(commentTop = data)
loadResultLiveData.postValue(LoadResult.SUCCESS)