tv ui fix

This commit is contained in:
reduplicated 2022-08-20 03:06:35 +02:00
parent db3e23621a
commit cb11cd13e6
6 changed files with 619 additions and 591 deletions

View file

@ -29,11 +29,10 @@ class WebviewFragment : Fragment() {
request: WebResourceRequest? request: WebResourceRequest?
): Boolean { ): Boolean {
val requestUrl = request?.url.toString() val requestUrl = request?.url.toString()
val repoUrl = if (requestUrl.startsWith("https://cs.repo")) { val repoUrl = if (requestUrl.startsWith("https://cs.repo")) {
"https://" + requestUrl.substringAfter("?") "https://" + requestUrl.substringAfter("?")
} else if (URI(requestUrl).scheme == appStringRepo) { } else if (URI(requestUrl).scheme == appStringRepo) {
"https://" + requestUrl.replaceFirst(appStringRepo, "https") requestUrl.replaceFirst(appStringRepo, "https")
} else { } else {
null null
} }

View file

@ -287,19 +287,19 @@ open class ResultFragment : ResultTrailerPlayer() {
2 -> { 2 -> {
result_bookmark_fab?.isGone = result_bookmark_fab?.context?.isTvSettings() == true result_bookmark_fab?.isGone = result_bookmark_fab?.context?.isTvSettings() == true
result_bookmark_fab?.extend() result_bookmark_fab?.extend()
if (result_bookmark_button?.context?.isTrueTvSettings() == true) { //if (result_bookmark_button?.context?.isTrueTvSettings() == true) {
when { // when {
result_play_movie?.isVisible == true -> { // result_play_movie?.isVisible == true -> {
result_play_movie?.requestFocus() // result_play_movie?.requestFocus()
} // }
result_resume_series_button?.isVisible == true -> { // result_resume_series_button?.isVisible == true -> {
result_resume_series_button?.requestFocus() // result_resume_series_button?.requestFocus()
} // }
else -> { // else -> {
result_bookmark_button?.requestFocus() // result_bookmark_button?.requestFocus()
} // }
} // }
} //}
result_loading?.isVisible = false result_loading?.isVisible = false
result_finish_loading?.isVisible = true result_finish_loading?.isVisible = true
@ -498,6 +498,17 @@ open class ResultFragment : ResultTrailerPlayer() {
viewModel.updateWatchStatus(WatchType.values()[it]) viewModel.updateWatchStatus(WatchType.values()[it])
} }
} }
result_bookmark_button?.setOnClickListener { fab ->
activity?.showBottomDialog(
WatchType.values().map { fab.context.getString(it.stringRes) }.toList(),
watchType.ordinal,
fab.context.getString(R.string.action_add_to_bookmarks),
showApply = false,
{}) {
viewModel.updateWatchStatus(WatchType.values()[it])
}
}
} }
// This is to band-aid FireTV navigation // This is to band-aid FireTV navigation
@ -859,7 +870,7 @@ open class ResultFragment : ResultTrailerPlayer() {
.contains(DubStatus.Dubbed) .contains(DubStatus.Dubbed)
) DubStatus.Dubbed else DubStatus.Subbed ) DubStatus.Dubbed else DubStatus.Subbed
result_bookmark_button?.isVisible = ctx.isTvSettings() //result_bookmark_button?.isVisible = ctx.isTvSettings()
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx) val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
val showFillers = val showFillers =

View file

@ -159,6 +159,7 @@ class ResultFragmentPhone : ResultFragment() {
activity?.popCurrentPage() activity?.popCurrentPage()
} }
/*
result_bookmark_button?.setOnClickListener { result_bookmark_button?.setOnClickListener {
it.popupMenuNoIcons( it.popupMenuNoIcons(
items = WatchType.values() items = WatchType.values()
@ -167,7 +168,7 @@ class ResultFragmentPhone : ResultFragment() {
) { ) {
viewModel.updateWatchStatus(WatchType.fromInternalId(this.itemId)) viewModel.updateWatchStatus(WatchType.fromInternalId(this.itemId))
} }
} }*/
result_mini_sync?.adapter = ImageAdapter( result_mini_sync?.adapter = ImageAdapter(
R.layout.result_mini_image, R.layout.result_mini_image,
@ -300,8 +301,8 @@ class ResultFragmentPhone : ResultFragment() {
if (result_season_button?.isVisible == true) if (result_season_button?.isVisible == true)
if (result_resume_parent?.isVisible == true) if (result_resume_parent?.isVisible == true)
setFocusUpAndDown(result_resume_series_button, result_season_button) setFocusUpAndDown(result_resume_series_button, result_season_button)
else //else
setFocusUpAndDown(result_bookmark_button, result_season_button) // setFocusUpAndDown(result_bookmark_button, result_season_button)
} }
observe(viewModel.selectedDubStatus) { status -> observe(viewModel.selectedDubStatus) { status ->
@ -311,8 +312,8 @@ class ResultFragmentPhone : ResultFragment() {
if (result_season_button?.isVisible != true && result_episode_select?.isVisible != true) { if (result_season_button?.isVisible != true && result_episode_select?.isVisible != true) {
if (result_resume_parent?.isVisible == true) if (result_resume_parent?.isVisible == true)
setFocusUpAndDown(result_resume_series_button, result_dub_select) setFocusUpAndDown(result_resume_series_button, result_dub_select)
else //else
setFocusUpAndDown(result_bookmark_button, result_dub_select) // setFocusUpAndDown(result_bookmark_button, result_dub_select)
} }
} }
observe(viewModel.selectedRange) { range -> observe(viewModel.selectedRange) { range ->
@ -323,8 +324,8 @@ class ResultFragmentPhone : ResultFragment() {
if (result_season_button?.isVisible != true) { if (result_season_button?.isVisible != true) {
if (result_resume_parent?.isVisible == true) if (result_resume_parent?.isVisible == true)
setFocusUpAndDown(result_resume_series_button, result_episode_select) setFocusUpAndDown(result_resume_series_button, result_episode_select)
else //else
setFocusUpAndDown(result_bookmark_button, result_episode_select) // setFocusUpAndDown(result_bookmark_button, result_episode_select)
} }
} }

View file

@ -394,7 +394,7 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<!--
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/result_bookmark_button" android:id="@+id/result_bookmark_button"
style="@style/BlackButton" style="@style/BlackButton"
@ -417,7 +417,7 @@
app:icon="@drawable/ic_baseline_bookmark_24" app:icon="@drawable/ic_baseline_bookmark_24"
tools:text="Bookmark" tools:text="Bookmark"
tools:visibility="visible" /> tools:visibility="visible" />
-->
<TextView <TextView
android:id="@+id/result_cast_text" android:id="@+id/result_cast_text"

View file

@ -20,7 +20,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView <ImageView
android:nextFocusDown="@id/result_bookmark_button"
android:nextFocusRight="@id/result_share" android:nextFocusRight="@id/result_share"
android:background="?android:attr/selectableItemBackgroundBorderless" android:background="?android:attr/selectableItemBackgroundBorderless"
@ -128,7 +127,6 @@
android:nextFocusUp="@id/result_back" android:nextFocusUp="@id/result_back"
android:nextFocusDown="@id/result_description" android:nextFocusDown="@id/result_description"
android:nextFocusLeft="@id/result_search" android:nextFocusLeft="@id/result_search"
android:nextFocusRight="@id/result_bookmark_button"
android:id="@+id/result_recommendations_btt" android:id="@+id/result_recommendations_btt"
android:layout_width="25dp" android:layout_width="25dp"

File diff suppressed because it is too large Load diff