mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Marquee Result Buttons & Bookmark icon
This commit is contained in:
parent
f17523a600
commit
3c7a14c82b
3 changed files with 133 additions and 18 deletions
|
@ -327,6 +327,78 @@ class ResultFragmentTv : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resultPlayMovieButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultPlayMovieText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultPlayMovieText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultPlaySeriesButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultPlaySeriesText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultPlaySeriesText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultResumeSeriesButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultResumeSeriesText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultResumeSeriesText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultPlayTrailerButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultPlayTrailerText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultPlayTrailerText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultBookmarkButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultBookmarkText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultBookmarkText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultFavoriteButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultFavoriteText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultFavoriteText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultSubscribeButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultSubscribeText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultSubscribeText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultSearchButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultSearchText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultSearchText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resultEpisodesShowButton.setOnFocusChangeListener { _, hasFocus ->
|
||||||
|
if (!hasFocus) {
|
||||||
|
resultEpisodesShowText.isSelected = false
|
||||||
|
return@setOnFocusChangeListener
|
||||||
|
}
|
||||||
|
resultEpisodesShowText.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
resultEpisodes.setLinearListLayout(
|
resultEpisodes.setLinearListLayout(
|
||||||
isHorizontal = false,
|
isHorizontal = false,
|
||||||
nextUp = FOCUS_SELF,
|
nextUp = FOCUS_SELF,
|
||||||
|
@ -527,14 +599,25 @@ class ResultFragmentTv : Fragment() {
|
||||||
observe(viewModel.watchStatus) { watchType ->
|
observe(viewModel.watchStatus) { watchType ->
|
||||||
binding?.apply {
|
binding?.apply {
|
||||||
resultBookmarkText.setText(watchType.stringRes)
|
resultBookmarkText.setText(watchType.stringRes)
|
||||||
resultBookmarkButton.setOnClickListener { view ->
|
|
||||||
activity?.showBottomDialog(
|
resultBookmarkButton.apply {
|
||||||
WatchType.entries.map { view.context.getString(it.stringRes) }.toList(),
|
|
||||||
watchType.ordinal,
|
val drawable = if (watchType.stringRes == R.string.type_none) {
|
||||||
view.context.getString(R.string.action_add_to_bookmarks),
|
R.drawable.outline_bookmark_add_24
|
||||||
showApply = false,
|
} else {
|
||||||
{}) {
|
R.drawable.ic_baseline_bookmark_24
|
||||||
viewModel.updateWatchStatus(WatchType.entries[it], context)
|
}
|
||||||
|
setIconResource(drawable)
|
||||||
|
|
||||||
|
setOnClickListener { view ->
|
||||||
|
activity?.showBottomDialog(
|
||||||
|
WatchType.entries.map { view.context.getString(it.stringRes) }.toList(),
|
||||||
|
watchType.ordinal,
|
||||||
|
view.context.getString(R.string.action_add_to_bookmarks),
|
||||||
|
showApply = false,
|
||||||
|
{}) {
|
||||||
|
viewModel.updateWatchStatus(WatchType.entries[it], context)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
app/src/main/res/drawable/outline_bookmark_add_24.xml
Normal file
5
app/src/main/res/drawable/outline_bookmark_add_24.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M17,11v6.97l-5,-2.14l-5,2.14V5h6V3H7C5.9,3 5,3.9 5,5v16l7,-3l7,3V11H17zM21,7h-2v2h-2V7h-2V5h2V3h2v2h2V7z"/>
|
||||||
|
</vector>
|
|
@ -289,7 +289,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/movie" />
|
android:text="@string/movie" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -319,7 +322,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/episode" />
|
android:text="@string/episode" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -347,7 +353,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/resume" />
|
android:text="@string/resume" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -375,7 +384,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/play_trailer_button" />
|
android:text="@string/play_trailer_button" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -392,7 +404,7 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
style="@style/ResultSmallButtonTV"
|
style="@style/ResultSmallButtonTV"
|
||||||
app:iconPadding="0dp"
|
app:iconPadding="0dp"
|
||||||
app:icon="@drawable/ic_baseline_bookmark_24"
|
app:icon="@drawable/outline_bookmark_add_24"
|
||||||
android:nextFocusUp="@id/result_bookmark_Button"
|
android:nextFocusUp="@id/result_bookmark_Button"
|
||||||
android:nextFocusDown="@id/result_description"
|
android:nextFocusDown="@id/result_description"
|
||||||
android:tag="@string/tv_no_focus_tag">
|
android:tag="@string/tv_no_focus_tag">
|
||||||
|
@ -403,7 +415,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/type_none" />
|
android:text="@string/type_none" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -431,7 +446,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/favorite" />
|
android:text="@string/favorite" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -459,7 +477,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/action_subscribe" />
|
android:text="@string/action_subscribe" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -487,7 +508,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/result_search" />
|
android:text="@string/result_search" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -518,7 +542,10 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="top|center_horizontal"
|
android:gravity="top|center_horizontal"
|
||||||
android:minLines="2"
|
android:singleLine="true"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:text="@string/episodes" />
|
android:text="@string/episodes" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue