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

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
This commit is contained in:
kehaoyuan
2019-12-02 00:13:19 +08:00
3 changed files with 26 additions and 3 deletions

View File

@ -189,7 +189,7 @@ class AmwayAdapter(context: Context, private var mViewModel: AmwayViewModel, pri
}
binding.commentContainer.setOnClickListener {
val intent = RatingReplyActivity.getIntent(context, amway.game.id, amway.comment.id, false, "(安利墙)", "")
val intent = RatingReplyActivity.getIntent(context, amway.game.id, amway.comment, false, "(安利墙)", "")
SyncDataBetweenPageHelper.startActivityForResult(binding.root.context, intent, RatingFragment.RATING_REPLAY_REQUEST, adapterPosition)
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_评论")
}

View File

@ -233,6 +233,21 @@ class RatingReplyActivity : ListActivity<RatingReplyEntity, RatingReplyViewModel
return intent
}
@JvmStatic
fun getIntent(context: Context,
gameId: String,
comment: RatingComment,
showKeyboardIfReplyListIsEmpty: Boolean,
entrance: String,
path: String): Intent {
val intent = Intent(context, RatingReplyActivity::class.java)
intent.putExtra(EntranceUtils.KEY_ENTRANCE, mergeEntranceAndPath(entrance, path))
intent.putExtra(EntranceUtils.KEY_GAMEID, gameId)
intent.putExtra(RatingComment::class.java.simpleName, comment)
intent.putExtra(EntranceUtils.KEY_SHOW_KEYBOARD_IF_NEEDED, showKeyboardIfReplyListIsEmpty)
return intent
}
@JvmStatic
fun getIntent(context: Context, gameId: String, commentId: String, entrance: String, path: String): Intent {
return getIntent(context, gameId, commentId, true, entrance, path)

View File

@ -58,7 +58,9 @@ class RatingReplyViewModel(application: Application,
}
fun initData() {
if (game != null && comment != null) {
if (!gameId.isNullOrEmpty()) {
getGameDigest()
} else if (game != null && comment != null) {
mListLiveData.postValue(null) // init Head
load(LoadType.REFRESH)
} else {
@ -117,7 +119,12 @@ class RatingReplyViewModel(application: Application,
.subscribe(object : Response<GameEntity>() {
override fun onResponse(response: GameEntity?) {
game = response
getCommentDigest()
if (comment == null) {
getCommentDigest()
} else {
load(LoadType.REFRESH)
headDataLiveData.postValue(true)
}
}
override fun onFailure(e: HttpException?) {
@ -238,6 +245,7 @@ class RatingReplyViewModel(application: Application,
}
})
}
fun unvoteComment(callback: () -> Unit) {
mApi.unvoteGameComment(game?.id, comment?.id)
.subscribeOn(Schedulers.io())