Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
529
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
79888580
Commit
79888580
authored
2 years ago
by
Robert Stone
Browse files
Options
Downloads
Patches
Plain Diff
Update deprecated calls
parent
34b3bb5e
No related branches found
No related tags found
1 merge request
!1286
Android Auto UI fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/vlc-android/src/org/videolan/vlc/gui/helpers/MediaComparators.kt
+6
-6
6 additions, 6 deletions
...roid/src/org/videolan/vlc/gui/helpers/MediaComparators.kt
with
6 additions
and
6 deletions
application/vlc-android/src/org/videolan/vlc/gui/helpers/MediaComparators.kt
+
6
−
6
View file @
79888580
...
...
@@ -28,10 +28,10 @@ object MediaComparators {
private
val
englishArticles
by
lazy
{
arrayOf
(
"a "
,
"an "
,
"the "
)
}
private
val
asciiAlphaNumeric
by
lazy
{
BitSet
().
also
{
b
->
"0123456789abcdefghijklmnopqrstuvwxyz"
.
toCharArray
().
forEach
{
c
->
b
.
set
(
c
.
toInt
()
,
true
)
}
}
BitSet
().
also
{
b
->
"0123456789abcdefghijklmnopqrstuvwxyz"
.
toCharArray
().
forEach
{
c
->
b
.
set
(
c
.
code
,
true
)
}
}
}
private
val
asciiPunctuation
by
lazy
{
BitSet
().
also
{
b
->
"\t !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
.
toCharArray
().
forEach
{
c
->
b
.
set
(
c
.
toInt
()
,
true
)
}
}
BitSet
().
also
{
b
->
"\t !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
.
toCharArray
().
forEach
{
c
->
b
.
set
(
c
.
code
,
true
)
}
}
}
val
BY_TRACK_NUMBER
:
Comparator
<
MediaWrapper
>
=
Comparator
{
m1
,
m2
->
...
...
@@ -52,7 +52,7 @@ object MediaComparators {
val
tTitle
=
origTitle
.
trim
()
if
(
tTitle
.
isEmpty
())
return
tTitle
/* Remove invalid leading characters and articles */
val
invCharTitle
=
removeLeadingPunctuation
(
tTitle
).
toL
ower
C
ase
(
Locale
.
US
)
val
invCharTitle
=
removeLeadingPunctuation
(
tTitle
).
l
ower
c
ase
(
Locale
.
US
)
val
scrubbedTitle
=
formatArticles
(
invCharTitle
,
false
).
ifEmpty
{
invCharTitle
}
/* Decompose the first letter to handle ä, ç, é, ô, etc. This yields two chars: an a-z letter, and
* a unicode combining character representing the diacritic mark. The combining character is dropped.
...
...
@@ -83,10 +83,10 @@ object MediaComparators {
* Functionally identical to replaceAll("[^a-z0-9]+", "")
*/
private
fun
removeNonAlphaNumeric
(
title
:
String
):
String
{
return
if
(
title
.
length
==
1
&&
asciiAlphaNumeric
.
get
(
title
[
0
].
toInt
()
))
title
return
if
(
title
.
length
==
1
&&
asciiAlphaNumeric
.
get
(
title
[
0
].
code
))
title
else
buildString
{
for
(
c
in
title
.
toCharArray
())
if
(
asciiAlphaNumeric
.
get
(
c
.
toInt
()
))
if
(
asciiAlphaNumeric
.
get
(
c
.
code
))
append
(
c
)
}
}
...
...
@@ -99,7 +99,7 @@ object MediaComparators {
*/
private
fun
removeLeadingPunctuation
(
title
:
String
):
String
{
title
.
forEachIndexed
{
i
,
c
->
if
(!
asciiPunctuation
.
get
(
c
.
toInt
()
))
if
(!
asciiPunctuation
.
get
(
c
.
code
))
return
title
.
substring
(
i
)
}
return
title
...
...
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