File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import androidx.annotation.Nullable
4040import androidx.appcompat.app.AlertDialog
4141import androidx.appcompat.content.res.AppCompatResources
4242import androidx.core.content.edit
43+ import androidx.core.math.MathUtils
4344import androidx.core.os.bundleOf
4445import androidx.core.view.MenuItemCompat
4546import androidx.core.view.isVisible
@@ -603,7 +604,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
603604 // state until the user scrolls them out of the visible area which causes a update/bind-call
604605 groupAdapter.notifyItemRangeChanged(
605606 0 ,
606- minOf(groupAdapter.itemCount, maxOf (highlightCount, lastNewItemsCount) )
607+ MathUtils .clamp (highlightCount, lastNewItemsCount, groupAdapter.itemCount )
607608 )
608609
609610 if (highlightCount > 0 ) {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import android.view.View.OnTouchListener
77import android.widget.ProgressBar
88import androidx.appcompat.app.AppCompatActivity
99import androidx.appcompat.content.res.AppCompatResources
10+ import androidx.core.math.MathUtils
1011import androidx.core.view.isVisible
1112import org.schabi.newpipe.MainActivity
1213import org.schabi.newpipe.R
@@ -18,8 +19,6 @@ import org.schabi.newpipe.player.helper.PlayerHelper
1819import org.schabi.newpipe.player.ui.MainPlayerUi
1920import org.schabi.newpipe.util.ThemeHelper.getAndroidDimenPx
2021import kotlin.math.abs
21- import kotlin.math.max
22- import kotlin.math.min
2322
2423/* *
2524 * GestureListener for the player
@@ -114,7 +113,7 @@ class MainPlayerGestureListener(
114113
115114 // Update progress bar
116115 val oldBrightness = layoutParams.screenBrightness
117- bar.progress = (bar.max * max( 0f , min( 1f , oldBrightness) )).toInt()
116+ bar.progress = (bar.max * MathUtils .clamp(oldBrightness, 0f , 1f )).toInt()
118117 bar.incrementProgressBy(distanceY.toInt())
119118
120119 // Update brightness
Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ public void changePopupSize(final int width) {
291291 }
292292
293293 final float minimumWidth = context .getResources ().getDimension (R .dimen .popup_minimum_width );
294- final int actualWidth = Math . min ( (int ) Math . max ( width , minimumWidth ) , screenWidth );
294+ final int actualWidth = MathUtils . clamp ( width , (int ) minimumWidth , screenWidth );
295295 final int actualHeight = (int ) getMinimumVideoHeight (width );
296296 if (DEBUG ) {
297297 Log .d (TAG , "updatePopupSize() updated values:"
Original file line number Diff line number Diff line change @@ -100,13 +100,11 @@ object ReleaseVersionUtil {
100100 * @return Epoch second of expiry date time
101101 */
102102 fun coerceUpdateCheckExpiry (expiryString : String? ): Long {
103- val now = ZonedDateTime .now()
104- return expiryString?.let {
105- var expiry =
106- ZonedDateTime .from(DateTimeFormatter .RFC_1123_DATE_TIME .parse(expiryString))
107- expiry = maxOf(expiry, now.plusHours(6 ))
108- expiry = minOf(expiry, now.plusHours(72 ))
109- expiry.toEpochSecond()
110- } ? : now.plusHours(6 ).toEpochSecond()
103+ val nowPlus6Hours = ZonedDateTime .now().plusHours(6 )
104+ val expiry = expiryString?.let {
105+ ZonedDateTime .from(DateTimeFormatter .RFC_1123_DATE_TIME .parse(it))
106+ .coerceIn(nowPlus6Hours, nowPlus6Hours.plusHours(66 ))
107+ } ? : nowPlus6Hours
108+ return expiry.toEpochSecond()
111109 }
112110}
You can’t perform that action at this time.
0 commit comments