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.ui.settings.extensions.RepoAdapter
import com.lagradost.cloudstream3.utils.Coroutines.main import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import kotlinx.android.synthetic.main.fragment_extensions.* import kotlinx.android.synthetic.main.fragment_extensions.blank_repo_screen
import kotlinx.android.synthetic.main.fragment_setup_media.* 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() { class SetupFragmentExtensions : Fragment() {
@ -59,6 +64,7 @@ class SetupFragmentExtensions : Fragment() {
val hasRepos = repositories.isNotEmpty() val hasRepos = repositories.isNotEmpty()
repo_recycler_view?.isVisible = hasRepos repo_recycler_view?.isVisible = hasRepos
blank_repo_screen?.isVisible = !hasRepos blank_repo_screen?.isVisible = !hasRepos
view_public_repositories_button?.isVisible = hasRepos
if (hasRepos) { if (hasRepos) {
repo_recycler_view?.adapter = RepoAdapter(true, {}, { repo_recycler_view?.adapter = RepoAdapter(true, {}, {
@ -79,6 +85,11 @@ class SetupFragmentExtensions : Fragment() {
context?.fixPaddingStatusbar(setup_root) context?.fixPaddingStatusbar(setup_root)
val isSetup = arguments?.getBoolean(SETUP_EXTENSION_BUNDLE_IS_SETUP) ?: false 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) { with(context) {
if (this == null) return if (this == null) return
setRepositories() setRepositories()

View file

@ -68,6 +68,13 @@
android:gravity="bottom|end" android:gravity="bottom|end"
android:orientation="horizontal"> 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 <com.google.android.material.button.MaterialButton
android:id="@+id/next_btt" android:id="@+id/next_btt"
style="@style/WhiteButton" style="@style/WhiteButton"

View file

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