From 309c2b828c2028e4fb557055b26d5f8a8e3440cb Mon Sep 17 00:00:00 2001
From: Blatzar <46196380+Blatzar@users.noreply.github.com>
Date: Tue, 16 Aug 2022 00:24:27 +0200
Subject: [PATCH] TV navigation improvements
---
.../ui/settings/extensions/ExtensionsFragment.kt | 11 +++++++++++
app/src/main/res/layout/fragment_extensions.xml | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt
index fe0ef952..226997af 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/ExtensionsFragment.kt
@@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.ui.settings.extensions
+import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.DialogInterface
@@ -22,6 +23,7 @@ import com.lagradost.cloudstream3.mvvm.Some
import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.plugins.RepositoryManager
import com.lagradost.cloudstream3.ui.result.setText
+import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
import com.lagradost.cloudstream3.utils.Coroutines.main
@@ -118,6 +120,15 @@ class ExtensionsFragment : Fragment() {
list_repositories?.setOnClickListener {
openBrowser(PUBLIC_REPOSITORIES_LIST)
+
+ // Set clipboard on TV because the browser might not exist or work properly
+ if (it.context.isTvSettings()) {
+ val serviceClipboard =
+ (activity?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?)
+ ?: return@setOnClickListener
+ val clip = ClipData.newPlainText("Repository url", PUBLIC_REPOSITORIES_LIST)
+ serviceClipboard.setPrimaryClip(clip)
+ }
}
observe(extensionViewModel.pluginStats) {
diff --git a/app/src/main/res/layout/fragment_extensions.xml b/app/src/main/res/layout/fragment_extensions.xml
index fc1e67ed..8dd029be 100644
--- a/app/src/main/res/layout/fragment_extensions.xml
+++ b/app/src/main/res/layout/fragment_extensions.xml
@@ -47,12 +47,15 @@