Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
528
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
5a7fd027
Commit
5a7fd027
authored
5 years ago
by
Nicolas Pomepuy
Browse files
Options
Downloads
Patches
Plain Diff
Fix Playlist cover not loading
parent
6b66c407
No related branches found
Branches containing commit
No related tags found
1 merge request
!154
Fix Playlist cover not loading
Pipeline
#7910
passed with stage
in 3 minutes and 43 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vlc-android/res/layout/activity_media_list_tv.xml
+11
-12
11 additions, 12 deletions
vlc-android/res/layout/activity_media_list_tv.xml
vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
+8
-8
8 additions, 8 deletions
vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
with
19 additions
and
20 deletions
vlc-android/res/layout/activity_media_list_tv.xml
+
11
−
12
View file @
5a7fd027
...
@@ -58,18 +58,17 @@
...
@@ -58,18 +58,17 @@
</FrameLayout>
</FrameLayout>
<ImageView
<ImageView
android:id=
"@+id/cover"
android:id=
"@+id/cover"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"90dp"
android:layout_height=
"90dp"
android:layout_marginStart=
"@dimen/tv_overscan_horizontal"
android:layout_marginStart=
"@dimen/tv_overscan_horizontal"
android:layout_marginBottom=
"8dp"
android:layout_marginBottom=
"8dp"
android:background=
"@{cover}"
app:imageWidth=
"@{imageWidth}"
app:imageWidth=
"@{imageWidth}"
app:layout_constraintBottom_toBottomOf=
"@+id/frameLayout"
app:layout_constraintBottom_toBottomOf=
"@+id/frameLayout"
app:layout_constraintDimensionRatio=
"1"
app:layout_constraintDimensionRatio=
"1"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:media=
"@{item}"
app:mediaWithWidth=
"@{item}"
tools:srcCompat=
"@tools:sample/avatars"
/>
tools:srcCompat=
"@tools:sample/avatars"
/>
<TextView
<TextView
android:id=
"@+id/albumTitle"
android:id=
"@+id/albumTitle"
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
+
8
−
8
View file @
5a7fd027
...
@@ -43,9 +43,15 @@ private const val TAG = "ImageLoader"
...
@@ -43,9 +43,15 @@ private const val TAG = "ImageLoader"
@MainThread
@MainThread
@BindingAdapter
(
value
=
[
"media"
,
"imageWidth"
],
requireAll
=
false
)
@BindingAdapter
(
value
=
[
"media"
,
"imageWidth"
],
requireAll
=
false
)
fun
loadImage
(
v
:
View
,
item
:
MediaLibraryItem
?,
imageWidth
:
Int
=
0
)
{
fun
loadImage
(
v
:
View
,
item
:
MediaLibraryItem
?,
imageWidth
:
Int
=
0
)
{
if
(
item
===
null
if
(
item
===
null
)
return
||
item
.
itemType
==
MediaLibraryItem
.
TYPE_PLAYLIST
)
if
(
item
.
itemType
==
MediaLibraryItem
.
TYPE_PLAYLIST
)
{
if
(
imageWidth
!=
0
)
{
loadPlaylistImageWithWidth
(
v
as
ImageView
,
item
,
imageWidth
)
}
return
return
}
val
binding
=
DataBindingUtil
.
findBinding
<
ViewDataBinding
>(
v
)
val
binding
=
DataBindingUtil
.
findBinding
<
ViewDataBinding
>(
v
)
if
(
item
.
itemType
==
MediaLibraryItem
.
TYPE_GENRE
&&
!
isForTV
(
binding
))
{
if
(
item
.
itemType
==
MediaLibraryItem
.
TYPE_GENRE
&&
!
isForTV
(
binding
))
{
return
return
...
@@ -67,8 +73,6 @@ fun loadImage(v: View, item: MediaLibraryItem?, imageWidth: Int = 0) {
...
@@ -67,8 +73,6 @@ fun loadImage(v: View, item: MediaLibraryItem?, imageWidth: Int = 0) {
else
AppScope
.
launch
{
getImage
(
v
,
findInLibrary
(
item
,
isMedia
,
isGroup
),
binding
,
imageWidth
)
}
else
AppScope
.
launch
{
getImage
(
v
,
findInLibrary
(
item
,
isMedia
,
isGroup
),
binding
,
imageWidth
)
}
}
}
@MainThread
@BindingAdapter
(
value
=
[
"bind:mediaWithWidth"
,
"bind:imageWidth"
],
requireAll
=
true
)
fun
loadPlaylistImageWithWidth
(
v
:
ImageView
,
item
:
MediaLibraryItem
?,
imageWidth
:
Int
)
{
fun
loadPlaylistImageWithWidth
(
v
:
ImageView
,
item
:
MediaLibraryItem
?,
imageWidth
:
Int
)
{
if
(
imageWidth
==
0
)
return
if
(
imageWidth
==
0
)
return
if
(
item
==
null
)
return
if
(
item
==
null
)
return
...
@@ -100,7 +104,6 @@ fun placeHolderView(v: View, item: MediaLibraryItem?) {
...
@@ -100,7 +104,6 @@ fun placeHolderView(v: View, item: MediaLibraryItem?) {
}
else
{
}
else
{
v
.
background
=
null
v
.
background
=
null
}
}
}
}
fun
isForTV
(
binding
:
ViewDataBinding
?)
=
(
binding
is
MediaBrowserTvItemBinding
)
||
binding
is
MediaBrowserTvItemBinding
fun
isForTV
(
binding
:
ViewDataBinding
?)
=
(
binding
is
MediaBrowserTvItemBinding
)
||
binding
is
MediaBrowserTvItemBinding
...
@@ -113,7 +116,6 @@ fun placeHolderImageView(v: View, item: MediaLibraryItem?) {
...
@@ -113,7 +116,6 @@ fun placeHolderImageView(v: View, item: MediaLibraryItem?) {
}
else
{
}
else
{
v
.
background
=
UiTools
.
getDefaultAudioDrawable
(
v
.
context
)
v
.
background
=
UiTools
.
getDefaultAudioDrawable
(
v
.
context
)
}
}
}
}
@BindingAdapter
(
"icvTitle"
)
@BindingAdapter
(
"icvTitle"
)
...
@@ -190,7 +192,6 @@ private suspend fun getPlaylistImage(v: View, item: MediaLibraryItem, binding: V
...
@@ -190,7 +192,6 @@ private suspend fun getPlaylistImage(v: View, item: MediaLibraryItem, binding: V
binding
.
addOnRebindCallback
(
rebindCallbacks
!!
)
binding
.
addOnRebindCallback
(
rebindCallbacks
!!
)
}
}
var
playlistImage
=
if
(!
bindChanged
)
ThumbnailsProvider
.
getPlaylistImage
(
"playlist:${item.id}"
,
item
.
tracks
.
toList
(),
width
)
else
null
var
playlistImage
=
if
(!
bindChanged
)
ThumbnailsProvider
.
getPlaylistImage
(
"playlist:${item.id}"
,
item
.
tracks
.
toList
(),
width
)
else
null
if
(!
bindChanged
&&
playlistImage
==
null
)
playlistImage
=
UiTools
.
getDefaultAudioDrawable
(
VLCApplication
.
appContext
).
bitmap
if
(!
bindChanged
&&
playlistImage
==
null
)
playlistImage
=
UiTools
.
getDefaultAudioDrawable
(
VLCApplication
.
appContext
).
bitmap
if
(!
bindChanged
)
updateImageView
(
playlistImage
,
v
,
binding
)
if
(!
bindChanged
)
updateImageView
(
playlistImage
,
v
,
binding
)
...
@@ -198,7 +199,6 @@ private suspend fun getPlaylistImage(v: View, item: MediaLibraryItem, binding: V
...
@@ -198,7 +199,6 @@ private suspend fun getPlaylistImage(v: View, item: MediaLibraryItem, binding: V
binding
?.
removeOnRebindCallback
(
rebindCallbacks
!!
)
binding
?.
removeOnRebindCallback
(
rebindCallbacks
!!
)
}
}
@MainThread
@MainThread
fun
updateImageView
(
bitmap
:
Bitmap
?,
target
:
View
,
vdb
:
ViewDataBinding
?)
{
fun
updateImageView
(
bitmap
:
Bitmap
?,
target
:
View
,
vdb
:
ViewDataBinding
?)
{
if
(
bitmap
===
null
||
bitmap
.
width
<=
1
||
bitmap
.
height
<=
1
)
return
if
(
bitmap
===
null
||
bitmap
.
width
<=
1
||
bitmap
.
height
<=
1
)
return
...
...
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