|
@@ -2,6 +2,7 @@ package com.shanp.youqi.im.fragment
|
|
|
|
|
|
import android.graphics.Rect
|
|
import android.graphics.Rect
|
|
import android.text.TextUtils
|
|
import android.text.TextUtils
|
|
|
|
+import android.view.MotionEvent
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.view.inputmethod.EditorInfo
|
|
import android.view.inputmethod.EditorInfo
|
|
import android.widget.TextView.OnEditorActionListener
|
|
import android.widget.TextView.OnEditorActionListener
|
|
@@ -10,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|
import com.blankj.utilcode.util.ClickUtils
|
|
import com.blankj.utilcode.util.ClickUtils
|
|
import com.blankj.utilcode.util.KeyboardUtils
|
|
import com.blankj.utilcode.util.KeyboardUtils
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
|
|
+import com.blankj.utilcode.util.TouchUtils
|
|
import com.shanp.youqi.base.rx.EventSubscriber
|
|
import com.shanp.youqi.base.rx.EventSubscriber
|
|
import com.shanp.youqi.base.rx.RxBus
|
|
import com.shanp.youqi.base.rx.RxBus
|
|
import com.shanp.youqi.base.util.LogUtil
|
|
import com.shanp.youqi.base.util.LogUtil
|
|
@@ -68,16 +70,8 @@ class UChatConversationOnlyTextFragment : UChatFragment() {
|
|
initTitleBar(view)?.apply {
|
|
initTitleBar(view)?.apply {
|
|
setTitle(targetName)
|
|
setTitle(targetName)
|
|
backView.setOnClickListener {
|
|
backView.setOnClickListener {
|
|
- if (activity != null) {
|
|
|
|
- if (KeyboardUtils.isSoftInputVisible(activity!!)) {
|
|
|
|
- KeyboardUtils.hideSoftInput(binding.etContent)
|
|
|
|
- return@setOnClickListener
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
val dialog = parentFragment as ConversationDialog
|
|
val dialog = parentFragment as ConversationDialog
|
|
- dialog.dismiss()
|
|
|
|
-
|
|
|
|
|
|
+ dialog.back()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
val mine = AppManager.get().userMine
|
|
val mine = AppManager.get().userMine
|
|
@@ -146,7 +140,7 @@ class UChatConversationOnlyTextFragment : UChatFragment() {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
- //底部布局弹出,聊天列表上滑
|
|
|
|
|
|
+// //底部布局弹出,聊天列表上滑
|
|
// binding.rcv.addOnLayoutChangeListener { _, _, _, _, bottom, _, _, _, oldBottom ->
|
|
// binding.rcv.addOnLayoutChangeListener { _, _, _, _, bottom, _, _, _, oldBottom ->
|
|
// if (bottom < oldBottom) {
|
|
// if (bottom < oldBottom) {
|
|
// binding.rcv.post {
|
|
// binding.rcv.post {
|
|
@@ -157,24 +151,24 @@ class UChatConversationOnlyTextFragment : UChatFragment() {
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
|
|
-// TouchUtils.setOnTouchListener(binding.rcv, object : TouchUtils.OnTouchUtilsListener() {
|
|
|
|
-// override fun onDown(view: View?, x: Int, y: Int, event: MotionEvent?): Boolean {
|
|
|
|
-// return if (KeyboardUtils.isSoftInputVisible(mContext)) {
|
|
|
|
-// KeyboardUtils.hideSoftInput(binding.etContent)
|
|
|
|
-// true
|
|
|
|
-// } else {
|
|
|
|
-// false
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// override fun onMove(view: View?, direction: Int, x: Int, y: Int, dx: Int, dy: Int, totalX: Int, totalY: Int, event: MotionEvent?): Boolean {
|
|
|
|
-// return false
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// override fun onStop(view: View?, direction: Int, x: Int, y: Int, totalX: Int, totalY: Int, vx: Int, vy: Int, event: MotionEvent?): Boolean {
|
|
|
|
-// return false
|
|
|
|
-// }
|
|
|
|
-// })
|
|
|
|
|
|
+ TouchUtils.setOnTouchListener(binding.rcv, object : TouchUtils.OnTouchUtilsListener() {
|
|
|
|
+ override fun onDown(view: View?, x: Int, y: Int, event: MotionEvent?): Boolean {
|
|
|
|
+ return if (KeyboardUtils.isSoftInputVisible(mContext)) {
|
|
|
|
+ KeyboardUtils.hideSoftInput(binding.etContent)
|
|
|
|
+ true
|
|
|
|
+ } else {
|
|
|
|
+ false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onMove(view: View?, direction: Int, x: Int, y: Int, dx: Int, dy: Int, totalX: Int, totalY: Int, event: MotionEvent?): Boolean {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onStop(view: View?, direction: Int, x: Int, y: Int, totalX: Int, totalY: Int, vx: Int, vy: Int, event: MotionEvent?): Boolean {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
private fun initRecyclerView() {
|
|
private fun initRecyclerView() {
|
|
@@ -311,7 +305,9 @@ class UChatConversationOnlyTextFragment : UChatFragment() {
|
|
|
|
|
|
fun rcvToBottom() {
|
|
fun rcvToBottom() {
|
|
if (adapter.itemCount > 0) {
|
|
if (adapter.itemCount > 0) {
|
|
-// binding.rcv.smoothScrollToPosition(adapter.data.lastIndex)
|
|
|
|
|
|
+ binding.rcv.postDelayed({
|
|
|
|
+ binding.rcv?.smoothScrollToPosition(adapter.data.lastIndex)
|
|
|
|
+ }, 100)
|
|
// binding.rcv.scrollToPosition(adapter.data.lastIndex)
|
|
// binding.rcv.scrollToPosition(adapter.data.lastIndex)
|
|
}
|
|
}
|
|
}
|
|
}
|