Commit 80b36517 by 段启岩

问答列表完成

parent 8bc7b9bb
package cn.yunliyunwai.beyondclouds.adapter; package cn.yunliyunwai.beyondclouds.adapter;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import cn.yunliyunwai.beyondclouds.data.model.Question; import cn.yunliyunwai.beyondclouds.data.model.Question;
import cn.yunliyunwai.beyondclouds.databinding.QuestionItemBinding; import cn.yunliyunwai.beyondclouds.databinding.QuestionItemBinding;
import cn.yunliyunwai.beyondclouds.util.DateUtils;
import cn.yunliyunwai.beyondclouds.util.GlideRoundTransform;
public class QuestionListRecyclerViewAdapter extends BaseQuickAdapter<Question,BaseViewHolder> { public class QuestionListRecyclerViewAdapter extends BaseQuickAdapter<Question,BaseViewHolder> {
private static final GlideRoundTransform glideRoundTransform = new GlideRoundTransform(3);
public QuestionListRecyclerViewAdapter(int layoutResId) { public QuestionListRecyclerViewAdapter(int layoutResId) {
super(layoutResId); super(layoutResId);
} }
...@@ -21,8 +20,12 @@ public class QuestionListRecyclerViewAdapter extends BaseQuickAdapter<Question,B ...@@ -21,8 +20,12 @@ public class QuestionListRecyclerViewAdapter extends BaseQuickAdapter<Question,B
QuestionItemBinding binding = QuestionItemBinding.bind(helper.itemView); QuestionItemBinding binding = QuestionItemBinding.bind(helper.itemView);
binding.txtTitle.setText(question.getQuestionTitle()); binding.txtTitle.setText(question.getQuestionTitle());
binding.txtAbstract.setText(question.getQuestionAbstract()); binding.txtReplyNumber.setText(question.getReplyNumber() + "回答");
binding.txtAuthor.setText(question.getUserNick());
binding.txtCreateTime.setText(DateUtils.format(question.getCreateTime())); if (question.isSolved()) {
binding.txtSolved.setVisibility(View.VISIBLE);
} else {
binding.txtSolved.setVisibility(View.GONE);
}
} }
} }
\ No newline at end of file
...@@ -8,7 +8,8 @@ import lombok.Data; ...@@ -8,7 +8,8 @@ import lombok.Data;
public class Question { public class Question {
private String questionId; private String questionId;
private String questionTitle; private String questionTitle;
private String questionAbstract; private String replyNumber;
private String userNick; private String userNick;
private boolean solved;
private Date createTime; private Date createTime;
} }
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="22dp" android:layout_height="22dp"
android:text="SpringBoot迭代发布JRA瘦身配置" android:text="SpringBoot迭代发布JRA瘦身配置"
android:textSize="16sp" android:textSize="15sp"
android:textColor="@color/colorTextLevel3" android:textColor="@color/colorTextLevel3"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
...@@ -32,75 +32,43 @@ ...@@ -32,75 +32,43 @@
tools:layout_editor_absoluteY="16dp" /> tools:layout_editor_absoluteY="16dp" />
<TextView <TextView
android:id="@+id/txt_abstract" android:id="@+id/txt_reply_number"
android:layout_marginTop="10dp" android:layout_marginTop="8dp"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxHeight="55dp" android:maxHeight="55dp"
android:textSize="12sp" android:textSize="12sp"
android:text="我们所处的时代我们所处的时代我们所处的时代我们所处的时代我们所处的时代我们所处的时代我们所处的时代我们所处的时代" android:text="0回答"
app:layout_constraintTop_toBottomOf="@id/barrier_title" app:layout_constraintTop_toBottomOf="@id/barrier_title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="txt_abstract"
tools:layout_editor_absoluteX="12dp"
tools:layout_editor_absoluteY="16dp" />
<TextView <TextView
android:id="@+id/txt_author" android:id="@+id/txt_solved"
android:layout_marginTop="10dp" android:layout_marginTop="8dp"
android:text="段启岩" android:layout_marginStart="20dp"
android:textSize="10sp" android:layout_marginLeft="20dp"
android:textColor="@color/colorTextLevel5" app:layout_constraintTop_toBottomOf="@id/barrier_title"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toEndOf="@id/txt_reply_number"
app:layout_constraintTop_toBottomOf="@id/barrier_content" android:layout_width="132dp"
android:layout_width="wrap_content" android:layout_height="18dp"
android:layout_height="wrap_content" /> android:text="已解决"
<TextView android:textColor="#75d098"
android:id="@+id/txt_dot" android:textSize="12sp"
android:text="·" android:gravity="left"
android:layout_marginTop="10dp" />
android:textSize="10sp"
android:textStyle="bold"
android:textColor="@color/colorTextLevel5"
app:layout_constraintTop_toBottomOf="@id/barrier_content"
app:layout_constraintStart_toEndOf="@id/txt_author"
android:paddingStart="6dp"
android:paddingLeft="6dp"
android:paddingEnd="6dp"
android:paddingRight="6dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/txt_create_time"
android:layout_marginTop="10dp"
android:textSize="10sp"
android:textColor="@color/colorTextLevel5"
android:text="2020-2-18 10:24:00"
app:layout_constraintTop_toBottomOf="@id/barrier_content"
app:layout_constraintStart_toEndOf="@id/txt_dot"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_info" android:id="@+id/barrier_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:barrierDirection="bottom" app:barrierDirection="bottom"
app:constraint_referenced_ids="txt_create_time,txt_author,txt_dot" app:constraint_referenced_ids="txt_reply_number"
tools:layout_editor_absoluteX="12dp" tools:layout_editor_absoluteX="12dp"
tools:layout_editor_absoluteY="16dp" /> tools:layout_editor_absoluteY="16dp" />
<View <View
app:layout_constraintTop_toBottomOf="@id/barrier_info" app:layout_constraintTop_toBottomOf="@id/barrier_content"
android:layout_marginTop="18dp" android:layout_marginTop="14dp"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:background="#efefef" /> android:background="#efefef" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment