feat: 增加聊天界面每条消息上的好友昵称

增加聊天界面每条消息上的好友昵称,以便于后面适配群聊界面
This commit is contained in:
糕小菜 2024-12-12 17:55:42 +08:00
parent 1068f5e467
commit e48010cae8
14 changed files with 36 additions and 327 deletions

View File

@ -2,19 +2,7 @@
<project version="4">
<component name="GitCommitMessageStorage">
<option name="messageStorage">
<MessageStorage>
<option name="commitTemplate">
<CommitTemplate>
<option name="body" value="" />
<option name="changes" value="" />
<option name="closes" value="" />
<option name="scope" value="" />
<option name="skipCi" value="" />
<option name="subject" value="" />
<option name="type" value="feat" />
</CommitTemplate>
</option>
</MessageStorage>
<MessageStorage />
</option>
</component>
</project>

View File

@ -39,7 +39,6 @@ class LaunchActivity : BaseActivity<ActivityLaunchBinding>() {
}
@SuppressLint("DiscouragedApi", "InternalInsetResource")
private fun getStatusBarHeight(): Int {
var result = 0
@ -51,7 +50,6 @@ class LaunchActivity : BaseActivity<ActivityLaunchBinding>() {
return result
}
private fun navigateToMain() {
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
@ -67,4 +65,4 @@ class LaunchActivity : BaseActivity<ActivityLaunchBinding>() {
startActivity(Intent(this, RegisterActivity::class.java))
}
}
}
}

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp">
<TextView
android:id="@+id/tv_timer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingTop="20dp"
android:text="昨天"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginVertical="20dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timer"
app:roundPercent="0.3" />
<TextView
android:id="@+id/tv_message_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/chat_send_btn_bac_mine"
android:gravity="center_vertical"
android:maxWidth="250dp"
android:minHeight="35dp"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:text="haha"
android:textColor="@color/white"
android:textColorHighlight="#CCCCCC"
android:textIsSelectable="true"
android:textSize="17sp"
app:layout_constraintEnd_toStartOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar"
app:layout_goneMarginEnd="10dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -16,6 +16,18 @@
android:textSize="12sp"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="糕小菜菜"
android:textColor="@color/black"
android:textSize="11sp"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar"
android:layout_width="35dp"
@ -32,26 +44,27 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="3dp"
android:background="@drawable/chat_send_btn_bac_mine"
android:gravity="center_vertical"
android:maxWidth="250dp"
android:minHeight="35dp"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:text="haha"
android:textColor="@color/white"
android:textColorHighlight="#CCCCCC"
android:textIsSelectable="true"
android:textSize="17sp"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar" />
app:layout_constraintTop_toBottomOf="@id/tv_nickname"
app:layout_goneMarginTop="0dp" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar_mine"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginEnd="10dp"
android:layout_marginVertical="20dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timer"
@ -61,13 +74,13 @@
android:id="@+id/tv_msg_content_mine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/chat_send_btn_bac_mine"
android:gravity="center_vertical"
android:maxWidth="250dp"
android:minHeight="35dp"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:layout_marginEnd="10dp"
android:text="haha"
android:textColor="@color/white"
android:textColorHighlight="#CCCCCC"

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp">
<TextView
android:id="@+id/tv_timer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingTop="20dp"
android:text="昨天"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginVertical="20dp"
android:layout_marginStart="10dp"
android:src="@drawable/ic_avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timer"
app:roundPercent="0.3" />
<TextView
android:id="@+id/tv_message_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/chat_send_btn_bac_mine"
android:gravity="center_vertical"
android:maxWidth="250dp"
android:minHeight="35dp"
android:paddingHorizontal="8dp"
android:paddingVertical="3dp"
android:text="你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好"
android:textColor="@color/white"
android:textColorHighlight="#CCCCCC"
android:textIsSelectable="true"
android:textSize="17sp"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<TextView
android:id="@+id/tv_timer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingTop="20dp"
android:text="昨天"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginVertical="20dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timer"
app:roundPercent="0.3" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/image"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_marginEnd="10dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toStartOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar"
app:roundPercent="0.2" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -21,19 +21,33 @@
android:layout_height="35dp"
android:layout_marginVertical="20dp"
android:layout_marginStart="10dp"
app:layout_constraintStart_toStartOf="parent"
android:src="@drawable/ic_avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timer"
app:roundPercent="0.3" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="糕小菜菜"
android:textColor="@color/black"
android:textSize="11sp"
android:visibility="gone"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/image"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginTop="3dp"
android:scaleType="centerCrop"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar"
app:layout_constraintTop_toBottomOf="@id/tv_nickname"
app:layout_goneMarginTop="0dp"
app:roundPercent="0.15" />
<androidx.constraintlayout.utils.widget.ImageFilterView
@ -42,8 +56,8 @@
android:layout_height="35dp"
android:layout_marginVertical="20dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/ic_avatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timer"
app:roundPercent="0.3" />

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<TextView
android:id="@+id/tv_timer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingTop="20dp"
android:text="昨天"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginVertical="20dp"
android:layout_marginStart="10dp"
android:src="@drawable/ic_avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_timer"
app:roundPercent="0.3" />
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/image"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:scaleType="centerCrop"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar"
app:roundPercent="0.2" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这是一个小tip"
android:textColor="@color/black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这是一个小tip"
android:textColor="@color/black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这是一个小tip"
android:textColor="@color/black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这是一个小tip"
android:textColor="@color/black"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_avatar"
app:layout_constraintTop_toTopOf="parent"
app:roundPercent="0.3" />
<ImageView
android:id="@+id/iv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:maxWidth="200dp"
android:maxHeight="200dp"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:id="@+id/ifv_avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_avatar"
app:layout_constraintTop_toTopOf="parent"
app:roundPercent="0.3" />
<ImageView
android:id="@+id/iv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:maxWidth="200dp"
android:maxHeight="200dp"
app:layout_constraintStart_toEndOf="@id/ifv_avatar"
app:layout_constraintTop_toTopOf="@id/ifv_avatar" />
</androidx.constraintlayout.widget.ConstraintLayout>