Add repository button to setup

This commit is contained in:
Blatzar 2022-08-18 22:21:15 +02:00
parent ffd8db4c65
commit 6149d48443
3 changed files with 31 additions and 13 deletions

View file

@ -18,8 +18,13 @@ import com.lagradost.cloudstream3.ui.settings.extensions.PluginsViewModel
import com.lagradost.cloudstream3.ui.settings.extensions.RepoAdapter
import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import kotlinx.android.synthetic.main.fragment_extensions.*
import kotlinx.android.synthetic.main.fragment_setup_media.*
import kotlinx.android.synthetic.main.fragment_extensions.blank_repo_screen
import kotlinx.android.synthetic.main.fragment_extensions.list_repositories
import kotlinx.android.synthetic.main.fragment_extensions.repo_recycler_view
import kotlinx.android.synthetic.main.fragment_setup_extensions.*
import kotlinx.android.synthetic.main.fragment_setup_media.next_btt
import kotlinx.android.synthetic.main.fragment_setup_media.prev_btt
import kotlinx.android.synthetic.main.fragment_setup_media.setup_root
class SetupFragmentExtensions : Fragment() {
@ -59,6 +64,7 @@ class SetupFragmentExtensions : Fragment() {
val hasRepos = repositories.isNotEmpty()
repo_recycler_view?.isVisible = hasRepos
blank_repo_screen?.isVisible = !hasRepos
view_public_repositories_button?.isVisible = hasRepos
if (hasRepos) {
repo_recycler_view?.adapter = RepoAdapter(true, {}, {
@ -79,6 +85,11 @@ class SetupFragmentExtensions : Fragment() {
context?.fixPaddingStatusbar(setup_root)
val isSetup = arguments?.getBoolean(SETUP_EXTENSION_BUNDLE_IS_SETUP) ?: false
view_public_repositories_button?.setOnClickListener {
val isTv = it.context.isTvSettings()
openBrowser(PUBLIC_REPOSITORIES_LIST, isTv, this)
}
with(context) {
if (this == null) return
setRepositories()

View file

@ -68,6 +68,13 @@
android:gravity="bottom|end"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/view_public_repositories_button"
style="@style/WhiteButton"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical|end"
android:text="@string/add_repository" />
<com.google.android.material.button.MaterialButton
android:id="@+id/next_btt"
style="@style/WhiteButton"

View file

@ -11,17 +11,17 @@
<Preference
android:key="@string/opensubtitles_key"
android:icon="@drawable/open_subtitles_icon" />
<Preference
android:key="@string/nginx_key"
android:icon="@drawable/nginx" />
<!-- <Preference-->
<!-- android:key="@string/nginx_key"-->
<!-- android:icon="@drawable/nginx" />-->
<Preference
android:title="@string/nginx_info_title"
android:icon="@drawable/nginx_question"
android:summary="@string/nginx_info_summary">
<intent
android:action="android.intent.action.VIEW"
android:data="https://www.sarlays.com/use-nginx-with-cloudstream/" />
</Preference>
<!-- <Preference-->
<!-- android:title="@string/nginx_info_title"-->
<!-- android:icon="@drawable/nginx_question"-->
<!-- android:summary="@string/nginx_info_summary">-->
<!-- <intent-->
<!-- android:action="android.intent.action.VIEW"-->
<!-- android:data="https://www.sarlays.com/use-nginx-with-cloudstream/" />-->
<!-- </Preference>-->
</PreferenceScreen>