diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt index 0e52baff6b9..092676ff31d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt @@ -30,6 +30,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.chip.Chip import com.lagradost.api.Log +import com.lagradost.cloudstream3.APIHolder import com.lagradost.cloudstream3.APIHolder.apis import com.lagradost.cloudstream3.AllLanguagesName import com.lagradost.cloudstream3.CommonActivity.showToast @@ -701,6 +702,21 @@ class HomeFragment : BaseFragment( homeViewModel.queryTextSubmit("") } + homePreviewSettingsButton.setOnClickListener { view -> + val apiName = homeViewModel.apiName.value + val plugin = APIHolder.getApiFromNameNull(apiName) + ?.sourcePlugin?.let { PluginManager.plugins[it] } as? Plugin + val openSettings = plugin?.openSettings + if (openSettings != null) { + try { + val activityContext = view.context.getActivity() ?: view.context + openSettings.invoke(activityContext) + } catch (e: Throwable) { + logError(e) + } + } + } + // Load value for toggling Tv layout real time clock. Hide by default at startup // set visibility first, to apply a scroll effect later context?.let { @@ -795,6 +811,11 @@ class HomeFragment : BaseFragment( homeChangeApi.text = apiName homePreviewReloadProvider.isGone = (apiName == noneApi.name) homePreviewSearchButton.isGone = (apiName == noneApi.name) + if (isLayout(TV or EMULATOR)) { + val plugin = APIHolder.getApiFromNameNull(apiName) + ?.sourcePlugin?.let { PluginManager.plugins[it] } as? Plugin + homePreviewSettingsButton.isGone = plugin?.openSettings == null + } } } diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 8d78c01b3e7..dc1635392c6 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -260,4 +260,11 @@ android:layout_width="0dp" android:layout_height="0dp" android:visibility="gone" /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home_tv.xml b/app/src/main/res/layout/fragment_home_tv.xml index d50c4c2e40c..f8559ab14d3 100644 --- a/app/src/main/res/layout/fragment_home_tv.xml +++ b/app/src/main/res/layout/fragment_home_tv.xml @@ -200,11 +200,28 @@ android:gravity="center" android:nextFocusLeft="@id/navigation_home" tools:text="Hello!" - android:nextFocusRight="@id/home_preview_reload_provider" + android:nextFocusRight="@id/home_preview_settings_button" android:nextFocusDown="@id/home_preview_info_btt" > + +