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
f9f1654d
Commit
f9f1654d
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Video groups: code cleaning
parent
0de2ea11
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/media/MediaGroup.java
+13
-13
13 additions, 13 deletions
vlc-android/src/org/videolan/vlc/media/MediaGroup.java
with
13 additions
and
13 deletions
vlc-android/src/org/videolan/vlc/media/MediaGroup.java
+
13
−
13
View file @
f9f1654d
...
...
@@ -36,7 +36,7 @@ public class MediaGroup extends MediaWrapper {
private
ArrayList
<
MediaWrapper
>
mMedias
;
p
ublic
MediaGroup
(
MediaWrapper
media
)
{
p
rivate
MediaGroup
(
MediaWrapper
media
)
{
super
(
media
.
getUri
(),
media
.
getTime
(),
media
.
getLength
(),
...
...
@@ -83,13 +83,13 @@ public class MediaGroup extends MediaWrapper {
return
mMedias
.
size
();
}
p
ublic
void
merge
(
MediaWrapper
media
,
String
title
)
{
p
rivate
void
merge
(
MediaWrapper
media
,
String
title
)
{
mMedias
.
add
(
media
);
this
.
mTitle
=
title
;
}
public
static
List
<
MediaGroup
>
group
(
MediaWrapper
[]
mediaList
)
{
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
final
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
for
(
MediaWrapper
media
:
mediaList
)
if
(
media
!=
null
)
insertInto
(
groups
,
media
);
...
...
@@ -97,7 +97,7 @@ public class MediaGroup extends MediaWrapper {
}
public
static
List
<
MediaGroup
>
group
(
List
<
MediaWrapper
>
mediaList
)
{
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
final
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
for
(
MediaWrapper
media
:
mediaList
)
if
(
media
!=
null
)
insertInto
(
groups
,
media
);
...
...
@@ -105,23 +105,23 @@ public class MediaGroup extends MediaWrapper {
}
private
static
void
insertInto
(
ArrayList
<
MediaGroup
>
groups
,
MediaWrapper
media
)
{
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
VLCApplication
.
getAppContext
());
int
minGroupLengthValue
=
Integer
.
valueOf
(
preferences
.
getString
(
"video_min_group_length"
,
"6"
));
final
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
VLCApplication
.
getAppContext
());
final
int
minGroupLengthValue
=
Integer
.
valueOf
(
preferences
.
getString
(
"video_min_group_length"
,
"6"
));
for
(
MediaGroup
mediaGroup
:
groups
)
{
String
group
=
mediaGroup
.
getTitle
();
String
title
=
media
.
getTitle
();
final
String
group
=
mediaGroup
.
getTitle
()
.
toLowerCase
()
;
String
title
=
media
.
getTitle
()
.
toLowerCase
()
;
//Handle titles starting with "The"
int
groupOffset
=
group
.
toLowerCase
().
startsWith
(
"the"
)
?
4
:
0
;
if
(
title
.
toLowerCase
().
startsWith
(
"the"
))
int
groupOffset
=
group
.
startsWith
(
"the"
)
?
4
:
0
;
if
(
title
.
startsWith
(
"the"
))
title
=
title
.
substring
(
4
);
// find common prefix
int
commonLength
=
0
;
String
groupTitle
=
group
.
substring
(
groupOffset
);
int
minLength
=
Math
.
min
(
groupTitle
.
length
(),
title
.
length
());
final
String
groupTitle
=
group
.
substring
(
groupOffset
);
final
int
minLength
=
Math
.
min
(
groupTitle
.
length
(),
title
.
length
());
while
(
commonLength
<
minLength
&&
groupTitle
.
toLowerCase
().
charAt
(
commonLength
)
==
title
.
toLowerCase
().
charAt
(
commonLength
))
&&
groupTitle
.
charAt
(
commonLength
)
==
title
.
charAt
(
commonLength
))
++
commonLength
;
if
(
commonLength
>=
minGroupLengthValue
&&
minGroupLengthValue
!=
0
)
{
...
...
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