mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-03 08:04:30 +02:00
fix the calculation that incorrectly sets the number of columns to display
This commit is contained in:
parent
7c9e9d5f52
commit
23afe7994c
@ -33,6 +33,7 @@ import com.futo.platformplayer.views.overlays.slideup.SlideUpMenuItem
|
|||||||
import com.futo.platformplayer.views.overlays.slideup.SlideUpMenuOverlay
|
import com.futo.platformplayer.views.overlays.slideup.SlideUpMenuOverlay
|
||||||
import com.futo.platformplayer.withTimestamp
|
import com.futo.platformplayer.withTimestamp
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
abstract class ContentFeedView<TFragment> : FeedView<TFragment, IPlatformContent, IPlatformContent, IPager<IPlatformContent>, ContentPreviewViewHolder> where TFragment : MainFragment {
|
abstract class ContentFeedView<TFragment> : FeedView<TFragment, IPlatformContent, IPlatformContent, IPager<IPlatformContent>, ContentPreviewViewHolder> where TFragment : MainFragment {
|
||||||
private var _exoPlayer: PlayerManager? = null;
|
private var _exoPlayer: PlayerManager? = null;
|
||||||
@ -168,7 +169,7 @@ abstract class ContentFeedView<TFragment> : FeedView<TFragment, IPlatformContent
|
|||||||
val glmResults =
|
val glmResults =
|
||||||
GridLayoutManager(
|
GridLayoutManager(
|
||||||
context,
|
context,
|
||||||
(resources.configuration.screenWidthDp / resources.getDimension(R.dimen.landscape_threshold)).toInt() + 1
|
max((resources.configuration.screenWidthDp.toDouble() / resources.getInteger(R.integer.landscape_threshold)).toInt(), 1)
|
||||||
);
|
);
|
||||||
return glmResults
|
return glmResults
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import kotlinx.coroutines.CancellationException
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
abstract class FeedView<TFragment, TResult, TConverted, TPager, TViewHolder> : LinearLayout where TPager : IPager<TResult>, TViewHolder : RecyclerView.ViewHolder, TFragment : MainFragment {
|
abstract class FeedView<TFragment, TResult, TConverted, TPager, TViewHolder> : LinearLayout where TPager : IPager<TResult>, TViewHolder : RecyclerView.ViewHolder, TFragment : MainFragment {
|
||||||
protected val _recyclerResults: RecyclerView;
|
protected val _recyclerResults: RecyclerView;
|
||||||
@ -234,7 +235,8 @@ abstract class FeedView<TFragment, TResult, TConverted, TPager, TViewHolder> : L
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun updateSpanCount() {
|
open fun updateSpanCount() {
|
||||||
recyclerData.layoutManager.spanCount = (resources.configuration.screenWidthDp / resources.getDimension(R.dimen.landscape_threshold)).toInt() + 1
|
recyclerData.layoutManager.spanCount =
|
||||||
|
max((resources.configuration.screenWidthDp.toDouble() / resources.getInteger(R.integer.landscape_threshold)).toInt(), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||||
|
@ -91,7 +91,7 @@ class VideoDetailFragment : MainFragment {
|
|||||||
return min(
|
return min(
|
||||||
resources.configuration.screenWidthDp,
|
resources.configuration.screenWidthDp,
|
||||||
resources.configuration.screenHeightDp
|
resources.configuration.screenHeightDp
|
||||||
) < resources.getDimension(R.dimen.landscape_threshold)
|
) < resources.getInteger(R.integer.landscape_threshold) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<dimen name="minimized_player_max_width">500dp</dimen>
|
<dimen name="minimized_player_max_width">500dp</dimen>
|
||||||
<dimen name="app_bar_height">200dp</dimen>
|
<dimen name="app_bar_height">200dp</dimen>
|
||||||
<dimen name="landscape_threshold">300dp</dimen>
|
<integer name="landscape_threshold">400</integer>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user