Added full-screen support for image & video viewers
This commit is contained in:
parent
cc36a18d2c
commit
9e2b52b4d2
7 changed files with 35 additions and 1 deletions
|
@ -15,6 +15,7 @@ Group changes to describe their impact on the project, as follows:
|
||||||
### Added
|
### Added
|
||||||
- Conference creation with scheduling, video, different layouts, showing who is speaking and who is muted, etc...
|
- Conference creation with scheduling, video, different layouts, showing who is speaking and who is muted, etc...
|
||||||
- Chat rooms can be individually muted (no notification when receiving a chat message)
|
- Chat rooms can be individually muted (no notification when receiving a chat message)
|
||||||
|
- Image & Video in-app viewers allow for full-screen display
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- In-call views have been re-designed
|
- In-call views have been re-designed
|
||||||
|
|
|
@ -246,6 +246,10 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
currentFocus?.hideKeyboard()
|
currentFocus?.hideKeyboard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hideStatusFragment(hide: Boolean) {
|
||||||
|
statusFragment.visibility = if (hide) View.GONE else View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateTabsFragmentVisibility() {
|
private fun updateTabsFragmentVisibility() {
|
||||||
tabsFragment.visibility = if (tabsFragmentVisible1 && tabsFragmentVisible2) View.VISIBLE else View.GONE
|
tabsFragment.visibility = if (tabsFragmentVisible1 && tabsFragmentVisible2) View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,10 @@ import android.view.View
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
|
import org.linphone.activities.main.MainActivity
|
||||||
import org.linphone.activities.main.files.viewmodels.ImageFileViewModel
|
import org.linphone.activities.main.files.viewmodels.ImageFileViewModel
|
||||||
import org.linphone.activities.main.files.viewmodels.ImageFileViewModelFactory
|
import org.linphone.activities.main.files.viewmodels.ImageFileViewModelFactory
|
||||||
|
import org.linphone.compatibility.Compatibility
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.databinding.FileImageViewerFragmentBinding
|
import org.linphone.databinding.FileImageViewerFragmentBinding
|
||||||
|
|
||||||
|
@ -53,5 +55,12 @@ class ImageViewerFragment : GenericViewerFragment<FileImageViewerFragmentBinding
|
||||||
ImageFileViewModelFactory(content)
|
ImageFileViewModelFactory(content)
|
||||||
)[ImageFileViewModel::class.java]
|
)[ImageFileViewModel::class.java]
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
|
viewModel.fullScreenMode.observe(
|
||||||
|
viewLifecycleOwner
|
||||||
|
) { hide ->
|
||||||
|
Compatibility.hideAndroidSystemUI(hide, requireActivity().window)
|
||||||
|
(requireActivity() as MainActivity).hideStatusFragment(hide)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,10 @@ import android.widget.MediaController
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
|
import org.linphone.activities.main.MainActivity
|
||||||
import org.linphone.activities.main.files.viewmodels.VideoFileViewModel
|
import org.linphone.activities.main.files.viewmodels.VideoFileViewModel
|
||||||
import org.linphone.activities.main.files.viewmodels.VideoFileViewModelFactory
|
import org.linphone.activities.main.files.viewmodels.VideoFileViewModelFactory
|
||||||
|
import org.linphone.compatibility.Compatibility
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.databinding.FileVideoViewerFragmentBinding
|
import org.linphone.databinding.FileVideoViewerFragmentBinding
|
||||||
|
|
||||||
|
@ -67,6 +69,13 @@ class VideoViewerFragment : GenericViewerFragment<FileVideoViewerFragmentBinding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initMediaController()
|
initMediaController()
|
||||||
|
|
||||||
|
viewModel.fullScreenMode.observe(
|
||||||
|
viewLifecycleOwner
|
||||||
|
) { hide ->
|
||||||
|
Compatibility.hideAndroidSystemUI(hide, requireActivity().window)
|
||||||
|
(requireActivity() as MainActivity).hideStatusFragment(hide)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
package org.linphone.activities.main.files.viewmodels
|
package org.linphone.activities.main.files.viewmodels
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import org.linphone.core.Content
|
import org.linphone.core.Content
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
@ -28,6 +29,8 @@ open class FileViewerViewModel(val content: Content) : ViewModel() {
|
||||||
val filePath: String
|
val filePath: String
|
||||||
private val deleteAfterUse: Boolean = content.isFileEncrypted
|
private val deleteAfterUse: Boolean = content.isFileEncrypted
|
||||||
|
|
||||||
|
val fullScreenMode = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
filePath = if (deleteAfterUse) {
|
filePath = if (deleteAfterUse) {
|
||||||
Log.i("[File Viewer] Content is encrypted, requesting plain file path")
|
Log.i("[File Viewer] Content is encrypted, requesting plain file path")
|
||||||
|
@ -45,4 +48,8 @@ open class FileViewerViewModel(val content: Content) : ViewModel() {
|
||||||
|
|
||||||
super.onCleared()
|
super.onCleared()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun toggleFullScreen() {
|
||||||
|
fullScreenMode.value = fullScreenMode.value != true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
|
android:visibility="@{viewModel.fullScreenMode ? View.GONE : View.VISIBLE}"
|
||||||
tools:layout="@layout/file_viewer_top_bar_fragment" />
|
tools:layout="@layout/file_viewer_top_bar_fragment" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
|
android:onClick="@{() -> viewModel.toggleFullScreen()}"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
coil="@{viewModel.filePath}"/>
|
coil="@{viewModel.filePath}"/>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
|
android:visibility="@{viewModel.fullScreenMode ? View.GONE : View.VISIBLE}"
|
||||||
tools:layout="@layout/file_viewer_top_bar_fragment" />
|
tools:layout="@layout/file_viewer_top_bar_fragment" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
@ -31,7 +32,8 @@
|
||||||
android:id="@+id/video_view"
|
android:id="@+id/video_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_centerInParent="true"/>
|
android:layout_centerInParent="true"
|
||||||
|
android:onClick="@{() -> viewModel.toggleFullScreen()}"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue