diff --git a/app/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt b/app/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt
index 63de875a..feda7262 100644
--- a/app/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt
+++ b/app/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt
@@ -1,9 +1,12 @@
package dev.jdtech.jellyfin.fragments
+import android.app.UiModeManager
+import android.content.res.Configuration
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.Lifecycle
@@ -21,6 +24,7 @@ import kotlinx.coroutines.launch
class ServerSelectFragment : Fragment() {
private lateinit var binding: FragmentServerSelectBinding
+ private lateinit var uiModeManager: UiModeManager
private val viewModel: ServerSelectViewModel by viewModels()
override fun onCreateView(
@@ -29,6 +33,8 @@ class ServerSelectFragment : Fragment() {
savedInstanceState: Bundle?
): View {
binding = FragmentServerSelectBinding.inflate(inflater)
+ uiModeManager =
+ requireContext().getSystemService(AppCompatActivity.UI_MODE_SERVICE) as UiModeManager
binding.lifecycleOwner = viewLifecycleOwner
@@ -72,6 +78,10 @@ class ServerSelectFragment : Fragment() {
}
private fun navigateToMainActivity() {
- findNavController().navigate(ServerSelectFragmentDirections.actionServerSelectFragmentToHomeFragment())
+ if (uiModeManager.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION) {
+ findNavController().navigate(ServerSelectFragmentDirections.actionServerSelectFragmentToHomeFragmentTv())
+ } else {
+ findNavController().navigate(ServerSelectFragmentDirections.actionServerSelectFragmentToHomeFragment())
+ }
}
}
diff --git a/app/src/main/res/layout-television/fragment_server_select.xml b/app/src/main/res/layout-television/fragment_server_select.xml
new file mode 100644
index 00000000..0968fa11
--- /dev/null
+++ b/app/src/main/res/layout-television/fragment_server_select.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-television/fragment_users.xml b/app/src/main/res/layout-television/fragment_users.xml
new file mode 100644
index 00000000..4c18042e
--- /dev/null
+++ b/app/src/main/res/layout-television/fragment_users.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-television/server_item.xml b/app/src/main/res/layout-television/server_item.xml
new file mode 100644
index 00000000..1c1e48ad
--- /dev/null
+++ b/app/src/main/res/layout-television/server_item.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_server_select.xml b/app/src/main/res/layout/fragment_server_select.xml
index 15d3f419..de0d07b2 100644
--- a/app/src/main/res/layout/fragment_server_select.xml
+++ b/app/src/main/res/layout/fragment_server_select.xml
@@ -55,11 +55,6 @@
android:layout_height="wrap_content"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/image_banner"
- app:layout_constraintVertical_bias="0.36"
app:servers="@{viewModel.servers}"
app:spanCount="@integer/server_columns"
tools:itemCount="4"