Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
532
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
17b1da20
You need to sign in or sign up before continuing.
Commit
17b1da20
authored
8 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Update video covers when they are generated
parent
cb162df6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+20
-7
20 additions, 7 deletions
...roid/src/org/videolan/vlc/gui/video/VideoListAdapter.java
with
20 additions
and
7 deletions
vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+
20
−
7
View file @
17b1da20
...
...
@@ -117,11 +117,19 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
if
(
payloads
.
isEmpty
())
onBindViewHolder
(
holder
,
position
);
else
{
MediaWrapper
media
=
(
MediaWrapper
)
payloads
.
get
(
0
);
MediaWrapper
media
=
mVideos
.
get
(
position
);
boolean
isSelected
=
media
.
hasStateFlags
(
MediaLibraryItem
.
FLAG_SELECTED
);
holder
.
setOverlay
(
isSelected
);
holder
.
binding
.
setVariable
(
BR
.
bgColor
,
ContextCompat
.
getColor
(
holder
.
itemView
.
getContext
(),
mListMode
&&
isSelected
?
R
.
color
.
orange200transparent
:
R
.
color
.
transparent
));
fillView
(
holder
,
media
);
for
(
Object
data
:
payloads
)
{
if
(
data
instanceof
String
)
{
media
.
setArtworkURL
((
String
)
payloads
.
get
(
0
));
AsyncImageLoader
.
loadPicture
(
holder
.
thumbView
,
media
);
}
else
{
media
.
setTime
((
Long
)
data
);
fillView
(
holder
,
media
);
}
}
}
}
...
...
@@ -145,7 +153,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
return
isPositionValid
(
position
)
?
mVideos
.
get
(
position
)
:
null
;
}
boolean
isPositionValid
(
int
position
)
{
private
boolean
isPositionValid
(
int
position
)
{
return
position
>=
0
&&
position
<
mVideos
.
size
();
}
...
...
@@ -216,7 +224,7 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
if
(
position
!=
-
1
)
{
if
(!(
mVideos
.
get
(
position
)
instanceof
MediaGroup
))
mVideos
.
updateItemAt
(
position
,
item
);
notifyItemChanged
(
position
);
notifyItemChanged
(
position
,
item
.
getArtworkMrl
()
);
}
else
notifyItemInserted
(
mVideos
.
add
(
item
));
}
...
...
@@ -539,14 +547,19 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
public
boolean
areContentsTheSame
(
int
oldItemPosition
,
int
newItemPosition
)
{
MediaWrapper
oldItem
=
oldList
.
get
(
oldItemPosition
);
MediaWrapper
newItem
=
newList
.
get
(
newItemPosition
);
return
oldItem
.
getTime
()
==
newItem
.
getTime
();
return
oldItem
.
getTime
()
==
newItem
.
getTime
()
&&
TextUtils
.
equals
(
oldItem
.
getArtworkMrl
(),
newItem
.
getArtworkMrl
())
;
}
@Nullable
@Override
public
Object
getChangePayload
(
int
oldItemPosition
,
int
newItemPosition
)
{
oldList
.
get
(
oldItemPosition
).
setTime
(
newList
.
get
(
newItemPosition
).
getTime
());
return
oldList
.
get
(
oldItemPosition
);
MediaWrapper
oldItem
=
oldList
.
get
(
oldItemPosition
);
MediaWrapper
newItem
=
newList
.
get
(
newItemPosition
);
if
(
oldItem
.
getTime
()
!=
newItem
.
getTime
())
return
newItem
.
getTime
();
else
return
newItem
.
getArtworkMrl
();
}
}
}
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