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
55f39cb3
Commit
55f39cb3
authored
5 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
PlaylistManager: code factorization
parent
45eac0ba
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/media/PlaylistManager.kt
+1
-1
1 addition, 1 deletion
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+8
-29
8 additions, 29 deletions
vlc-android/src/org/videolan/vlc/util/Kextensions.kt
with
9 additions
and
30 deletions
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+
1
−
1
View file @
55f39cb3
...
...
@@ -651,7 +651,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
load
(
list
,
0
)
return
}
val
list
=
withContext
(
Dispatchers
.
IO
)
{
list
.
get
WithMLMeta
()
}
val
list
=
withContext
(
Dispatchers
.
IO
)
{
list
.
update
WithMLMeta
()
}
mediaList
.
removeEventListener
(
this
)
for
(
media
in
list
)
mediaList
.
add
(
media
)
mediaList
.
addEventListener
(
this
)
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+
8
−
29
View file @
55f39cb3
...
...
@@ -11,6 +11,7 @@ import android.os.Build
import
android.util.DisplayMetrics
import
android.view.View
import
android.widget.TextView
import
androidx.annotation.WorkerThread
import
androidx.appcompat.widget.AppCompatTextView
import
androidx.core.text.PrecomputedTextCompat
import
androidx.core.widget.TextViewCompat
...
...
@@ -23,8 +24,8 @@ import org.videolan.libvlc.Media
import
org.videolan.libvlc.util.AndroidUtil
import
org.videolan.medialibrary.interfaces.AbstractMedialibrary
import
org.videolan.medialibrary.interfaces.media.AbstractMediaWrapper
import
org.videolan.medialibrary.interfaces.media.AbstractMediaWrapper.TYPE_ALL
import
org.videolan.medialibrary.media.MediaLibraryItem
import
org.videolan.vlc.VLCApplication
import
org.videolan.vlc.startMedialibrary
import
java.io.File
import
java.net.URI
...
...
@@ -104,40 +105,18 @@ suspend inline fun <reified T> Context.getFromMl(crossinline block: AbstractMedi
}
}
fun
List
<
AbstractMediaWrapper
>.
getWithMLMeta
()
:
List
<
AbstractMediaWrapper
>
{
if
(
this
is
MutableList
<
AbstractMediaWrapper
>)
return
updateWithMLMeta
()
val
list
=
mutableListOf
<
AbstractMediaWrapper
>()
@WorkerThread
fun
List
<
AbstractMediaWrapper
>.
updateWithMLMeta
()
:
MutableList
<
AbstractMediaWrapper
>
{
val
ml
=
AbstractMedialibrary
.
getInstance
()
val
list
=
mutableListOf
<
AbstractMediaWrapper
>()
for
(
media
in
this
)
{
if
(
media
.
id
==
0L
)
{
val
mw
=
ml
.
findMedia
(
media
)
if
(
mw
.
id
!=
0L
)
if
(
mw
.
type
==
AbstractMediaWrapper
.
TYPE_ALL
)
mw
.
type
=
media
.
type
list
.
add
(
mw
)
}
list
.
add
(
ml
.
findMedia
(
media
).
apply
{
if
(
type
==
TYPE_ALL
)
type
=
media
.
type
})
}
return
list
}
fun
MutableList
<
AbstractMediaWrapper
>.
updateWithMLMeta
()
:
MutableList
<
AbstractMediaWrapper
>
{
val
iter
=
listIterator
()
val
ml
=
AbstractMedialibrary
.
getInstance
()
try
{
while
(
iter
.
hasNext
())
{
val
media
=
iter
.
next
()
if
(
media
.
id
==
0L
)
{
val
mw
=
ml
.
findMedia
(
media
)
if
(
mw
!!
.
id
!=
0L
)
{
if
(
mw
.
type
==
AbstractMediaWrapper
.
TYPE_ALL
)
mw
.
type
=
media
.
getType
()
iter
.
set
(
mw
)
}
}
}
}
catch
(
ignored
:
Exception
)
{}
return
this
}
@ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi
suspend
fun
String
.
scanAllowed
()
=
withContext
(
Dispatchers
.
IO
)
{
...
...
This diff is collapsed.
Click to expand it.
Geoffrey Métais
@Dekans
mentioned in commit
495ce5d9
·
5 years ago
mentioned in commit
495ce5d9
mentioned in commit 495ce5d90639bb255663bb5a187e95f6fd4cbde2
Toggle commit list
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