Compare commits
10 Commits
feature-is
...
v5.14.1-63
| Author | SHA1 | Date | |
|---|---|---|---|
| a94bb4dcb5 | |||
| 195d9343eb | |||
| 997bfdf93d | |||
| de712065f5 | |||
| 511449c709 | |||
| 03095b682b | |||
| 8437bfe1e3 | |||
| a169ce1989 | |||
| 9690429e95 | |||
| b1dff15234 |
@ -152,8 +152,18 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
NewLogUtils.logRecommendFeedForumClick(contentType, entity.id, entity.bbs.id, bbsType)
|
||||
}
|
||||
|
||||
MtaHelper.onEvent(getEventId(entrance), getKey(entrance), if (entity.bbs.name.isEmpty()) entity.community.name else entity.bbs.name)
|
||||
itemView.context.startActivity(ForumDetailActivity.getIntent(itemView.context, entity.community.id, entrance))
|
||||
MtaHelper.onEvent(
|
||||
getEventId(entrance),
|
||||
getKey(entrance),
|
||||
if (entity.bbs.name.isEmpty()) entity.community.name else entity.bbs.name
|
||||
)
|
||||
itemView.context.startActivity(
|
||||
ForumDetailActivity.getIntent(
|
||||
itemView.context,
|
||||
entity.community.id,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
LogUtils.uploadAccessToBbs(entity.community.id, "文章外所属论坛")
|
||||
}
|
||||
|
||||
@ -208,11 +218,24 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
itemView.context.startActivity(intent)
|
||||
}
|
||||
"answer" -> {
|
||||
val intent = NewQuestionDetailActivity.getCommentIntent(it.context, entity.questions.id, entity.id, entrance, "")
|
||||
val intent = NewQuestionDetailActivity.getCommentIntent(
|
||||
it.context,
|
||||
entity.questions.id,
|
||||
entity.id,
|
||||
entrance,
|
||||
""
|
||||
)
|
||||
itemView.context.startActivity(intent)
|
||||
}
|
||||
"video" -> {
|
||||
itemView.context.startActivity(ForumVideoDetailActivity.getIntent(itemView.context, entity.id, entity.community.id, true))
|
||||
itemView.context.startActivity(
|
||||
ForumVideoDetailActivity.getIntent(
|
||||
itemView.context,
|
||||
entity.id,
|
||||
entity.community.id,
|
||||
true
|
||||
)
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
val communityId = entity.community.id
|
||||
@ -300,7 +323,8 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
commentCount.setCompoundDrawables(commentIcon, null, null, null)
|
||||
commentCount.setTextColor(R.color.text_subtitleDesc.toColor(commentCount.context))
|
||||
} else {
|
||||
val commentCloseIcon = itemView.context.resources.getDrawable(R.drawable.community_comment_count_unavailable)
|
||||
val commentCloseIcon =
|
||||
itemView.context.resources.getDrawable(R.drawable.community_comment_count_unavailable)
|
||||
commentCloseIcon.setBounds(0, 0, commentCloseIcon.minimumWidth, commentCloseIcon.minimumHeight)
|
||||
commentCount.setCompoundDrawables(commentCloseIcon, null, null, null)
|
||||
commentCount.setTextColor(R.color.text_body.toColor(commentCount.context))
|
||||
@ -317,17 +341,24 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
RetrofitManager.getInstance()
|
||||
.api.voteVideo(entity.id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
//Utils.toast(getApplication(), "已点赞")
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
entity.me.isVoted = true
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
EnergyTaskHelper.postEnergyTask("vote_video", entity.id)
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
entity.me.isVoted = false
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
if (exception is HttpException) {
|
||||
ErrorHelper.handleError(
|
||||
itemView.context,
|
||||
exception.response()?.errorBody()?.string()
|
||||
)
|
||||
}
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
})
|
||||
@ -352,73 +383,75 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
EnergyTaskHelper.postEnergyTask("vote_answer", entity.id)
|
||||
}
|
||||
ToastUtils.showToast("已赞同")
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
} else if (403036 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
} else if (404001 == it) {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
} else {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = true
|
||||
} else {
|
||||
entity.me.isAnswerVoted = true
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
when (it) {
|
||||
403008 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
}
|
||||
403036 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
}
|
||||
404001 -> {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
}
|
||||
else -> {
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
playVoteAnimation()
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun cancelAnswerVote(entity: AnswerEntity) {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
|
||||
voteIcon.isChecked = false
|
||||
voteCount.setTextColor(R.color.text_subtitleDesc.toColor(voteCount.context))
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
|
||||
if (entity.type == "video") {
|
||||
RetrofitManager.getInstance()
|
||||
.api.undoVoteVideo(entity.id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
entity.me.isVoted = false
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
Utils.toast(itemView.context, "取消点赞")
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
entity.me.isVoted = true
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
if (exception is HttpException) {
|
||||
ErrorHelper.handleError(
|
||||
itemView.context,
|
||||
exception.response()?.errorBody()?.string()
|
||||
)
|
||||
}
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
val unVoteObservable = if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = false
|
||||
RetrofitManager.getInstance().api.postCommunityArticleUnVote(entity.id)
|
||||
} else {
|
||||
entity.me.isAnswerVoted = false
|
||||
|
||||
RetrofitManager.getInstance().api
|
||||
.postAnswerUnvote(entity.id)
|
||||
}
|
||||
@ -427,32 +460,42 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<VoteEntity>() {
|
||||
override fun onResponse(response: VoteEntity?) {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = false
|
||||
} else {
|
||||
entity.me.isAnswerVoted = false
|
||||
}
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
Utils.toast(itemView.context, "取消赞同")
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
} else if (403036 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
} else if (404001 == it) {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
} else {
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = true
|
||||
} else {
|
||||
entity.me.isAnswerVoted = true
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
when (it) {
|
||||
403008 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
}
|
||||
403036 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
}
|
||||
404001 -> {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
}
|
||||
else -> {
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -477,7 +520,11 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
@ -518,7 +565,11 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
|
||||
@ -311,6 +311,13 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
|
||||
super.onResume()
|
||||
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
|
||||
EventBus.getDefault().post(EBReuse(COMMENT_RESUME))
|
||||
|
||||
if (::commentEt.isInitialized && commentEt.text.isNotEmpty()) {
|
||||
// 若不延迟,可能回来的时候不能获取焦点导致弹不起来
|
||||
mBaseHandler.postDelayed({
|
||||
Util_System_Keyboard.showSoftKeyboard(context, commentEt)
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
||||
BIN
app/src/main/res/drawable-night-xxxhdpi/ic_selector_default.webp
Normal file
BIN
app/src/main/res/drawable-night-xxxhdpi/ic_selector_default.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_selector_default.webp
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_selector_default.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 186 B |
@ -7,8 +7,8 @@ ext {
|
||||
targetSdkVersion = 28
|
||||
|
||||
// application info (每个大版本之间的 versionCode 增加 20)
|
||||
versionCode = 630
|
||||
versionName = "5.14.0"
|
||||
versionCode = 631
|
||||
versionName = "5.14.1"
|
||||
applicationId = "com.gh.gamecenter"
|
||||
|
||||
// AndroidX
|
||||
|
||||
@ -24,13 +24,17 @@ class CustomLayoutInflaterFactory(
|
||||
mAppCompatActivity.delegate.createView(parent, name, context, attrs)
|
||||
?: mAppCompatActivity.onCreateView(parent, name, context, attrs)
|
||||
?: mAppCompatActivity.layoutInflater.createView(name, null, attrs)
|
||||
} catch (e: ClassNotFoundException) {
|
||||
} catch (e: Exception) {
|
||||
try {
|
||||
mAppCompatActivity.layoutInflater.createView(name, "android.widget.", attrs)
|
||||
if (e is ClassNotFoundException) {
|
||||
mAppCompatActivity.layoutInflater.createView(name, "android.widget.", attrs)
|
||||
}
|
||||
} catch (e2: Exception) {
|
||||
e2.printStackTrace()
|
||||
return null
|
||||
}
|
||||
e.printStackTrace()
|
||||
return null
|
||||
}
|
||||
|
||||
val n = attrs.attributeCount
|
||||
|
||||
Reference in New Issue
Block a user