完善最新帖子界面布局

0515
panqihua 5 years ago
parent 9fe5f34159
commit 189c764cb7
  1. 4
      app/src/main/java/com/community/pocket/ui/main/ui/forum/ForumNewFragment.java
  2. 29
      app/src/main/res/layout/main/layout/forum/layout/post.xml
  3. 1
      app/src/main/res/values-en-rUS/strings.xml
  4. 1
      app/src/main/res/values-zh-rCN/strings.xml
  5. 1
      app/src/main/res/values/strings.xml

@ -1,5 +1,6 @@
package com.community.pocket.ui.main.ui.forum;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.View;
@ -37,6 +38,7 @@ public class ForumNewFragment extends BaseFragment {
/**
* 加载最新帖子
*/
@SuppressLint("SetTextI18n")
private void loadPost(View view) {
//TODO 测试数据
for (int i = 0; i < 10; i++) {
@ -47,6 +49,8 @@ public class ForumNewFragment extends BaseFragment {
content.setText("内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容" + i);
TextView author = childView.findViewById(R.id.poster);
author.setText(getString(R.string.poster, "发帖人" + i));
TextView postReply = childView.findViewById(R.id.post_reply);
postReply.setText(getString(R.string.post_reply, 0));
TextView time = childView.findViewById(R.id.post_time);
Date date = new Date();
date.setTime(System.currentTimeMillis());

@ -41,16 +41,31 @@
app:layout_constraintStart_toEndOf="@id/headimg"
app:layout_constraintTop_toTopOf="@id/headimg" />
<TextView
android:id="@+id/poster"
<LinearLayout
android:id="@+id/author_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:textSize="18sp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/headimg" />
app:layout_constraintTop_toBottomOf="@id/post_content">
<TextView
android:id="@+id/poster"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="18sp" />
<TextView
android:id="@+id/post_reply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textSize="18sp" />
</LinearLayout>
<TextView
android:id="@+id/post_time"
@ -60,5 +75,5 @@
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/poster" />
app:layout_constraintTop_toBottomOf="@id/author_layout" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -71,4 +71,5 @@
<string name="post_content_count">wordcount:<font color="red">%1d/%2d</font></string>
<string name="prompt_complain_name">please input complain name</string>
<string name="post">post</string>
<string name="post_reply">reply:%1d</string>
</resources>

@ -71,4 +71,5 @@
<string name="post_content_count">您还可以输入<font color="red">%1d/%2d</font></string>
<string name="prompt_complain_name">" 请选择投诉人"</string>
<string name="post">发帖</string>
<string name="post_reply">回复 :%1d</string>
</resources>

@ -72,6 +72,7 @@
<string name="post_content_count">wordcount:<font color="red">%1d/%2d</font></string>
<string name="prompt_complain_name">please input complain name</string>
<string name="post">post</string>
<string name="post_reply">reply:%1d</string>
<!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save