mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 13:05:31 +03:00
save cursor position
Signed-off-by: Julius Linus <julius.linus@nextcloud.com>
This commit is contained in:
parent
e559d159e3
commit
30c6ad5ab6
1 changed files with 5 additions and 0 deletions
|
@ -525,7 +525,9 @@ class ChatActivity :
|
|||
active = true
|
||||
context.getSharedPreferences(localClassName, MODE_PRIVATE).apply {
|
||||
val text = getString(roomToken, "")
|
||||
val cursor = getInt(roomToken + CURSOR_KEY, 0)
|
||||
binding.messageInputView.messageInput.setText(text)
|
||||
binding.messageInputView.messageInput.setSelection(cursor)
|
||||
}
|
||||
this.lifecycle.addObserver(AudioUtils)
|
||||
}
|
||||
|
@ -544,10 +546,12 @@ class ChatActivity :
|
|||
stopMediaPlayer(currentlyPlayedVoiceMessage!!)
|
||||
}
|
||||
val text = binding.messageInputView.messageInput.text.toString()
|
||||
val cursor = binding.messageInputView.messageInput.selectionStart
|
||||
val previous = context.getSharedPreferences(localClassName, MODE_PRIVATE).getString(roomToken, "null")
|
||||
if (text != previous) {
|
||||
context.getSharedPreferences(localClassName, MODE_PRIVATE).edit().apply {
|
||||
putString(roomToken, text)
|
||||
putInt(roomToken + CURSOR_KEY, cursor)
|
||||
apply()
|
||||
}
|
||||
}
|
||||
|
@ -4603,5 +4607,6 @@ class ChatActivity :
|
|||
private const val CALL_STARTED_ID = -2
|
||||
private const val MILISEC_15: Long = 15
|
||||
private const val LINEBREAK = "\n"
|
||||
private const val CURSOR_KEY = "_cursor"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue