这个提交包含在:
徐勤民 2024-07-29 19:52:31 +08:00
父节点 797d084cea
当前提交 32467c7fff
共有 3 个文件被更改,包括 68 次插入45 次删除

查看文件

@ -43,7 +43,7 @@
<activity
android:name=".ui.ChatActivity"
android:exported="false"
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="adjustNothing"
/>
<activity
android:name=".ui.FeedbackActivity"

查看文件

@ -1,7 +1,9 @@
package com.xuqinmin.android.app.ui
import android.graphics.Color
import android.graphics.Rect
import android.os.Bundle
import android.view.WindowManager
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
@ -72,6 +74,7 @@ class ChatActivity : BaseActivity<ActivityChatBinding>() {
bindUi(R.layout.activity_chat)
ImmersionBar.with(this).statusBarDarkFont(true)
.hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR).init()
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
}
override fun initView(savedInstanceState: Bundle?) {
@ -188,8 +191,34 @@ class ChatActivity : BaseActivity<ActivityChatBinding>() {
}
binding.tags.adapter = adapter1
binding.tags2.adapter = adapter1
binding.tags.linearLayoutManagerForHorizontal(mContext,0)
binding.tags2.linearLayoutManagerForHorizontal(mContext,0)
binding.tags.linearLayoutManagerForHorizontal(mContext, 0)
binding.tags2.linearLayoutManagerForHorizontal(mContext, 0)
// binding.text.onFocusChangeListener =
// OnFocusChangeListener { _, hasFocus ->
// if (hasFocus) {
// window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
// }
// }
window.decorView.viewTreeObserver.addOnGlobalLayoutListener {
val r = Rect()
window.decorView.getWindowVisibleDisplayFrame(r);
val screenHeight = window.decorView.rootView.height;
val keypadHeight = screenHeight - r.bottom;
if (keypadHeight > screenHeight * 0.15) {
// 输入法弹出
val params = binding.bto.layoutParams as LinearLayout.LayoutParams
params.height = keypadHeight;
binding.bto.layoutParams = params
} else {
// 输入法隐藏
val params = binding.bto.layoutParams as LinearLayout.LayoutParams
params.height = 0;
binding.bto.layoutParams = params
}
}
}
private fun changeView() {
@ -203,7 +232,7 @@ class ChatActivity : BaseActivity<ActivityChatBinding>() {
binding.empty.gone()
}
putInt(MSG_COUNT + "_" + toUser?.userId, 0)//消息全部已读
if (intent?.getBooleanExtra("isSys", false) == true){
if (intent?.getBooleanExtra("isSys", false) == true) {
binding.empty.gone()
binding.startVideo2.gone()
binding.msgStartVideo.gone()
@ -253,12 +282,12 @@ class ChatActivity : BaseActivity<ActivityChatBinding>() {
binding.country.text = CountryHelper.getCountryName(toUser?.country)
ImageHelper.load(binding.gender, GenderHelper.getImage(toUser?.gender ?: 1))
ImageHelper.load(binding.avatar,toUser?.avatar)
ImageHelper.load(binding.avatar3,toUser?.avatar)
val color = when(toUser?.online){
0 -> Color.parseColor("#FFB9BECC")
1 -> Color.parseColor("#FF26D526")
else -> Color.parseColor("#FFEA2D2D")
ImageHelper.load(binding.avatar, toUser?.avatar)
ImageHelper.load(binding.avatar3, toUser?.avatar)
val color = when (toUser?.online) {
0 -> Color.parseColor("#FFB9BECC")
1 -> Color.parseColor("#FF26D526")
else -> Color.parseColor("#FFEA2D2D")
}

查看文件

@ -2,7 +2,8 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -71,9 +72,9 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
app:layout_constraintTop_toBottomOf="@+id/top">
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone">
<ImageView
android:id="@+id/head"
@ -149,12 +150,10 @@
android:layout_width="345dp"
android:layout_height="145dp"
android:layout_marginTop="-14dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_tag_match"
android:padding="15dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/top">
android:visibility="visible">
<ImageView
android:id="@+id/avatar3"
@ -241,20 +240,27 @@
app:layout_constraintTop_toBottomOf="@+id/line" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- <View-->
<!-- android:id="@id/view"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="50dp"-->
<!-- android:visibility="gone"-->
<!-- app:layout_constraintBottom_toBottomOf="parent" />-->
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/baseRefreshLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingTop="3dp"
android:layout_weight="1"
android:visibility="visible">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/baseRecyclerView"
android:layout_width="match_parent"
android:layout_weight="2"
android:layout_height="0dp"
android:overScrollMode="never" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="80dp"
android:paddingVertical="16dp"
app:layout_constraintBottom_toBottomOf="parent">
android:paddingVertical="16dp">
<ImageView
android:id="@+id/send_pic"
@ -283,6 +289,7 @@
android:background="@drawable/bg_cfd4e0_20"
android:gravity="center_vertical|end"
android:orientation="horizontal"
android:paddingVertical="10dp"
android:paddingStart="15dp"
android:paddingEnd="6dp"
app:layout_constraintBottom_toBottomOf="parent"
@ -297,7 +304,8 @@
android:layout_marginEnd="10dp"
android:background="@null"
android:maxLines="3"
android:minHeight="52dp"
android:layout_weight="1"
android:minHeight="30dp"
android:textColor="#ff222222"
android:textSize="14sp"
android:textStyle="bold" />
@ -306,7 +314,6 @@
android:id="@+id/can_send"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginVertical="10dp"
android:src="@mipmap/can_send"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/view_send"
@ -314,24 +321,11 @@
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/baseRefreshLayout"
<View
android:id="@+id/bto"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingTop="3dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/chat_top">
android:layout_height="0dp"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/baseRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</layout>