Compare commits

...

10 Commits

Author SHA1 Message Date
a94bb4dcb5 fix: 修复模拟器运行即闪退的问题 2022-10-28 16:22:29 +08:00
195d9343eb chore: 版本更新至 5.14.1 2022-10-28 15:45:09 +08:00
997bfdf93d Merge branch 'hotfix-v5.14.0-630-vector_crash' into 'release'
fix:修复5.0以下系统部分矢量图加载出错导致无法显示的问题

See merge request halo/android/assistant-android!373
2022-10-27 15:34:53 +08:00
de712065f5 Merge branch 'hotfix-v5.14.0-630-soft_keyboard' into 'release'
fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题

See merge request halo/android/assistant-android!372
2022-10-27 14:56:33 +08:00
511449c709 fix:修复5.0以下系统部分矢量图加载出错导致无法显示的问题 2022-10-27 14:50:24 +08:00
03095b682b fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题 2022-10-27 14:32:48 +08:00
8437bfe1e3 Merge branch 'hotfix-v5.14.0-630-soft_keyboard' into 'release'
fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题

See merge request halo/android/assistant-android!369
2022-10-27 11:34:54 +08:00
a169ce1989 fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题 2022-10-27 10:48:14 +08:00
9690429e95 Merge branch 'hotfix-v5.14.0-630-banned_vote_error' into 'release'
【光环助手V5.15.0】违规整合-正式环境运营验收问题(19) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2129

See merge request halo/android/assistant-android!367
2022-10-25 16:58:08 +08:00
b1dff15234 fix: 【光环助手V5.15.0】违规整合-正式环境运营验收问题(19) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2129 2022-10-25 15:45:48 +08:00
6 changed files with 133 additions and 71 deletions

View File

@ -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

View File

@ -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() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

View File

@ -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

View File

@ -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