社区优化汇总(2020年5月)(0527测试7,8) https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/872

This commit is contained in:
kehaoyuan
2020-05-28 10:31:58 +08:00
parent 81debc1cd8
commit 4cfd6952c0
4 changed files with 20 additions and 19 deletions

View File

@ -3,10 +3,10 @@ package com.gh.gamecenter.baselist;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.AsyncTask;
import androidx.recyclerview.widget.DiffUtil;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.utils.Utils;
import java.util.ArrayList;
import java.util.List;
@ -103,8 +103,6 @@ public abstract class ListAdapter<DataType> extends BaseRecyclerAdapter {
}
public void loadChange(LoadStatus status) {
Utils.log("=====>>>" + status.name());
switch (status) {
case INIT_OVER:
case LIST_OVER:

View File

@ -34,7 +34,6 @@ import com.lightgame.utils.Util_System_Keyboard
import org.greenrobot.eventbus.EventBus
// todo 大小输入框交换逻辑出错
open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>(), OnCommentCallBackListener, KeyboardHeightObserver {
@Nullable
@ -99,7 +98,14 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
apiResponse.data != null -> {
mSendingDialog?.dismiss()
toast("发表成功")
commentEt.setText("")
if (mCommentEntity != null) { // 补充默认草稿
mCommentEntity = null // 清空当前评论实体
commentEt.hint = getString(R.string.message_detail_comment_hint)
commentEt.setText(mViewModel.getCommentDraft(mCommentEntity)?.draft ?: "")
} else {
commentEt.setText("")
}
mCommentCount++
updateCommentCount()
@ -163,6 +169,7 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
if (mCommentListener != null) {
mCommentListener?.onCommentDraftChange(commentEt.text.toString())
}
mViewModel.saveCommentDraft(mCommentEntity, commentEt.text.toString())
}
commentEt.filters = arrayOf(TextHelper.getFilter(140, "评论不能多于140字"))
if (!mCommentDraft.isNullOrEmpty()) {
@ -181,8 +188,6 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
}, 200)
} else {
commentEt.clearFocus()
commentSendBtn.setBackgroundResource(R.drawable.comment_send_button_unavailable)
commentSendBtn.setTextColor(R.color.text_cccccc.toColor())
}
commentEt.setOnFocusChangeListener { _, hasFocus ->
@ -228,8 +233,6 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
override fun onDestroy() {
super.onDestroy()
mKeyboardHeightProvider?.close()
mViewModel.saveCommentDraft(mCommentEntity, commentEt.text.toString())
}
private fun updateCommentCount() {

View File

@ -101,11 +101,11 @@ class NewCommentViewModel(application: Application,
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<ResponseBody>() {
override fun onResponse(response: ResponseBody?) {
deleteCommentDraft(commentEntity)
val apiResponse = ApiResponse<JSONObject>()
apiResponse.data = JSONObject()
mPostCommentLiveData.postValue(apiResponse)
deleteCommentDraft(commentEntity)
}
override fun onFailure(e: HttpException?) {