Merge branch 'dev' of git.ghzs.com:halo/android/assistant-android into dev
This commit is contained in:
@ -5,6 +5,7 @@ import android.util.SparseBooleanArray
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.common.constant.ItemViewType
|
||||
@ -20,8 +21,9 @@ import kotlinx.android.synthetic.main.item_my_game_rating.view.*
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class UserCommentHistoryAdapter(context: Context,
|
||||
val mEntrance: String,
|
||||
val mListViewModel: UserCommentHistoryViewModel) : ListAdapter<MyRating>(context) {
|
||||
private val mEntrance: String,
|
||||
private val mFragment: Fragment,
|
||||
private val mListViewModel: UserCommentHistoryViewModel) : ListAdapter<MyRating>(context) {
|
||||
|
||||
private var mExpandSparseBooleanArray = SparseBooleanArray()
|
||||
|
||||
@ -117,7 +119,7 @@ class UserCommentHistoryAdapter(context: Context,
|
||||
MtaHelper.onEvent("我的光环_新", "我的游戏评论", "评论详情")
|
||||
val intent = RatingReplyActivity.getIntent(mContext, rating.game.id, rating.id, false, "我的游戏评论", "")
|
||||
|
||||
SyncDataBetweenPageHelper.startActivityForResult(mContext, intent, 100, position)
|
||||
SyncDataBetweenPageHelper.startActivityForResult(mFragment, intent, 100, position)
|
||||
}
|
||||
tvComment.setOnLongClickListener(View.OnLongClickListener {
|
||||
isChildLongClick = true
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.gh.gamecenter.personalhome.home.game
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
@ -8,6 +10,7 @@ import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.RatingComment
|
||||
import com.gh.gamecenter.personalhome.home.UserHistoryFragment
|
||||
import com.gh.gamecenter.personalhome.rating.MyRating
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -38,7 +41,7 @@ class UserCommentHistoryFragment : ListFragment<MyRating, UserCommentHistoryView
|
||||
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
if (mAdapter == null) {
|
||||
mAdapter = UserCommentHistoryAdapter(requireContext(), mEntrance, mListViewModel)
|
||||
mAdapter = UserCommentHistoryAdapter(requireContext(), mEntrance, this, mListViewModel)
|
||||
}
|
||||
return mAdapter!!
|
||||
}
|
||||
@ -72,6 +75,24 @@ class UserCommentHistoryFragment : ListFragment<MyRating, UserCommentHistoryView
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (data != null && resultCode == Activity.RESULT_OK) {
|
||||
val dataPosition = data.getIntExtra("DATA_POSITION_TAG", -1)
|
||||
if (mAdapter?.entityList?.isEmpty() == true) return
|
||||
val rating = mAdapter?.entityList?.get(dataPosition)
|
||||
val resultData = data.getParcelableExtra<RatingComment>(RatingComment::class.java.simpleName)
|
||||
rating?.apply {
|
||||
vote = resultData?.vote ?: 0
|
||||
reply = resultData?.reply ?: 0
|
||||
content = resultData?.content ?: ""
|
||||
star = resultData?.star ?: 0
|
||||
me.isVoted = resultData?.me?.isVoted ?: false
|
||||
}
|
||||
mAdapter?.notifyItemChanged(dataPosition)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val USER_ID = "user_id"
|
||||
|
||||
@ -169,6 +169,7 @@
|
||||
android:padding="17dp"
|
||||
android:drawableLeft="@drawable/comment_vote_selector"
|
||||
android:drawablePadding="4dp"
|
||||
android:checked="@{entity.me.isVoted}"
|
||||
android:textColor="@color/vote_selector"
|
||||
android:textSize="13sp"
|
||||
android:text="@{entity.vote > 0? NumberUtils.transSimpleCount(entity.vote) : ``}"
|
||||
|
||||
Reference in New Issue
Block a user