mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
removed some comments, modified indentation, moved some strings to companion object
Signed-off-by: Giacomo Pacini <giacomopacini98@gmail.com>
This commit is contained in:
parent
ca5a379883
commit
064c3809b0
@ -420,11 +420,6 @@ class ChatActivity :
|
||||
val typingParticipants = HashMap<String, TypingParticipant>()
|
||||
|
||||
var callStarted = false
|
||||
|
||||
private val CURRENT_AUDIO_MESSAGE_KEY = "CURRENT_AUDIO_MESSAGE"
|
||||
private val CURRENT_AUDIO_POSITION_KEY = "CURRENT_AUDIO_POSITION"
|
||||
private val CURRENT_AUDIO_WAS_PLAYING_KEY = "CURRENT_AUDIO_PLAYING"
|
||||
private var RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
|
||||
private var voiceMessageToRestoreId = ""
|
||||
private var voiceMessageToRestoreAudioPosition = 0
|
||||
private var voiceMessageToRestoreWasPlaying = false
|
||||
@ -518,7 +513,6 @@ class ChatActivity :
|
||||
voiceMessageToRestoreAudioPosition = 0
|
||||
voiceMessageToRestoreWasPlaying = false
|
||||
}
|
||||
|
||||
} else {
|
||||
voiceMessageToRestoreId = ""
|
||||
voiceMessageToRestoreAudioPosition = 0
|
||||
@ -587,15 +581,14 @@ class ChatActivity :
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
if (currentlyPlayedVoiceMessage != null) {
|
||||
// stores audio message ID and audio position
|
||||
// so that can be restored in resumeAudioPlaybackIfNeeded method
|
||||
outState.putString(CURRENT_AUDIO_MESSAGE_KEY, currentlyPlayedVoiceMessage!!.getId())
|
||||
outState.putInt(CURRENT_AUDIO_POSITION_KEY, currentlyPlayedVoiceMessage!!.voiceMessagePlayedSeconds)
|
||||
outState.putBoolean(CURRENT_AUDIO_WAS_PLAYING_KEY, currentlyPlayedVoiceMessage!!.isPlayingVoiceMessage)
|
||||
Log.d(RESUME_AUDIO_TAG, "Stored current audio message ID: " + currentlyPlayedVoiceMessage!!.getId())
|
||||
Log.d(RESUME_AUDIO_TAG, "Audio Position: " + currentlyPlayedVoiceMessage!!.voiceMessagePlayedSeconds
|
||||
.toString() + " | isPLaying: " + currentlyPlayedVoiceMessage!!.isPlayingVoiceMessage)
|
||||
// stores also audio currently playing status
|
||||
Log.d(
|
||||
RESUME_AUDIO_TAG, "Audio Position: " + currentlyPlayedVoiceMessage!!.voiceMessagePlayedSeconds
|
||||
.toString() + " | isPLaying: " + currentlyPlayedVoiceMessage!!.isPlayingVoiceMessage
|
||||
)
|
||||
}
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
@ -610,10 +603,6 @@ class ChatActivity :
|
||||
if (mediaRecorderState == MediaRecorderState.RECORDING) {
|
||||
stopAudioRecording()
|
||||
}
|
||||
//if (currentlyPlayedVoiceMessage != null) {
|
||||
// stopMediaPlayer(currentlyPlayedVoiceMessage!!)
|
||||
//} this is done also in onDestroy,
|
||||
// it is better to continue audio playback when the activity is not visible but still open
|
||||
val text = binding.messageInputView.messageInput.text.toString()
|
||||
val cursor = binding.messageInputView.messageInput.selectionStart
|
||||
val previous = context.getSharedPreferences(localClassName, MODE_PRIVATE).getString(roomToken, "null")
|
||||
@ -3811,7 +3800,6 @@ class ChatActivity :
|
||||
scrollToRequestedMessageIfNeeded()
|
||||
//FENOM: add here audio resume policy
|
||||
resumeAudioPlaybackIfNeeded()
|
||||
|
||||
}
|
||||
|
||||
private fun scrollToFirstUnreadMessage() {
|
||||
@ -3948,7 +3936,10 @@ class ChatActivity :
|
||||
Log.d(RESUME_AUDIO_TAG, "currentItem retrieved was not chatmessage or its id was not correct")
|
||||
}
|
||||
} else {
|
||||
Log.d(RESUME_AUDIO_TAG, "voiceMessagePosition is -1, adapter # of items: " + adapter!!.getItemCount())
|
||||
Log.d(
|
||||
RESUME_AUDIO_TAG,
|
||||
"voiceMessagePosition is -1, adapter # of items: " + adapter!!.getItemCount()
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Log.d(RESUME_AUDIO_TAG, "TalkMessagesListAdapater is null")
|
||||
@ -3959,7 +3950,6 @@ class ChatActivity :
|
||||
voiceMessageToRestoreId = ""
|
||||
voiceMessageToRestoreAudioPosition = 0
|
||||
voiceMessageToRestoreWasPlaying = false
|
||||
|
||||
}
|
||||
|
||||
private fun scrollToRequestedMessageIfNeeded() {
|
||||
@ -4975,5 +4965,9 @@ class ChatActivity :
|
||||
private const val MILISEC_15: Long = 15
|
||||
private const val LINEBREAK = "\n"
|
||||
private const val CURSOR_KEY = "_cursor"
|
||||
private const val CURRENT_AUDIO_MESSAGE_KEY = "CURRENT_AUDIO_MESSAGE"
|
||||
private const val CURRENT_AUDIO_POSITION_KEY = "CURRENT_AUDIO_POSITION"
|
||||
private const val CURRENT_AUDIO_WAS_PLAYING_KEY = "CURRENT_AUDIO_PLAYING"
|
||||
private const val RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user