From 570f32e98028b3d3b9fb9ac83bd291245217b3ab Mon Sep 17 00:00:00 2001 From: Kelvin <kelvin@futo.org> Date: Fri, 3 Nov 2023 15:39:27 +0100 Subject: [PATCH] PlatformUrl support --- .../media/platforms/js/SourcePluginConfig.kt | 1 + .../views/sources/SourceHeaderView.kt | 17 +++++++++++++ .../main/res/layout/view_source_header.xml | 24 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + app/src/stable/assets/sources/kick | 2 +- app/src/stable/assets/sources/nebula | 2 +- app/src/stable/assets/sources/odysee | 2 +- app/src/stable/assets/sources/patreon | 2 +- app/src/stable/assets/sources/rumble | 2 +- app/src/stable/assets/sources/soundcloud | 2 +- app/src/stable/assets/sources/twitch | 2 +- app/src/stable/assets/sources/youtube | 2 +- app/src/unstable/assets/sources/kick | 2 +- app/src/unstable/assets/sources/nebula | 2 +- app/src/unstable/assets/sources/odysee | 2 +- app/src/unstable/assets/sources/patreon | 2 +- app/src/unstable/assets/sources/rumble | 2 +- app/src/unstable/assets/sources/soundcloud | 2 +- app/src/unstable/assets/sources/twitch | 2 +- app/src/unstable/assets/sources/youtube | 2 +- 20 files changed, 59 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt index f7331f1d..bb8393d1 100644 --- a/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt +++ b/app/src/main/java/com/futo/platformplayer/api/media/platforms/js/SourcePluginConfig.kt @@ -41,6 +41,7 @@ class SourcePluginConfig( val constants: HashMap<String, String> = hashMapOf(), //TODO: These should be vals...but prob for serialization reasons cannot be changed. + var platformUrl: String? = null, var subscriptionRateLimit: Int? = null, var enableInSearch: Boolean = true, var enableInHome: Boolean = true, diff --git a/app/src/main/java/com/futo/platformplayer/views/sources/SourceHeaderView.kt b/app/src/main/java/com/futo/platformplayer/views/sources/SourceHeaderView.kt index fd8679e3..7d961d77 100644 --- a/app/src/main/java/com/futo/platformplayer/views/sources/SourceHeaderView.kt +++ b/app/src/main/java/com/futo/platformplayer/views/sources/SourceHeaderView.kt @@ -21,10 +21,13 @@ class SourceHeaderView : LinearLayout { private val _sourceDescription: TextView; private val _sourceVersion: TextView; + private val _sourcePlatformUrl: TextView; private val _sourceRepositoryUrl: TextView; private val _sourceScriptUrl: TextView; private val _sourceSignature: TextView; + private val _sourcePlatformUrlContainer: LinearLayout; + private var _config : SourcePluginConfig? = null; constructor(context: Context, attrs: AttributeSet? = null) : super(context, attrs) { @@ -38,6 +41,8 @@ class SourceHeaderView : LinearLayout { _sourceVersion = findViewById(R.id.source_version); _sourceRepositoryUrl = findViewById(R.id.source_repo); + _sourcePlatformUrl = findViewById(R.id.source_platform); + _sourcePlatformUrlContainer = findViewById(R.id.source_platform_container); _sourceScriptUrl = findViewById(R.id.source_script); _sourceSignature = findViewById(R.id.source_signature); @@ -53,6 +58,10 @@ class SourceHeaderView : LinearLayout { if(!_config?.absoluteScriptUrl.isNullOrEmpty()) context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(_config?.absoluteScriptUrl))); }; + _sourcePlatformUrl.setOnClickListener { + if(!_config?.platformUrl.isNullOrEmpty()) + context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(_config?.platformUrl))); + }; } fun loadConfig(config: SourcePluginConfig, script: String?) { @@ -74,6 +83,12 @@ class SourceHeaderView : LinearLayout { _sourceRepositoryUrl.text = config.repositoryUrl; _sourceAuthorID.text = ""; + _sourcePlatformUrl.text = config.platformUrl ?: ""; + if(!config.platformUrl.isNullOrEmpty()) + _sourcePlatformUrlContainer.visibility = VISIBLE; + else + _sourcePlatformUrlContainer.visibility = GONE; + if(!config.authorUrl.isNullOrEmpty()) _sourceBy.setTextColor(resources.getColor(R.color.colorPrimary)); else @@ -105,5 +120,7 @@ class SourceHeaderView : LinearLayout { _sourceScriptUrl.text = ""; _sourceRepositoryUrl.text = ""; _sourceAuthorID.text = ""; + _sourcePlatformUrl.text = ""; + _sourcePlatformUrlContainer.visibility = GONE; } } \ No newline at end of file diff --git a/app/src/main/res/layout/view_source_header.xml b/app/src/main/res/layout/view_source_header.xml index 97026ecb..2042fa48 100644 --- a/app/src/main/res/layout/view_source_header.xml +++ b/app/src/main/res/layout/view_source_header.xml @@ -100,6 +100,30 @@ tools:text="3" /> </LinearLayout> + <!--Platform Url--> + <LinearLayout + android:id="@+id/source_platform_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textSize="14dp" + android:textColor="@color/white" + android:layout_marginTop="10dp" + android:fontFamily="@font/inter_light" + android:text="@string/platform_url" /> + <TextView + android:id="@+id/source_platform" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textSize="14dp" + android:textColor="@color/colorPrimary" + android:fontFamily="@font/inter_extra_light" + tools:text="https://some.platform.url" /> + </LinearLayout> + <!--Repo Url--> <LinearLayout android:layout_width="match_parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2ea180bd..f5a4c437 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -98,6 +98,7 @@ <string name="are_you_sure_delete_historical">Are you sure you want to remove these historical entries?</string> <string name="removed">removed</string> <string name="add_source">Add Source</string> + <string name="platform_url">Platform URL</string> <string name="repository_url">Repository URL</string> <string name="script_url">Script URL</string> <string name="source_permissions_explanation">These are the permissions the plugin requires to function</string> diff --git a/app/src/stable/assets/sources/kick b/app/src/stable/assets/sources/kick index 82aa06b9..63790c2d 160000 --- a/app/src/stable/assets/sources/kick +++ b/app/src/stable/assets/sources/kick @@ -1 +1 @@ -Subproject commit 82aa06b98ee830aa30ec3fcb1e3f31966e9b7501 +Subproject commit 63790c2dc8d0df70e3e0f77191f90b109ba2fd16 diff --git a/app/src/stable/assets/sources/nebula b/app/src/stable/assets/sources/nebula index 8ea93936..dcc004d7 160000 --- a/app/src/stable/assets/sources/nebula +++ b/app/src/stable/assets/sources/nebula @@ -1 +1 @@ -Subproject commit 8ea9393634b13b478916e4dade664427d8f9a0fe +Subproject commit dcc004d722a11ef7d1613281ed30eb534277ab94 diff --git a/app/src/stable/assets/sources/odysee b/app/src/stable/assets/sources/odysee index cbde0c9e..948835fa 160000 --- a/app/src/stable/assets/sources/odysee +++ b/app/src/stable/assets/sources/odysee @@ -1 +1 @@ -Subproject commit cbde0c9e9c648ad2c61a754689d071975e521331 +Subproject commit 948835fa682b6e536bf05f66b426144ef5b47e69 diff --git a/app/src/stable/assets/sources/patreon b/app/src/stable/assets/sources/patreon index 60376918..ecf4988b 160000 --- a/app/src/stable/assets/sources/patreon +++ b/app/src/stable/assets/sources/patreon @@ -1 +1 @@ -Subproject commit 6037691859c0cc6f58651f716ebd984bc21c1012 +Subproject commit ecf4988b3f64742bc45ba862f25738458a619c34 diff --git a/app/src/stable/assets/sources/rumble b/app/src/stable/assets/sources/rumble index 4b5d9f12..1b70c84e 160000 --- a/app/src/stable/assets/sources/rumble +++ b/app/src/stable/assets/sources/rumble @@ -1 +1 @@ -Subproject commit 4b5d9f12a73b3502328c84b6931aa82e424438c0 +Subproject commit 1b70c84e30a5fd025da166a62c0f9249f3dd1c19 diff --git a/app/src/stable/assets/sources/soundcloud b/app/src/stable/assets/sources/soundcloud index eff82852..af990930 160000 --- a/app/src/stable/assets/sources/soundcloud +++ b/app/src/stable/assets/sources/soundcloud @@ -1 +1 @@ -Subproject commit eff8285222ce321ae21e140072fe268440d4684d +Subproject commit af9909302731153717bee5d80eb16f4ad035a2f0 diff --git a/app/src/stable/assets/sources/twitch b/app/src/stable/assets/sources/twitch index eb198a3d..1d3c8b79 160000 --- a/app/src/stable/assets/sources/twitch +++ b/app/src/stable/assets/sources/twitch @@ -1 +1 @@ -Subproject commit eb198a3d2095f0df28508e8481eebdccdd2a222a +Subproject commit 1d3c8b79558c9ed11e18a1eeadc9d392fc8d8f0d diff --git a/app/src/stable/assets/sources/youtube b/app/src/stable/assets/sources/youtube index ce7d9d0b..ae803c92 160000 --- a/app/src/stable/assets/sources/youtube +++ b/app/src/stable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit ce7d9d0bc7cd18c4f50338e30a82ca132e24f70d +Subproject commit ae803c9295cf3d53aa49ddc2799d0f86aecc06a6 diff --git a/app/src/unstable/assets/sources/kick b/app/src/unstable/assets/sources/kick index 82aa06b9..63790c2d 160000 --- a/app/src/unstable/assets/sources/kick +++ b/app/src/unstable/assets/sources/kick @@ -1 +1 @@ -Subproject commit 82aa06b98ee830aa30ec3fcb1e3f31966e9b7501 +Subproject commit 63790c2dc8d0df70e3e0f77191f90b109ba2fd16 diff --git a/app/src/unstable/assets/sources/nebula b/app/src/unstable/assets/sources/nebula index 8ea93936..dcc004d7 160000 --- a/app/src/unstable/assets/sources/nebula +++ b/app/src/unstable/assets/sources/nebula @@ -1 +1 @@ -Subproject commit 8ea9393634b13b478916e4dade664427d8f9a0fe +Subproject commit dcc004d722a11ef7d1613281ed30eb534277ab94 diff --git a/app/src/unstable/assets/sources/odysee b/app/src/unstable/assets/sources/odysee index cbde0c9e..948835fa 160000 --- a/app/src/unstable/assets/sources/odysee +++ b/app/src/unstable/assets/sources/odysee @@ -1 +1 @@ -Subproject commit cbde0c9e9c648ad2c61a754689d071975e521331 +Subproject commit 948835fa682b6e536bf05f66b426144ef5b47e69 diff --git a/app/src/unstable/assets/sources/patreon b/app/src/unstable/assets/sources/patreon index 60376918..ecf4988b 160000 --- a/app/src/unstable/assets/sources/patreon +++ b/app/src/unstable/assets/sources/patreon @@ -1 +1 @@ -Subproject commit 6037691859c0cc6f58651f716ebd984bc21c1012 +Subproject commit ecf4988b3f64742bc45ba862f25738458a619c34 diff --git a/app/src/unstable/assets/sources/rumble b/app/src/unstable/assets/sources/rumble index 4b5d9f12..1b70c84e 160000 --- a/app/src/unstable/assets/sources/rumble +++ b/app/src/unstable/assets/sources/rumble @@ -1 +1 @@ -Subproject commit 4b5d9f12a73b3502328c84b6931aa82e424438c0 +Subproject commit 1b70c84e30a5fd025da166a62c0f9249f3dd1c19 diff --git a/app/src/unstable/assets/sources/soundcloud b/app/src/unstable/assets/sources/soundcloud index eff82852..af990930 160000 --- a/app/src/unstable/assets/sources/soundcloud +++ b/app/src/unstable/assets/sources/soundcloud @@ -1 +1 @@ -Subproject commit eff8285222ce321ae21e140072fe268440d4684d +Subproject commit af9909302731153717bee5d80eb16f4ad035a2f0 diff --git a/app/src/unstable/assets/sources/twitch b/app/src/unstable/assets/sources/twitch index eb198a3d..1d3c8b79 160000 --- a/app/src/unstable/assets/sources/twitch +++ b/app/src/unstable/assets/sources/twitch @@ -1 +1 @@ -Subproject commit eb198a3d2095f0df28508e8481eebdccdd2a222a +Subproject commit 1d3c8b79558c9ed11e18a1eeadc9d392fc8d8f0d diff --git a/app/src/unstable/assets/sources/youtube b/app/src/unstable/assets/sources/youtube index ce7d9d0b..ae803c92 160000 --- a/app/src/unstable/assets/sources/youtube +++ b/app/src/unstable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit ce7d9d0bc7cd18c4f50338e30a82ca132e24f70d +Subproject commit ae803c9295cf3d53aa49ddc2799d0f86aecc06a6 -- GitLab