Skip to content

Commit

Permalink
🎉Release 1.3,新UI微调消息气泡布局,添加时间戳显示TextView
Browse files Browse the repository at this point in the history
  • Loading branch information
Hny0305Lin committed Jul 6, 2024
1 parent ffb1068 commit 07ee0e0
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 23 deletions.
5 changes: 2 additions & 3 deletions app/src/main/res/drawable/bg_chat_bubble_wechat_received.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
</layer-list>
</item>
<item
android:gravity="left|top"
android:top="15dp">
android:gravity="left|center">
<rotate
android:fromDegrees="45"
android:pivotX="50%"
android:pivotY="135%">
android:pivotY="125%">
<shape android:shape="rectangle">
<size
android:width="8dp"
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/res/drawable/bg_chat_bubble_wechat_sent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
</layer-list>
</item>
<item
android:gravity="end|top"
android:top="15dp">
android:gravity="end|center">
<rotate
android:fromDegrees="315"
android:pivotX="50%"
android:pivotY="135%">
android:pivotY="125%">
<shape android:shape="rectangle">
<size
android:width="8dp"
Expand Down
42 changes: 34 additions & 8 deletions app/src/main/res/layout/item_chat_received.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,42 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:padding="8dp"
android:padding="3dp"
android:gravity="start">

<TextView
android:id="@+id/text_message_body"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_chat_bubble_wechat_received"
android:padding="10dp"
android:textColor="@android:color/black"
android:text="Hello, this is a received message! Test! " />
android:layout_height="wrap_content">

<TextView
android:id="@+id/text_message_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_chat_bubble_wechat_received"
android:gravity="start"
android:padding="10dp"
android:textColor="@color/black"
android:text="Hello, this is a received message! Test!"
android:maxWidth="220dp"
android:hyphenationFrequency="none"
android:breakStrategy="simple"
app:layout_constraintEnd_toStartOf="@+id/text_message_time"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<TextView
android:id="@+id/text_message_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="12:00 PM"
android:textColor="@color/newui_time"
app:layout_constraintStart_toEndOf="@id/text_message_body"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

</LinearLayout>
43 changes: 35 additions & 8 deletions app/src/main/res/layout/item_chat_sent.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:padding="3dp"
android:gravity="end">

<TextView
android:id="@+id/text_message_body"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_chat_bubble_wechat_sent"
android:padding="10dp"
android:textColor="@android:color/black"
android:text="Hello, this is a sent message! Test! " />
android:layout_height="wrap_content">

<TextView
android:id="@+id/text_message_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:text="12:00 PM"
android:textColor="@color/newui_time"
app:layout_constraintEnd_toStartOf="@id/text_message_body"
app:layout_constraintTop_toTopOf="parent"/>

<TextView
android:id="@+id/text_message_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_chat_bubble_wechat_sent"
android:gravity="end"
android:breakStrategy="simple"
android:hyphenationFrequency="none"
android:maxWidth="220dp"
android:padding="10dp"
android:text="Hello, this is a sent message! Test!"
android:textColor="@android:color/black"
app:layout_constraintEnd_toStartOf="@id/text_message_time"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

</LinearLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
<color name="snackbar_log_i">#00CC66</color>
<color name="snackbar_log_w">#CC9966</color>
<color name="snackbar_log_e">#CC0066</color>

<color name="newui_time">#aaa</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">NLChat</string>
<string name="app_package">com.haohanyh.linmengjia.nearlink.nlchat.fun</string>
<string name="app_version">1.3.88.2024.0706</string>
<string name="app_version">1.3.95.2024.0707</string>

<string name="appwarn">NLChat,浩瀚银河宗旨为用爱和魔法创造Android APP。</string>
<string name="thanks3q">友情感谢</string>
Expand Down

0 comments on commit 07ee0e0

Please sign in to comment.