fix: snackbar not showing in landscape mode (#476)

* Fix snackbar not showing in landscape

This affected also all tablets since they use the landscape view!

Added `setTextMaxLines` because for some reason the text is truncated on tablets.

Fixes #473.

Co-Authored-By: Jcuhfehl <91626737+Jcuhfehl@users.noreply.github.com>

* Remove unused import

---------

Co-authored-by: Jcuhfehl <91626737+Jcuhfehl@users.noreply.github.com>
This commit is contained in:
Natanel Shitrit 2023-09-02 12:53:56 +03:00 committed by GitHub
parent 048ec27b1c
commit 58be66f541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,6 @@ import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar
import dagger.hilt.android.AndroidEntryPoint
import dev.jdtech.jellyfin.AppPreferences
import dev.jdtech.jellyfin.R
import dev.jdtech.jellyfin.adapters.FavoritesListAdapter
import dev.jdtech.jellyfin.adapters.HomeEpisodeListAdapter
import dev.jdtech.jellyfin.adapters.ViewItemListAdapter
@ -58,7 +57,7 @@ class DownloadsFragment : Fragment() {
launch {
viewModel.connectionError.collect {
Snackbar.make(binding.root, CoreR.string.no_server_connection, Snackbar.LENGTH_INDEFINITE)
.setAnchorView(requireActivity().findViewById(R.id.nav_view))
.setTextMaxLines(2)
.setAction(CoreR.string.offline_mode) {
appPreferences.offlineMode = true
activity?.restart()