Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
528
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
7d2bbb42
Commit
7d2bbb42
authored
2 years ago
by
Nicolas Pomepuy
Committed by
Duncan McNamara
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix the video resolution text generation
Fixes #2699
parent
7c51aa8f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1562
Fix the video resolution text generation
Pipeline
#269486
passed with stage
in 21 minutes and 40 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+19
-7
19 additions, 7 deletions
...tion/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
with
19 additions
and
7 deletions
application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+
19
−
7
View file @
7d2bbb42
...
...
@@ -59,6 +59,7 @@ import java.net.URISyntaxException
import
java.security.SecureRandom
import
java.util.*
import
kotlin.math.max
import
kotlin.math.min
import
kotlin.math.roundToInt
fun
String
.
validateLocation
():
Boolean
{
...
...
@@ -361,14 +362,25 @@ fun RecyclerView.Adapter<*>.onAnyChange(listener: ()->Unit): RecyclerView.Adapte
return
dataObserver
}
fun
generateResolutionClass
(
width
:
Int
,
height
:
Int
)
:
String
?
=
if
(
width
<=
0
||
height
<=
0
)
{
/**
* Generate a string containing the commercial denomination of the video resolution
*
* @param width the video width
* @param height the video height
* @return the commercial resolution (SD, HD, 4K, ...)
*/
fun
generateResolutionClass
(
width
:
Int
,
height
:
Int
):
String
?
=
if
(
width
<=
0
||
height
<=
0
)
{
null
}
else
when
{
width
>=
7680
->
"8K"
width
>=
3840
->
"4K"
width
>=
1920
->
"1080p"
width
>=
1280
->
"720p"
else
->
"SD"
}
else
{
val
realHeight
=
min
(
height
,
width
)
when
{
realHeight
>=
4320
->
"8K"
realHeight
>=
2160
->
"4K"
realHeight
>=
1440
->
"qHD"
realHeight
>=
1080
->
"FHD"
realHeight
>=
720
->
"HD"
else
->
"SD"
}
}
val
View
.
scope
:
CoroutineScope
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment