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?
): Boolean {
val requestUrl = request?.url.toString()
val repoUrl = if (requestUrl.startsWith("https://cs.repo")) {
"https://" + requestUrl.substringAfter("?")
} else if (URI(requestUrl).scheme == appStringRepo) {
"https://" + requestUrl.replaceFirst(appStringRepo, "https")
requestUrl.replaceFirst(appStringRepo, "https")
} else {
null
}

View file

@ -287,19 +287,19 @@ open class ResultFragment : ResultTrailerPlayer() {
2 -> {
result_bookmark_fab?.isGone = result_bookmark_fab?.context?.isTvSettings() == true
result_bookmark_fab?.extend()
if (result_bookmark_button?.context?.isTrueTvSettings() == true) {
when {
result_play_movie?.isVisible == true -> {
result_play_movie?.requestFocus()
}
result_resume_series_button?.isVisible == true -> {
result_resume_series_button?.requestFocus()
}
else -> {
result_bookmark_button?.requestFocus()
}
}
}
//if (result_bookmark_button?.context?.isTrueTvSettings() == true) {
// when {
// result_play_movie?.isVisible == true -> {
// result_play_movie?.requestFocus()
// }
// result_resume_series_button?.isVisible == true -> {
// result_resume_series_button?.requestFocus()
// }
// else -> {
// result_bookmark_button?.requestFocus()
// }
// }
//}
result_loading?.isVisible = false
result_finish_loading?.isVisible = true
@ -498,6 +498,17 @@ open class ResultFragment : ResultTrailerPlayer() {
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
@ -859,7 +870,7 @@ open class ResultFragment : ResultTrailerPlayer() {
.contains(DubStatus.Dubbed)
) DubStatus.Dubbed else DubStatus.Subbed
result_bookmark_button?.isVisible = ctx.isTvSettings()
//result_bookmark_button?.isVisible = ctx.isTvSettings()
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
val showFillers =

View file

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

View file

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

View file

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

View file

@ -3,9 +3,9 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/result_root"
style="@style/DarkFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/DarkFragment"
android:background="?attr/primaryBlackBackground">
<com.facebook.shimmer.ShimmerFrameLayout
@ -114,9 +114,9 @@
android:id="@+id/result_finish_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"
android:orientation="vertical">
tools:visibility="visible">
<androidx.core.widget.NestedScrollView
android:id="@+id/result_scroll"
@ -132,17 +132,17 @@
android:orientation="vertical">
<com.facebook.shimmer.ShimmerFrameLayout
tools:visibility="gone"
android:visibility="gone"
android:id="@+id/result_trailer_loading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:shimmer_auto_start="true"
app:shimmer_base_alpha="0.2"
app:shimmer_duration="@integer/loading_time"
app:shimmer_highlight_alpha="0.3">
app:shimmer_highlight_alpha="0.3"
tools:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
@ -151,19 +151,19 @@
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:background="@color/grayShimmer"
app:cardCornerRadius="@dimen/loading_radius"
android:layout_width="match_parent"
android:layout_height="150dp"
android:foreground="@drawable/outline_drawable" />
android:background="@color/grayShimmer"
android:foreground="@drawable/outline_drawable"
app:cardCornerRadius="@dimen/loading_radius" />
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
<FrameLayout
android:descendantFocusability="blocksDescendants"
android:id="@+id/result_smallscreen_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<include layout="@layout/fragment_trailer" />
</FrameLayout>
@ -190,36 +190,36 @@
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginBottom="10dp"
android:layout_height="30dp">
android:orientation="horizontal">
<ImageView
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginEnd="10dp"
android:nextFocusDown="@id/result_description"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:id="@+id/result_back"
android:clickable="true"
android:focusable="true"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_baseline_arrow_back_24"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/go_back"
android:focusable="true"
android:gravity="center_vertical"
android:nextFocusDown="@id/result_description"
android:src="@drawable/ic_baseline_arrow_back_24"
app:tint="?attr/white" />
<TextView
android:id="@+id/result_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center_vertical"
android:layout_marginBottom="5dp"
android:gravity="center_vertical"
android:maxLines="1"
android:textColor="?attr/textColor"
android:textSize="20sp"
@ -270,15 +270,15 @@
The focus outline now settles between the poster and text.
-->
<TextView
android:padding="5dp"
android:maxLength="1000"
android:ellipsize="end"
android:id="@+id/result_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:foreground="@drawable/outline_drawable"
android:maxLength="1000"
android:nextFocusUp="@id/result_back"
android:nextFocusDown="@id/result_bookmark_button"
android:nextFocusDown="@id/result_play_movie"
android:padding="5dp"
android:textColor="?attr/textColor"
android:textSize="15sp"
tools:text="Ryan Quicksave Romano is an eccentric adventurer with a strange power: he can create a save-point in time and redo his life whenever he dies. Arriving in New Rome, the glitzy capital of sin of a rebuilding Europe, he finds the city torn between mega-corporations, sponsored heroes, superpowered criminals, and true monsters. It's a time of chaos, where potions can grant the power to rule the world and dangers lurk everywhere. " />
@ -297,23 +297,23 @@
tools:text="Cast: Joe Ligma" />
<androidx.recyclerview.widget.RecyclerView
tools:visibility="visible"
android:nextFocusUp="@id/result_bookmark_button"
android:nextFocusDown="@id/result_play_movie"
android:id="@+id/result_cast_items"
android:layout_width="match_parent"
android:descendantFocusability="afterDescendants"
android:layout_height="wrap_content"
android:descendantFocusability="afterDescendants"
android:fadingEdge="horizontal"
android:focusableInTouchMode="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:nextFocusUp="@id/result_back"
android:nextFocusDown="@id/result_play_movie"
android:orientation="horizontal"
android:paddingTop="5dp"
android:requiresFadingEdge="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="2"
tools:listitem="@layout/cast_item" />
tools:listitem="@layout/cast_item"
tools:visibility="visible" />
<TextView
android:id="@+id/result_vpn"
@ -400,18 +400,18 @@
tools:visibility="visible">
<com.google.android.material.button.MaterialButton
android:nextFocusRight="@id/result_download_movie"
android:nextFocusUp="@id/result_cast_items"
android:nextFocusDown="@id/result_resume_series_button_play"
android:id="@+id/result_play_movie"
style="@style/WhiteButton"
android:layout_width="wrap_content"
android:layout_weight="1"
android:minWidth="250dp"
android:layout_marginStart="0dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:minWidth="250dp"
android:nextFocusRight="@id/result_download_movie"
android:nextFocusUp="@id/result_cast_items"
android:nextFocusDown="@id/result_resume_series_button_play"
android:text="@string/play_movie_button"
android:visibility="visible"
app:icon="@drawable/ic_baseline_play_arrow_24">
@ -420,27 +420,29 @@
<FrameLayout
android:minWidth="250dp"
android:layout_marginStart="5dp"
android:nextFocusRight="@id/result_bookmark_button"
android:id="@+id/result_movie_progress_downloaded_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:layout_height="wrap_content">
android:minWidth="250dp">
<com.google.android.material.button.MaterialButton
android:nextFocusLeft="@id/result_play_movie"
android:nextFocusUp="@id/result_cast_items"
android:nextFocusDown="@id/result_resume_series_button_play"
android:id="@+id/result_download_movie"
style="@style/BlackButton"
android:layout_width="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:clickable="true"
android:focusable="true"
android:nextFocusLeft="@id/result_play_movie"
android:nextFocusUp="@id/result_cast_items"
android:nextFocusDown="@id/result_resume_series_button_play"
android:visibility="visible" />
@ -506,6 +508,21 @@
tools:text="68%" />
</LinearLayout>
</FrameLayout>
<com.google.android.material.button.MaterialButton
android:nextFocusLeft="@id/result_movie_progress_downloaded_holder"
android:nextFocusDown="@id/result_resume_series_button_play"
android:id="@+id/result_bookmark_button"
style="@style/BlackButton"
android:layout_width="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:minWidth="250dp"
android:text="@string/type_none"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
@ -533,47 +550,47 @@
app:icon="@drawable/cast_ic_mini_controller_skip_next" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/result_resume_series_button_play"
android:nextFocusUp="@id/result_play_movie"
android:nextFocusDown="@id/result_season_selection"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_gravity="center"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/download"
android:nextFocusUp="@id/result_play_movie"
android:nextFocusDown="@id/result_season_selection"
android:src="@drawable/ic_baseline_play_arrow_24"
android:visibility="visible"
app:tint="?attr/white" />
<TextView
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_gravity="center"
android:gravity="center"
android:id="@+id/result_resume_series_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="?attr/textColor"
android:textSize="17sp"
android:textStyle="bold"
tools:text="S1E1 Episode 1" />
<TextView
android:maxLines="1"
android:id="@+id/result_resume_series_progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:gravity="center"
android:maxLines="1"
android:textColor="?attr/grayTextColor"
tools:ignore="RtlSymmetry"
tools:text="69m remaining" />
@ -613,48 +630,49 @@
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/result_season_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:nextFocusUp="@id/result_resume_series_button_play"
android:nextFocusDown="@id/result_range_selection"
android:id="@+id/result_season_selection"
android:paddingBottom="10dp"
tools:listitem="@layout/result_selection"
android:orientation="horizontal"
android:paddingBottom="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
tools:listitem="@layout/result_selection" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/result_range_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:nextFocusUp="@id/result_season_selection"
android:nextFocusDown="@id/result_dub_selection"
android:id="@+id/result_range_selection"
android:paddingBottom="10dp"
tools:listitem="@layout/result_selection"
android:orientation="horizontal"
android:paddingBottom="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
tools:listitem="@layout/result_selection" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/result_dub_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:nextFocusUp="@id/result_range_selection"
android:nextFocusDown="@id/result_episodes"
android:id="@+id/result_dub_selection"
android:paddingBottom="10dp"
tools:listitem="@layout/result_selection"
android:orientation="horizontal"
android:paddingBottom="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
tools:listitem="@layout/result_selection" />
<LinearLayout
android:layout_marginBottom="5dp"
android:id="@+id/result_next_airing_holder"
android:layout_gravity="start"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<TextView
android:id="@+id/result_episodes_text"
android:layout_width="wrap_content"
@ -665,24 +683,25 @@
android:textSize="17sp"
android:textStyle="normal"
tools:text="8 Episodes" />
<TextView
android:gravity="center"
<TextView
android:id="@+id/result_next_airing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="?attr/grayTextColor"
android:textSize="17sp"
android:textStyle="normal"
tools:text="Episode 1022 will be released in" />
<TextView
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:gravity="center"
android:id="@+id/result_next_airing_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:textColor="?attr/textColor"
android:textSize="17sp"
android:textStyle="normal"
@ -690,7 +709,6 @@
</LinearLayout>
<com.facebook.shimmer.ShimmerFrameLayout
tools:visibility="gone"
android:id="@+id/result_episode_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -700,7 +718,8 @@
app:shimmer_auto_start="true"
app:shimmer_base_alpha="0.2"
app:shimmer_duration="@integer/loading_time"
app:shimmer_highlight_alpha="0.3">
app:shimmer_highlight_alpha="0.3"
tools:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
@ -725,12 +744,12 @@
android:layout_height="50dp" />-->
<androidx.recyclerview.widget.RecyclerView
android:nextFocusUp="@id/result_dub_selection"
android:nextFocusDown="@id/result_recommendations_filter_selection"
android:id="@+id/result_episodes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:nextFocusUp="@id/result_dub_selection"
android:nextFocusDown="@id/result_recommendations_filter_selection"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/result_episode" />
@ -739,47 +758,47 @@
<LinearLayout
android:id="@+id/result_recommendations_holder"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<androidx.recyclerview.widget.RecyclerView
tools:itemCount="2"
android:nextFocusUp="@id/result_episodes"
android:nextFocusDown="@id/result_recommendations"
android:id="@+id/result_recommendations_filter_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:nextFocusUp="@id/result_episodes"
tools:listitem="@layout/result_selection"
android:nextFocusDown="@id/result_recommendations"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
tools:itemCount="2"
tools:listitem="@layout/result_selection" />
<TextView
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="@string/recommended"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="@string/recommended"
android:textColor="?attr/textColor"
android:textSize="17sp" />
</LinearLayout>
<com.lagradost.cloudstream3.ui.AutofitRecyclerView
android:nextFocusUp="@id/result_recommendations_filter_selection"
android:descendantFocusability="afterDescendants"
android:background="?attr/primaryBlackBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:spanCount="8"
android:id="@+id/result_recommendations"
tools:listitem="@layout/search_result_grid"
android:orientation="vertical" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/primaryBlackBackground"
android:clipToPadding="false"
android:descendantFocusability="afterDescendants"
android:nextFocusUp="@id/result_recommendations_filter_selection"
android:orientation="vertical"
app:spanCount="8"
tools:listitem="@layout/search_result_grid" />
</LinearLayout>
</LinearLayout>