【光环助手v5.10.0】前端优化汇总5月第3周 (15) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1858#note_150514
This commit is contained in:
@ -1,23 +0,0 @@
|
||||
package com.gh.gamecenter.qa.answer
|
||||
|
||||
import com.gh.gamecenter.databinding.CommunityMyAnswerItemBinding
|
||||
import com.gh.gamecenter.qa.entity.AnswerEntity
|
||||
import com.gh.gamecenter.qa.entity.ArticleEntity
|
||||
|
||||
class MyAnswerViewHolder(val binding: CommunityMyAnswerItemBinding) : BaseAnswerOrArticleItemViewHolder(binding.root) {
|
||||
|
||||
fun bindItem(entity: AnswerEntity, entrance: String) {
|
||||
bindCommendAndVote(entity, entrance)
|
||||
binding.title.text = entity.questions.title
|
||||
binding.content.text = entity.brief
|
||||
binding.forumNameTv.text = if (!entity.communityName.isNullOrEmpty()) entity.communityName else entity.bbs.name
|
||||
}
|
||||
|
||||
fun bindItem(entity: ArticleEntity, entrance: String) {
|
||||
bindCommendAndVote(entity, entrance)
|
||||
val data = entity.transformAnswerEntity()
|
||||
binding.title.text = data.questions.title
|
||||
binding.content.text = data.brief
|
||||
binding.forumNameTv.text = if (!data.communityName.isNullOrEmpty()) data.communityName else data.bbs.name
|
||||
}
|
||||
}
|
||||
@ -12,8 +12,9 @@ import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.databinding.CommunityMyAnswerItemBinding;
|
||||
import com.gh.gamecenter.qa.answer.MyAnswerViewHolder;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.databinding.CommunityAnswerItemBinding;
|
||||
import com.gh.gamecenter.forum.home.ForumArticleAskItemViewHolder;
|
||||
import com.gh.gamecenter.qa.entity.AnswerEntity;
|
||||
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity;
|
||||
|
||||
@ -50,8 +51,8 @@ class MyAnswerAdapter extends ListAdapter<AnswerEntity> implements ISyncAdapterH
|
||||
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
|
||||
return new FooterViewHolder(view, mListClickListener);
|
||||
case ItemViewType.ITEM_BODY:
|
||||
view = mLayoutInflater.inflate(R.layout.community_my_answer_item, parent, false);
|
||||
return new MyAnswerViewHolder(CommunityMyAnswerItemBinding.bind(view));
|
||||
view = mLayoutInflater.inflate(R.layout.community_answer_item, parent, false);
|
||||
return new ForumArticleAskItemViewHolder(CommunityAnswerItemBinding.bind(view));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -61,11 +62,23 @@ class MyAnswerAdapter extends ListAdapter<AnswerEntity> implements ISyncAdapterH
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
switch (getItemViewType(position)) {
|
||||
case ItemViewType.ITEM_BODY:
|
||||
MyAnswerViewHolder answerViewHolder = ((MyAnswerViewHolder) holder);
|
||||
ForumArticleAskItemViewHolder answerViewHolder = ((ForumArticleAskItemViewHolder) holder);
|
||||
AnswerEntity entity = mEntityList.get(position);
|
||||
answerViewHolder.bindItem(entity, mEntrance);
|
||||
CommunityMyAnswerItemBinding binding = answerViewHolder.getBinding();
|
||||
binding.imageContainer.bindData(entity, mEntrance, "");
|
||||
|
||||
answerViewHolder.bindForumAnswerItem(entity, mEntrance, "", position);
|
||||
|
||||
CommunityAnswerItemBinding binding = answerViewHolder.getBinding();
|
||||
binding.userIcon.setVisibility(View.GONE);
|
||||
binding.userName.setVisibility(View.GONE);
|
||||
binding.userBadgeIcon.setVisibility(View.GONE);
|
||||
binding.userBadgeName.setVisibility(View.GONE);
|
||||
binding.concernBtn.setVisibility(View.GONE);
|
||||
binding.timeContainer.setVisibility(View.GONE);
|
||||
binding.userIcon.setVisibility(View.GONE);
|
||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) binding.questionTitle.getLayoutParams();
|
||||
params.topMargin = DisplayUtils.dip2px(20F);
|
||||
binding.questionTitle.setLayoutParams(params);
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
mContext.startActivity(NewQuestionDetailActivity.getCommentIntent(mContext,
|
||||
entity.getQuestions().getId(), entity.getId() != null ? entity.getId() : "", mEntrance, "我的光环-我的问答-我的回答"));
|
||||
|
||||
@ -15,6 +15,7 @@ import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.view.CustomDividerItemDecoration;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.gh.gamecenter.qa.entity.AnswerEntity;
|
||||
import com.gh.gamecenter.qa.entity.ArticleEntity;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
Reference in New Issue
Block a user