mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
WIP
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
03c5d2561e
commit
53c4329f91
@ -50,6 +50,7 @@ import androidx.activity.result.ActivityResult
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.PickVisualMediaRequest
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@ -213,9 +214,7 @@ import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.ExecutionException
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.set
|
||||
import kotlin.math.roundToInt
|
||||
import androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication::class)
|
||||
class ChatActivity :
|
||||
@ -347,8 +346,6 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var messageInputFragment: MessageInputFragment
|
||||
|
||||
val typingParticipants = HashMap<String, TypingParticipant>()
|
||||
|
||||
var callStarted = false
|
||||
@ -425,9 +422,9 @@ class ChatActivity :
|
||||
roomToken
|
||||
)
|
||||
|
||||
messageInputFragment = getMessageInputFragment()
|
||||
messageInputViewModel = ViewModelProvider(this, viewModelFactory)[MessageInputViewModel::class.java]
|
||||
messageInputViewModel.setData(chatViewModel.getChatRepository())
|
||||
val internalId = conversationUser!!.id.toString() + "@" + roomToken
|
||||
messageInputViewModel.setData(chatViewModel.getChatRepository(), internalId)
|
||||
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
|
||||
@ -444,15 +441,6 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMessageInputFragment(): MessageInputFragment {
|
||||
val internalId = conversationUser!!.id.toString() + "@" + roomToken
|
||||
return MessageInputFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(CONVERSATION_INTERNAL_ID, internalId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
val extras: Bundle? = intent.extras
|
||||
@ -588,9 +576,13 @@ class ChatActivity :
|
||||
chatApiVersion = ApiUtils.getChatApiVersion(spreedCapabilities, intArrayOf(1))
|
||||
participantPermissions = ParticipantPermissions(spreedCapabilities, currentConversation!!)
|
||||
|
||||
supportFragmentManager.commit {
|
||||
setReorderingAllowed(true) // optimizes out redundant replace operations
|
||||
replace(R.id.fragment_container_activity_chat, messageInputFragment)
|
||||
if (chatViewModel.getVoiceRecordingLocked.value != true) {
|
||||
supportFragmentManager.commit {
|
||||
setReorderingAllowed(true) // optimizes out redundant replace operations
|
||||
messageInputViewModel.messageInputFragment?.let {
|
||||
replace(R.id.fragment_container_activity_chat, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
joinRoomWithPassword()
|
||||
@ -967,7 +959,9 @@ class ChatActivity :
|
||||
} else {
|
||||
supportFragmentManager.commit {
|
||||
setReorderingAllowed(true)
|
||||
replace(R.id.fragment_container_activity_chat, getMessageInputFragment())
|
||||
messageInputViewModel.messageInputFragment?.let {
|
||||
replace(R.id.fragment_container_activity_chat, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
package com.nextcloud.talk.chat.viewmodels
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
@ -15,6 +16,8 @@ import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.nextcloud.talk.chat.ChatActivity.Companion.CONVERSATION_INTERNAL_ID
|
||||
import com.nextcloud.talk.chat.MessageInputFragment
|
||||
import com.nextcloud.talk.chat.data.ChatMessageRepository
|
||||
import com.nextcloud.talk.chat.data.io.AudioFocusRequestManager
|
||||
import com.nextcloud.talk.chat.data.io.AudioRecorderManager
|
||||
@ -45,9 +48,17 @@ class MessageInputViewModel @Inject constructor(
|
||||
lateinit var chatRepository: ChatMessageRepository
|
||||
lateinit var currentLifeCycleFlag: LifeCycleFlag
|
||||
val disposableSet = mutableSetOf<Disposable>()
|
||||
var messageInputFragment: MessageInputFragment? = null
|
||||
|
||||
fun setData(chatMessageRepository: ChatMessageRepository) {
|
||||
fun setData(chatMessageRepository: ChatMessageRepository, internalId: String) {
|
||||
chatRepository = chatMessageRepository
|
||||
if (messageInputFragment == null) {
|
||||
messageInputFragment = MessageInputFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(CONVERSATION_INTERNAL_ID, internalId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume(owner: LifecycleOwner) {
|
||||
|
Loading…
Reference in New Issue
Block a user