PlatformUrl support

This commit is contained in:
Kelvin 2023-11-03 15:39:27 +01:00
parent 16a0351125
commit 570f32e980
20 changed files with 59 additions and 16 deletions

View file

@ -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,

View file

@ -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;
}
}

View file

@ -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"

View file

@ -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>

@ -1 +1 @@
Subproject commit 82aa06b98ee830aa30ec3fcb1e3f31966e9b7501
Subproject commit 63790c2dc8d0df70e3e0f77191f90b109ba2fd16

@ -1 +1 @@
Subproject commit 8ea9393634b13b478916e4dade664427d8f9a0fe
Subproject commit dcc004d722a11ef7d1613281ed30eb534277ab94

@ -1 +1 @@
Subproject commit cbde0c9e9c648ad2c61a754689d071975e521331
Subproject commit 948835fa682b6e536bf05f66b426144ef5b47e69

@ -1 +1 @@
Subproject commit 6037691859c0cc6f58651f716ebd984bc21c1012
Subproject commit ecf4988b3f64742bc45ba862f25738458a619c34

@ -1 +1 @@
Subproject commit 4b5d9f12a73b3502328c84b6931aa82e424438c0
Subproject commit 1b70c84e30a5fd025da166a62c0f9249f3dd1c19

@ -1 +1 @@
Subproject commit eff8285222ce321ae21e140072fe268440d4684d
Subproject commit af9909302731153717bee5d80eb16f4ad035a2f0

@ -1 +1 @@
Subproject commit eb198a3d2095f0df28508e8481eebdccdd2a222a
Subproject commit 1d3c8b79558c9ed11e18a1eeadc9d392fc8d8f0d

@ -1 +1 @@
Subproject commit ce7d9d0bc7cd18c4f50338e30a82ca132e24f70d
Subproject commit ae803c9295cf3d53aa49ddc2799d0f86aecc06a6

@ -1 +1 @@
Subproject commit 82aa06b98ee830aa30ec3fcb1e3f31966e9b7501
Subproject commit 63790c2dc8d0df70e3e0f77191f90b109ba2fd16

@ -1 +1 @@
Subproject commit 8ea9393634b13b478916e4dade664427d8f9a0fe
Subproject commit dcc004d722a11ef7d1613281ed30eb534277ab94

@ -1 +1 @@
Subproject commit cbde0c9e9c648ad2c61a754689d071975e521331
Subproject commit 948835fa682b6e536bf05f66b426144ef5b47e69

@ -1 +1 @@
Subproject commit 6037691859c0cc6f58651f716ebd984bc21c1012
Subproject commit ecf4988b3f64742bc45ba862f25738458a619c34

@ -1 +1 @@
Subproject commit 4b5d9f12a73b3502328c84b6931aa82e424438c0
Subproject commit 1b70c84e30a5fd025da166a62c0f9249f3dd1c19

@ -1 +1 @@
Subproject commit eff8285222ce321ae21e140072fe268440d4684d
Subproject commit af9909302731153717bee5d80eb16f4ad035a2f0

@ -1 +1 @@
Subproject commit eb198a3d2095f0df28508e8481eebdccdd2a222a
Subproject commit 1d3c8b79558c9ed11e18a1eeadc9d392fc8d8f0d

@ -1 +1 @@
Subproject commit ce7d9d0bc7cd18c4f50338e30a82ca132e24f70d
Subproject commit ae803c9295cf3d53aa49ddc2799d0f86aecc06a6