Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
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
9a1d8932
Commit
9a1d8932
authored
5 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Headers: Fix nullity check
(cherry picked from commit
3284ae7a
)
parent
b1b71a77
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
vlc-android/src/org/videolan/vlc/providers/medialibrary/MedialibraryProvider.kt
+1
-1
1 addition, 1 deletion
...deolan/vlc/providers/medialibrary/MedialibraryProvider.kt
vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
+11
-11
11 additions, 11 deletions
vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
with
12 additions
and
12 deletions
vlc-android/src/org/videolan/vlc/providers/medialibrary/MedialibraryProvider.kt
+
1
−
1
View file @
9a1d8932
...
...
@@ -94,7 +94,7 @@ abstract class MedialibraryProvider<T : MediaLibraryItem>(val context: Context,
fun
isEmpty
()
=
pagedList
.
value
.
isNullOrEmpty
()
fun
completeHeaders
(
list
:
Array
<
T
>,
startposition
:
Int
)
{
fun
completeHeaders
(
list
:
Array
<
T
?
>,
startposition
:
Int
)
{
for
((
position
,
item
)
in
list
.
withIndex
())
{
val
previous
=
when
{
position
>
0
->
list
[
position
-
1
]
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
+
11
−
11
View file @
9a1d8932
...
...
@@ -110,41 +110,41 @@ object ModelsHelper {
return
if
(
item
.
title
.
isEmpty
()
||
!
Character
.
isLetter
(
item
.
title
[
0
])
||
isSpecialItem
(
item
))
"#"
else
item
.
title
.
substring
(
0
,
1
).
toUpperCase
()
}
fun
getHeader
(
context
:
Context
?,
sort
:
Int
,
item
:
MediaLibraryItem
?,
aboveItem
:
MediaLibraryItem
?)
=
if
(
context
!==
null
||
item
=
=
null
)
when
(
sort
)
{
fun
getHeader
(
context
:
Context
?,
sort
:
Int
,
item
:
MediaLibraryItem
?,
aboveItem
:
MediaLibraryItem
?)
=
if
(
context
!==
null
&&
item
!
=
null
)
when
(
sort
)
{
SORT_DEFAULT
,
SORT_FILENAME
,
SORT_ALPHA
->
{
val
letter
=
if
(
item
!!
.
title
.
isEmpty
()
||
!
Character
.
isLetter
(
item
.
title
[
0
])
||
ModelsHelper
.
isSpecialItem
(
item
))
"#"
else
item
.
title
.
substring
(
0
,
1
).
toUpperCase
()
val
letter
=
if
(
item
.
title
.
isEmpty
()
||
!
Character
.
isLetter
(
item
.
title
[
0
])
||
ModelsHelper
.
isSpecialItem
(
item
))
"#"
else
item
.
title
.
substring
(
0
,
1
).
toUpperCase
()
if
(
aboveItem
==
null
)
letter
else
{
val
previous
=
if
(
aboveItem
.
title
.
isEmpty
()
||
!
Character
.
isLetter
(
aboveItem
.
title
[
0
])
||
ModelsHelper
.
isSpecialItem
(
aboveItem
))
"#"
else
aboveItem
.
title
.
substring
(
0
,
1
).
toUpperCase
()
if
(
letter
!=
previous
)
letter
else
null
letter
.
takeIf
{
it
!=
previous
}
}
}
SORT_DURATION
->
{
val
length
=
getLength
(
item
!!
)
val
length
=
getLength
(
item
)
val
lengthCategory
=
lengthToCategory
(
length
)
if
(
aboveItem
==
null
)
lengthCategory
else
{
val
previous
=
lengthToCategory
(
getLength
(
aboveItem
))
if
(
lengthCategory
!=
previous
)
lengthCategory
else
null
lengthCategory
.
takeIf
{
it
!=
previous
}
}
}
SORT_RELEASEDATE
->
{
val
year
=
getYear
(
item
!!
)
val
year
=
getYear
(
item
)
if
(
aboveItem
==
null
)
year
else
{
val
previous
=
getYear
(
aboveItem
)
if
(
year
!=
previous
)
year
else
null
year
.
takeIf
{
it
!=
previous
}
}
}
SORT_LASTMODIFICATIONDATE
->
{
val
timestamp
=
(
item
as
AbstractMediaWrapper
).
lastModified
val
category
=
getTimeCategory
(
timestamp
)
if
(
aboveItem
==
null
)
getTimeCategoryString
(
context
!!
,
category
)
if
(
aboveItem
==
null
)
getTimeCategoryString
(
context
,
category
)
else
{
val
prevCat
=
getTimeCategory
((
aboveItem
as
AbstractMediaWrapper
).
lastModified
)
if
(
prevCat
!=
category
)
getTimeCategoryString
(
context
!!
,
category
)
else
null
if
(
prevCat
!=
category
)
getTimeCategoryString
(
context
,
category
)
else
null
}
}
SORT_ARTIST
->
{
...
...
@@ -152,7 +152,7 @@ object ModelsHelper {
if
(
aboveItem
==
null
)
artist
else
{
val
previous
=
(
aboveItem
as
AbstractMediaWrapper
).
artist
?:
""
if
(
artist
!=
previous
)
artist
else
null
artist
.
takeIf
{
it
!=
previous
}
}
}
SORT_ALBUM
->
{
...
...
@@ -160,7 +160,7 @@ object ModelsHelper {
if
(
aboveItem
==
null
)
album
else
{
val
previous
=
(
aboveItem
as
AbstractMediaWrapper
).
album
?:
""
if
(
album
!=
previous
)
album
else
null
album
.
takeIf
{
it
!=
previous
}
}
}
else
->
null
...
...
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