聊天界面微调
这个提交包含在:
父节点
32467c7fff
当前提交
967cc87508
@ -8,6 +8,7 @@ import android.widget.ImageView
|
|||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import com.gyf.immersionbar.BarHide
|
import com.gyf.immersionbar.BarHide
|
||||||
import com.gyf.immersionbar.ImmersionBar
|
import com.gyf.immersionbar.ImmersionBar
|
||||||
import com.luck.picture.lib.basic.PictureSelector
|
import com.luck.picture.lib.basic.PictureSelector
|
||||||
@ -203,20 +204,21 @@ class ChatActivity : BaseActivity<ActivityChatBinding>() {
|
|||||||
|
|
||||||
window.decorView.viewTreeObserver.addOnGlobalLayoutListener {
|
window.decorView.viewTreeObserver.addOnGlobalLayoutListener {
|
||||||
val r = Rect()
|
val r = Rect()
|
||||||
window.decorView.getWindowVisibleDisplayFrame(r);
|
window.decorView.getWindowVisibleDisplayFrame(r)
|
||||||
val screenHeight = window.decorView.rootView.height;
|
val screenHeight = window.decorView.rootView.height
|
||||||
val keypadHeight = screenHeight - r.bottom;
|
val keypadHeight = screenHeight - r.bottom
|
||||||
|
|
||||||
if (keypadHeight > screenHeight * 0.15) {
|
if (keypadHeight > screenHeight * 0.15) {
|
||||||
// 输入法弹出
|
// 输入法弹出
|
||||||
val params = binding.bto.layoutParams as LinearLayout.LayoutParams
|
val params = binding.view.layoutParams as ConstraintLayout.LayoutParams
|
||||||
params.height = keypadHeight;
|
params.height = keypadHeight
|
||||||
binding.bto.layoutParams = params
|
binding.view.layoutParams = params
|
||||||
|
binding.baseRecyclerView.scrollToPosition(listMsg.size - 1)
|
||||||
} else {
|
} else {
|
||||||
// 输入法隐藏
|
// 输入法隐藏
|
||||||
val params = binding.bto.layoutParams as LinearLayout.LayoutParams
|
val params = binding.view.layoutParams as ConstraintLayout.LayoutParams
|
||||||
params.height = 0;
|
params.height = 1
|
||||||
binding.bto.layoutParams = params
|
binding.view.layoutParams = params
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@ -72,9 +72,9 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/empty"
|
android:id="@+id/empty"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:visibility="visible"
|
||||||
android:visibility="gone">
|
app:layout_constraintTop_toBottomOf="@+id/top">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/head"
|
android:id="@+id/head"
|
||||||
@ -150,10 +150,12 @@
|
|||||||
android:layout_width="345dp"
|
android:layout_width="345dp"
|
||||||
android:layout_height="145dp"
|
android:layout_height="145dp"
|
||||||
android:layout_marginTop="-14dp"
|
android:layout_marginTop="-14dp"
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:background="@drawable/bg_tag_match"
|
android:background="@drawable/bg_tag_match"
|
||||||
android:padding="15dp"
|
android:padding="15dp"
|
||||||
android:visibility="visible">
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/top">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/avatar3"
|
android:id="@+id/avatar3"
|
||||||
@ -240,27 +242,22 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/line" />
|
app:layout_constraintTop_toBottomOf="@+id/line" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<View
|
||||||
android:id="@+id/baseRefreshLayout"
|
android:id="@+id/view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="1dp"
|
||||||
android:paddingTop="3dp"
|
android:visibility="visible"
|
||||||
android:layout_weight="1"
|
android:background="@color/white"
|
||||||
android:visibility="visible">
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
<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
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="80dp"
|
android:minHeight="80dp"
|
||||||
android:paddingVertical="16dp">
|
android:background="@color/white"
|
||||||
|
android:paddingVertical="16dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/view">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/send_pic"
|
android:id="@+id/send_pic"
|
||||||
@ -304,7 +301,6 @@
|
|||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:maxLines="3"
|
android:maxLines="3"
|
||||||
android:layout_weight="1"
|
|
||||||
android:minHeight="30dp"
|
android:minHeight="30dp"
|
||||||
android:textColor="#ff222222"
|
android:textColor="#ff222222"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
@ -321,11 +317,24 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<View
|
|
||||||
android:id="@+id/bto"
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/baseRefreshLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"/>
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="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">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
||||||
正在加载...
在新工单中引用
屏蔽一个用户