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 580d1b1242..013da8f141 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -480,6 +480,10 @@ class ChatActivity : override fun onStart() { super.onStart() active = true + context.getSharedPreferences(localClassName, MODE_PRIVATE).apply { + val text = getString(roomToken, "") + binding.messageInputView.messageInput.setText(text) + } } override fun onStop() { @@ -495,6 +499,14 @@ class ChatActivity : if (currentlyPlayedVoiceMessage != null) { stopMediaPlayer(currentlyPlayedVoiceMessage!!) } + val text = binding.messageInputView.messageInput.text.toString() + val previous = context.getSharedPreferences(localClassName, MODE_PRIVATE).getString(roomToken, "null") + if (text != previous) { + context.getSharedPreferences(localClassName, MODE_PRIVATE).edit().apply { + putString(roomToken, text) + apply() + } + } } @Suppress("LongMethod") diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1018561035..93324c68ff 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -698,5 +698,6 @@ How to translate with transifex: 1080 This is a test message Lock recording for continuously recording of the voice message + Saved draft message.