Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
530
Issue boards
Milestones
Wiki
Code
Merge requests
15
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
79bce0fb
Commit
79bce0fb
authored
5 years ago
by
Nicolas Pomepuy
Committed by
Geoffrey Métais
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use a more readable duration format in InfoActivity
Refs #1032 (cherry picked from commit
79cae095
)
parent
413ffaa6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
medialibrary/src/org/videolan/medialibrary/Tools.java
+22
-12
22 additions, 12 deletions
medialibrary/src/org/videolan/medialibrary/Tools.java
vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
+1
-1
1 addition, 1 deletion
vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
with
23 additions
and
13 deletions
medialibrary/src/org/videolan/medialibrary/Tools.java
+
22
−
12
View file @
79bce0fb
...
...
@@ -5,6 +5,8 @@ import android.net.Uri;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
androidx.annotation.Nullable
;
import
org.videolan.medialibrary.interfaces.media.AbstractMediaWrapper
;
import
org.videolan.medialibrary.media.MediaLibraryItem
;
...
...
@@ -12,8 +14,6 @@ import java.text.DecimalFormat;
import
java.text.NumberFormat
;
import
java.util.Locale
;
import
androidx.annotation.Nullable
;
public
class
Tools
{
private
static
final
String
TAG
=
"VLC/Tools"
;
...
...
@@ -40,8 +40,8 @@ public class Tools {
long
lastTime
=
media
.
getTime
();
if
(
lastTime
==
0L
)
return
""
;
return
String
.
format
(
"%s / %s"
,
millisToString
(
lastTime
,
true
,
false
),
millisToString
(
media
.
getLength
(),
true
,
false
));
millisToString
(
lastTime
,
true
,
false
,
false
),
millisToString
(
media
.
getLength
(),
true
,
false
,
false
));
}
/**
...
...
@@ -50,7 +50,7 @@ public class Tools {
* @return formated string (hh:)mm:ss
*/
public
static
String
millisToString
(
long
millis
)
{
return
millisToString
(
millis
,
false
,
true
);
return
millisToString
(
millis
,
false
,
true
,
false
);
}
/**
...
...
@@ -59,7 +59,17 @@ public class Tools {
* @return formated string "[hh]h[mm]min" / "[mm]min[s]s"
*/
public
static
String
millisToText
(
long
millis
)
{
return
millisToString
(
millis
,
true
,
true
);
return
millisToString
(
millis
,
true
,
true
,
false
);
}
/**
* Convert time to a string with large formatting
*
* @param millis e.g.time/length from file
* @return formated string "[hh]h [mm]min " / "[mm]min [s]s"
*/
public
static
String
millisToTextLarge
(
long
millis
)
{
return
millisToString
(
millis
,
true
,
true
,
true
);
}
public
static
String
getResolution
(
AbstractMediaWrapper
media
)
{
...
...
@@ -92,7 +102,7 @@ public class Tools {
}
}
public
static
String
millisToString
(
long
millis
,
boolean
text
,
boolean
seconds
)
{
public
static
String
millisToString
(
long
millis
,
boolean
text
,
boolean
seconds
,
boolean
large
)
{
sb
.
setLength
(
0
);
if
(
millis
<
0
)
{
millis
=
-
millis
;
...
...
@@ -108,16 +118,16 @@ public class Tools {
if
(
text
)
{
if
(
hours
>
0
)
sb
.
append
(
hours
).
append
(
'h'
);
sb
.
append
(
hours
).
append
(
'h'
)
.
append
(
large
?
" "
:
""
)
;
if
(
min
>
0
)
sb
.
append
(
min
).
append
(
"min"
);
sb
.
append
(
min
).
append
(
"min"
)
.
append
(
large
?
" "
:
""
)
;
if
((
seconds
||
sb
.
length
()
==
0
)
&&
sec
>
0
)
sb
.
append
(
sec
).
append
(
"s"
);
sb
.
append
(
sec
).
append
(
"s"
)
.
append
(
large
?
" "
:
""
)
;
}
else
{
if
(
hours
>
0
)
sb
.
append
(
hours
).
append
(
':'
).
append
(
format
.
format
(
min
)).
append
(
':'
).
append
(
format
.
format
(
sec
));
sb
.
append
(
hours
).
append
(
':'
).
append
(
large
?
" "
:
""
).
append
(
format
.
format
(
min
)).
append
(
':'
).
append
(
large
?
" "
:
""
).
append
(
format
.
format
(
sec
));
else
sb
.
append
(
min
).
append
(
':'
).
append
(
format
.
format
(
sec
));
sb
.
append
(
min
).
append
(
':'
).
append
(
large
?
" "
:
""
).
append
(
format
.
format
(
sec
));
}
return
sb
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
+
1
−
1
View file @
79bce0fb
...
...
@@ -112,7 +112,7 @@ class InfoActivity : AudioPlayerContainerActivity(), View.OnClickListener, PathA
val
nbTracks
=
tracks
?.
size
?:
0
if
(
nbTracks
>
0
)
for
(
media
in
tracks
!!
)
length
+=
media
.
length
if
(
length
>
0
)
binding
.
length
=
Tools
.
millisToText
(
length
)
binding
.
length
=
Tools
.
millisToText
Large
(
length
)
if
(
item
is
AbstractMediaWrapper
)
{
val
media
=
item
as
AbstractMediaWrapper
...
...
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