mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
Remove uses of String.all().
This commit is contained in:
parent
c1a424ad51
commit
27f338cf72
@ -2,6 +2,7 @@ package com.github.libretube.api
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import androidx.core.text.isDigitsOnly
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.api.obj.Playlist
|
import com.github.libretube.api.obj.Playlist
|
||||||
import com.github.libretube.api.obj.PlaylistId
|
import com.github.libretube.api.obj.PlaylistId
|
||||||
@ -237,8 +238,8 @@ object PlaylistsHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getPrivatePlaylistType(playlistId: String): PlaylistType {
|
private fun getPrivatePlaylistType(playlistId: String): PlaylistType {
|
||||||
if (playlistId.all { it.isDigit() }) return PlaylistType.LOCAL
|
return if (playlistId.isDigitsOnly()) PlaylistType.LOCAL
|
||||||
if (playlistId.matches(pipedPlaylistRegex)) return PlaylistType.PRIVATE
|
else if (playlistId.matches(pipedPlaylistRegex)) PlaylistType.PRIVATE
|
||||||
return PlaylistType.PUBLIC
|
else PlaylistType.PUBLIC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,7 @@ object TextUtils {
|
|||||||
* @return Time in seconds
|
* @return Time in seconds
|
||||||
*/
|
*/
|
||||||
fun parseTimestamp(t: String): Long? {
|
fun parseTimestamp(t: String): Long? {
|
||||||
if (t.all { c -> c.isDigit() }) {
|
return t.toLongOrNull() ?: Duration.parseOrNull(t)?.inWholeSeconds
|
||||||
return t.toLong()
|
|
||||||
}
|
|
||||||
|
|
||||||
return Duration.parseOrNull(t)?.inWholeSeconds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user