mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Do not disable file attachments in conversation attached to a call, added navigation to file viewer from in-call conversation
This commit is contained in:
parent
788dd338fb
commit
3a3518b2a5
2 changed files with 31 additions and 1 deletions
|
|
@ -19,10 +19,14 @@
|
|||
*/
|
||||
package org.linphone.ui.call.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.ui.fileviewer.FileViewerActivity
|
||||
import org.linphone.ui.fileviewer.MediaViewerActivity
|
||||
import org.linphone.ui.main.chat.fragment.ConversationFragment
|
||||
|
||||
class ConversationFragment : ConversationFragment() {
|
||||
|
|
@ -40,5 +44,31 @@ class ConversationFragment : ConversationFragment() {
|
|||
binding.setBackClickListener {
|
||||
findNavController().popBackStack()
|
||||
}
|
||||
|
||||
sharedViewModel.displayFileEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { bundle ->
|
||||
if (findNavController().currentDestination?.id == R.id.inCallConversationFragment) {
|
||||
val path = bundle.getString("path", "")
|
||||
val isMedia = bundle.getBoolean("isMedia", false)
|
||||
if (path.isEmpty()) {
|
||||
Log.e("$TAG Can't navigate to file viewer for empty path!")
|
||||
return@consume
|
||||
}
|
||||
|
||||
Log.i(
|
||||
"$TAG Navigating to [${if (isMedia) "media" else "file"}] viewer fragment with path [$path]"
|
||||
)
|
||||
if (isMedia) {
|
||||
val intent = Intent(requireActivity(), MediaViewerActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
startActivity(intent)
|
||||
} else {
|
||||
val intent = Intent(requireActivity(), FileViewerActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
android:padding="8dp"
|
||||
android:contentDescription="@string/content_description_chat_open_attach_file"
|
||||
android:src="@{viewModel.areFilePickersOpen ? @drawable/x : @drawable/paperclip, default=@drawable/paperclip}"
|
||||
android:visibility="@{viewModel.isVoiceRecording ? View.INVISIBLE : (viewModel.isKeyboardOpen || viewModel.isCallConversation || !viewModel.isFileTransferServerAvailable) ? View.GONE : View.VISIBLE}"
|
||||
android:visibility="@{viewModel.isVoiceRecording ? View.INVISIBLE : (viewModel.isKeyboardOpen || !viewModel.isFileTransferServerAvailable) ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintEnd_toStartOf="@id/message_area_background"
|
||||
app:layout_constraintStart_toEndOf="@id/emoji_picker_toggle"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue