Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -701,6 +702,21 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(
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 {
Expand Down Expand Up @@ -795,6 +811,11 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(
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
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,11 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone" />

<!-- Placeholder for TV layout settings button - always hidden on phone -->
<ImageView
android:id="@+id/home_preview_settings_button"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone" />
</FrameLayout>
21 changes: 19 additions & 2 deletions app/src/main/res/layout/fragment_home_tv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" >
<requestFocus />
</com.google.android.material.button.MaterialButton>

<ImageView
android:id="@+id/home_preview_settings_button"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@drawable/player_button_tv_attr_no_bg"
android:contentDescription="@string/title_settings"
android:focusable="true"
android:nextFocusLeft="@id/home_change_api"
android:nextFocusRight="@id/home_preview_reload_provider"
android:nextFocusDown="@id/home_preview_info_btt"
android:padding="10dp"
android:src="@drawable/ic_baseline_tune_24"
android:tag="@string/tv_no_focus_tag"
android:visibility="gone"
app:tint="@color/player_on_button_tv_attr" />

<ImageView
android:id="@+id/home_preview_reload_provider"
android:layout_width="50dp"
Expand All @@ -213,7 +230,7 @@
android:background="@drawable/player_button_tv_attr_no_bg"
android:contentDescription="@string/reload_provider"
android:focusable="true"
android:nextFocusLeft="@id/home_change_api"
android:nextFocusLeft="@id/home_preview_settings_button"
android:nextFocusRight="@id/home_preview_search_button"
android:nextFocusUp="@id/home_preview_reload_provider"
android:nextFocusDown="@id/home_preview_info_btt"
Expand Down