From 9d755504824bcd4884fe60b77302dc41a81df50f Mon Sep 17 00:00:00 2001 From: rapterjet2004 Date: Mon, 19 Aug 2024 10:12:30 -0500 Subject: [PATCH] fixed bug where the state of message input fragment wasn't saved because of capabilities Signed-off-by: rapterjet2004 --- app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt | 6 +++++- .../java/com/nextcloud/talk/chat/MessageInputFragment.kt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index a2b4536d1..38481bbd1 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -332,6 +332,8 @@ class ChatActivity : } } + private lateinit var messageInputFragment: MessageInputFragment + val typingParticipants = HashMap() var callStarted = false @@ -398,6 +400,8 @@ class ChatActivity : setContentView(binding.root) setupSystemColors() + messageInputFragment = MessageInputFragment() + conversationUser = currentUserProvider.currentUser.blockingGet() handleIntent(intent) @@ -579,7 +583,7 @@ class ChatActivity : supportFragmentManager.commit { setReorderingAllowed(true) // optimizes out redundant replace operations - replace(R.id.fragment_container_activity_chat, MessageInputFragment()) + replace(R.id.fragment_container_activity_chat, messageInputFragment) } joinRoomWithPassword() diff --git a/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt b/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt index 3b2f6b427..0467cd2d4 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt @@ -136,9 +136,13 @@ class MessageInputFragment : Fragment() { return binding.root } + override fun onPause() { + super.onPause() + saveState() + } + override fun onDestroyView() { super.onDestroyView() - saveState() if (mentionAutocomplete != null && mentionAutocomplete!!.isPopupShowing) { mentionAutocomplete?.dismissPopup() }