mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
added fab to resultspage
This commit is contained in:
parent
ea9ef8d293
commit
5c0bab96a4
4 changed files with 87 additions and 39 deletions
|
@ -329,6 +329,11 @@ class HomeFragment : Fragment() {
|
||||||
}
|
}
|
||||||
homeViewModel.loadStoredData(itemView.context, list)
|
homeViewModel.loadStoredData(itemView.context, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item.first?.setOnLongClickListener { itemView ->
|
||||||
|
homeViewModel.loadStoredData(itemView.context, EnumSet.of(watch))
|
||||||
|
return@setOnLongClickListener true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
observe(homeViewModel.availableWatchStatusTypes) { availableWatchStatusTypes ->
|
observe(homeViewModel.availableWatchStatusTypes) { availableWatchStatusTypes ->
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.content.Context
|
||||||
import android.content.Context.CLIPBOARD_SERVICE
|
import android.content.Context.CLIPBOARD_SERVICE
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.Intent.*
|
import android.content.Intent.*
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -46,6 +47,7 @@ import com.lagradost.cloudstream3.ui.download.EasyDownloadButton
|
||||||
import com.lagradost.cloudstream3.ui.player.PlayerData
|
import com.lagradost.cloudstream3.ui.player.PlayerData
|
||||||
import com.lagradost.cloudstream3.ui.player.PlayerFragment
|
import com.lagradost.cloudstream3.ui.player.PlayerFragment
|
||||||
import com.lagradost.cloudstream3.ui.quicksearch.QuickSearchFragment
|
import com.lagradost.cloudstream3.ui.quicksearch.QuickSearchFragment
|
||||||
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getDownloadSubsLanguageISO639_1
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getDownloadSubsLanguageISO639_1
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isAppInstalled
|
import com.lagradost.cloudstream3.utils.AppUtils.isAppInstalled
|
||||||
|
@ -56,6 +58,7 @@ import com.lagradost.cloudstream3.utils.Coroutines.main
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.getFolderName
|
import com.lagradost.cloudstream3.utils.DataStore.getFolderName
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
|
||||||
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.checkWrite
|
import com.lagradost.cloudstream3.utils.UIHelper.checkWrite
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
|
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
|
||||||
|
@ -210,22 +213,28 @@ class ResultFragment : Fragment() {
|
||||||
private fun updateVisStatus(state: Int) {
|
private fun updateVisStatus(state: Int) {
|
||||||
when (state) {
|
when (state) {
|
||||||
0 -> {
|
0 -> {
|
||||||
result_loading.visibility = VISIBLE
|
result_bookmark_fab?.isGone = true
|
||||||
result_finish_loading.visibility = GONE
|
result_loading?.isVisible = true
|
||||||
result_loading_error.visibility = GONE
|
result_finish_loading?.isVisible = false
|
||||||
|
result_loading_error?.isVisible = false
|
||||||
}
|
}
|
||||||
1 -> {
|
1 -> {
|
||||||
result_loading.visibility = GONE
|
result_bookmark_fab?.isGone = true
|
||||||
result_finish_loading.visibility = GONE
|
result_loading?.isVisible = false
|
||||||
result_loading_error.visibility = VISIBLE
|
result_finish_loading?.isVisible = false
|
||||||
result_reload_connection_open_in_browser.visibility = if (url == null) GONE else VISIBLE
|
result_loading_error?.isVisible = true
|
||||||
|
result_reload_connection_open_in_browser?.isVisible = url != null
|
||||||
}
|
}
|
||||||
2 -> {
|
2 -> {
|
||||||
result_loading.visibility = GONE
|
result_bookmark_fab?.isGone = result_bookmark_fab?.context?.isTvSettings() == true
|
||||||
result_finish_loading.visibility = VISIBLE
|
result_bookmark_fab?.extend()
|
||||||
result_loading_error.visibility = GONE
|
if (result_bookmark_button?.context?.isTvSettings() == true) {
|
||||||
|
result_bookmark_button?.requestFocus()
|
||||||
|
}
|
||||||
|
|
||||||
result_bookmark_button.requestFocus()
|
result_loading?.isVisible = false
|
||||||
|
result_finish_loading?.isVisible = true
|
||||||
|
result_loading_error?.isVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,22 +333,16 @@ class ResultFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result_scroll.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { _, _, scrollY, _, _ ->
|
|
||||||
if (result_poster_blur == null) return@OnScrollChangeListener
|
|
||||||
//result_poster_blur.alpha = maxOf(0f, (0.7f - scrollY / 1000f))
|
|
||||||
val setAlpha = 1f - scrollY / 200f
|
|
||||||
// result_back.alpha = setAlpha
|
|
||||||
result_poster_blur_holder.translationY = -scrollY.toFloat()
|
|
||||||
// result_back.translationY = -scrollY.toFloat()
|
|
||||||
//result_barstatus.alpha = scrollY / 200f
|
|
||||||
//result_barstatus.visibility = if (scrollY > 0) View.VISIBLE else View.GONE§
|
|
||||||
//result_back.visibility = if (setAlpha > 0) VISIBLE else GONE
|
|
||||||
})
|
|
||||||
|
|
||||||
// result_toolbar.setNavigationIcon(R.drawable.ic_baseline_arrow_back_24)
|
result_scroll.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
||||||
// result_toolbar.setNavigationOnClickListener {
|
val dy = scrollY - oldScrollY
|
||||||
// activity?.onBackPressed()
|
if (dy > 0) { //check for scroll down
|
||||||
// }
|
result_bookmark_fab?.shrink()
|
||||||
|
} else if (dy < -5) {
|
||||||
|
result_bookmark_fab?.extend()
|
||||||
|
}
|
||||||
|
result_poster_blur_holder?.translationY = -scrollY.toFloat()
|
||||||
|
})
|
||||||
|
|
||||||
result_back.setOnClickListener {
|
result_back.setOnClickListener {
|
||||||
activity?.popCurrentPage()
|
activity?.popCurrentPage()
|
||||||
|
@ -364,7 +367,7 @@ class ResultFragment : Fragment() {
|
||||||
if (allEpisodes.containsKey(episodeClick.data.id)) allEpisodes[episodeClick.data.id] else null
|
if (allEpisodes.containsKey(episodeClick.data.id)) allEpisodes[episodeClick.data.id] else null
|
||||||
val currentSubsTemp =
|
val currentSubsTemp =
|
||||||
if (allEpisodesSubs.containsKey(episodeClick.data.id)) allEpisodesSubs[episodeClick.data.id] else null
|
if (allEpisodesSubs.containsKey(episodeClick.data.id)) allEpisodesSubs[episodeClick.data.id] else null
|
||||||
if (currentLinksTemp != null && currentLinksTemp.size > 0) {
|
if (currentLinksTemp != null && currentLinksTemp.isNotEmpty()) {
|
||||||
currentLinks = currentLinksTemp
|
currentLinks = currentLinksTemp
|
||||||
currentSubs = currentSubsTemp
|
currentSubs = currentSubsTemp
|
||||||
return true
|
return true
|
||||||
|
@ -779,9 +782,30 @@ class ResultFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
observe(viewModel.watchStatus) {
|
observe(viewModel.watchStatus) { watchType ->
|
||||||
//result_bookmark_button.setIconResource(it.iconRes)
|
result_bookmark_button?.text = getString(watchType.stringRes)
|
||||||
result_bookmark_button.text = getString(it.stringRes)
|
result_bookmark_fab?.text = getString(watchType.stringRes)
|
||||||
|
|
||||||
|
if(watchType == WatchType.NONE) {
|
||||||
|
result_bookmark_fab?.context?.colorFromAttribute(R.attr.white)
|
||||||
|
} else {
|
||||||
|
result_bookmark_fab?.context?.colorFromAttribute(R.attr.colorPrimary)
|
||||||
|
}?.let {
|
||||||
|
val colorState = ColorStateList.valueOf(it)
|
||||||
|
result_bookmark_fab?.iconTint = colorState
|
||||||
|
result_bookmark_fab?.setTextColor(colorState)
|
||||||
|
}
|
||||||
|
|
||||||
|
result_bookmark_fab?.setOnClickListener { fab ->
|
||||||
|
fab.context.showBottomDialog(
|
||||||
|
WatchType.values().map { fab.context.getString(it.stringRes) }.toList(),
|
||||||
|
watchType.ordinal,
|
||||||
|
fab.context.getString(R.string.action_add_to_bookmarks),
|
||||||
|
showApply = true,
|
||||||
|
{}) {
|
||||||
|
viewModel.updateWatchStatus(fab.context, WatchType.values()[it])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
observe(viewModel.episodes) { episodeList ->
|
observe(viewModel.episodes) { episodeList ->
|
||||||
|
@ -1154,6 +1178,8 @@ class ResultFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
context?.let { ctx ->
|
context?.let { ctx ->
|
||||||
|
result_bookmark_button?.isVisible = ctx.isTvSettings()
|
||||||
|
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
val showFillers = settingsManager.getBoolean(ctx.getString(R.string.show_fillers_key), true)
|
val showFillers = settingsManager.getBoolean(ctx.getString(R.string.show_fillers_key), true)
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:nextFocusUp="@id/result_back"
|
android:nextFocusUp="@id/result_back"
|
||||||
android:nextFocusDown="@id/result_descript"
|
android:nextFocusDown="@id/result_descript"
|
||||||
android:nextFocusLeft="@id/result_bookmark_button"
|
android:nextFocusLeft="@id/result_back"
|
||||||
android:nextFocusRight="@id/result_openinbrower"
|
android:nextFocusRight="@id/result_openinbrower"
|
||||||
|
|
||||||
android:id="@+id/result_share"
|
android:id="@+id/result_share"
|
||||||
|
@ -299,8 +299,8 @@
|
||||||
android:foreground="@drawable/outline_drawable"
|
android:foreground="@drawable/outline_drawable"
|
||||||
android:paddingTop="5dp"
|
android:paddingTop="5dp"
|
||||||
android:paddingBottom="5dp"
|
android:paddingBottom="5dp"
|
||||||
android:nextFocusUp="@id/result_bookmark_button"
|
android:nextFocusUp="@id/result_back"
|
||||||
android:nextFocusDown="@id/result_play_movie"
|
android:nextFocusDown="@id/result_bookmark_button"
|
||||||
|
|
||||||
android:id="@+id/result_descript"
|
android:id="@+id/result_descript"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
|
@ -327,10 +327,10 @@
|
||||||
app:icon="@drawable/ic_baseline_bookmark_24"
|
app:icon="@drawable/ic_baseline_bookmark_24"
|
||||||
android:backgroundTint="?attr/primaryBlackBackground"
|
android:backgroundTint="?attr/primaryBlackBackground"
|
||||||
|
|
||||||
android:nextFocusLeft="@id/result_openinbrower"
|
android:nextFocusLeft="@id/result_back"
|
||||||
android:nextFocusDown="@id/result_descript"
|
android:nextFocusDown="@id/result_play_movie"
|
||||||
android:nextFocusUp="@id/result_back"
|
android:nextFocusUp="@id/result_descript"
|
||||||
android:nextFocusRight="@id/result_share"
|
android:nextFocusRight="@id/result_search"
|
||||||
|
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
app:cornerRadius="4dp"
|
app:cornerRadius="4dp"
|
||||||
|
@ -383,7 +383,7 @@
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:nextFocusUp="@id/result_descript"
|
android:nextFocusUp="@id/result_bookmark_button"
|
||||||
android:nextFocusDown="@id/result_download_movie"
|
android:nextFocusDown="@id/result_download_movie"
|
||||||
|
|
||||||
android:id="@+id/result_play_movie"
|
android:id="@+id/result_play_movie"
|
||||||
|
@ -598,5 +598,21 @@
|
||||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||||
android:contentDescription="@string/search_poster_descript"/>
|
android:contentDescription="@string/search_poster_descript"/>
|
||||||
</androidx.cardview.widget.CardView>-->
|
</androidx.cardview.widget.CardView>-->
|
||||||
|
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"
|
||||||
|
app:elevation="0dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:backgroundTint="?attr/primaryGrayBackground"
|
||||||
|
app:tint="?attr/colorPrimary"
|
||||||
|
android:textColor="?attr/colorPrimary"
|
||||||
|
app:iconTint="?attr/colorPrimary"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:id="@+id/result_bookmark_fab"
|
||||||
|
android:layout_gravity="end|bottom"
|
||||||
|
app:icon="@drawable/ic_baseline_bookmark_24"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:ignore="ContentDescription">
|
||||||
|
</com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
|
@ -124,6 +124,7 @@
|
||||||
<string name="filter_bookmarks">Filter Bookmarks</string>
|
<string name="filter_bookmarks">Filter Bookmarks</string>
|
||||||
<string name="error_bookmarks_text">Bookmarks</string>
|
<string name="error_bookmarks_text">Bookmarks</string>
|
||||||
<string name="action_remove_from_bookmarks">Remove</string>
|
<string name="action_remove_from_bookmarks">Remove</string>
|
||||||
|
<string name="action_add_to_bookmarks">Set watch status</string>
|
||||||
<string name="sort_apply">Apply</string>
|
<string name="sort_apply">Apply</string>
|
||||||
<string name="sort_cancel">Cancel</string>
|
<string name="sort_cancel">Cancel</string>
|
||||||
<string name="player_speed">Player Speed</string>
|
<string name="player_speed">Player Speed</string>
|
||||||
|
|
Loading…
Reference in a new issue