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
012ef479
Commit
012ef479
authored
5 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Upgrade paging to v 2.1.0 with ktx extension
(cherry picked from commit
c8d59d68
)
parent
a256dbd3
No related branches found
Branches containing commit
Tags
3.0.0-rc4
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build.gradle
+1
-1
1 addition, 1 deletion
build.gradle
vlc-android/build.gradle
+1
-1
1 addition, 1 deletion
vlc-android/build.gradle
vlc-android/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt
+10
-9
10 additions, 9 deletions
...oid/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt
with
12 additions
and
11 deletions
build.gradle
+
1
−
1
View file @
012ef479
...
...
@@ -42,7 +42,7 @@ ext {
constraintLayoutVersion
=
'1.1.3'
archVersion
=
'2.0.0'
roomVersion
=
'2.0.0'
pagingVersion
=
'2.
0
.0'
pagingVersion
=
'2.
1
.0'
junitVersion
=
'4.12'
mockito
=
'2.8.9'
powerMock
=
'1.7.4'
...
...
This diff is collapsed.
Click to expand it.
vlc-android/build.gradle
+
1
−
1
View file @
012ef479
...
...
@@ -231,7 +231,7 @@ dependencies {
kapt
"androidx.lifecycle:lifecycle-compiler:$rootProject.ext.archVersion"
implementation
"androidx.room:room-runtime:$rootProject.ext.roomVersion"
kapt
"androidx.room:room-compiler:$rootProject.ext.roomVersion"
implementation
"androidx.paging:paging-runtime:$rootProject.ext.pagingVersion"
implementation
"androidx.paging:paging-runtime
-ktx
:$rootProject.ext.pagingVersion"
// Retrofit
implementation
"com.squareup.retrofit2:retrofit:$rootProject.ext.retrofit"
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/viewmodels/paged/MLPagedModel.kt
+
10
−
9
View file @
012ef479
...
...
@@ -5,10 +5,10 @@ import androidx.annotation.MainThread
import
androidx.collection.SparseArrayCompat
import
androidx.lifecycle.LiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.paging.Config
import
androidx.paging.DataSource
import
androidx.paging.LivePagedListBuilder
import
androidx.paging.PagedList
import
androidx.paging.PositionalDataSource
import
androidx.paging.toLiveData
import
kotlinx.coroutines.*
import
org.videolan.medialibrary.Medialibrary
import
org.videolan.medialibrary.media.MediaLibraryItem
...
...
@@ -29,14 +29,15 @@ abstract class MLPagedModel<T : MediaLibraryItem>(context: Context) : SortableMo
private
val
headers
=
HeadersIndex
()
val
liveHeaders
:
LiveData
<
HeadersIndex
>
=
MutableLiveData
<
HeadersIndex
>()
private
val
pagingConfig
=
PagedList
.
Config
.
Builder
()
.
setPageSize
(
MEDIALIBRARY_PAGE_SIZE
)
.
setPrefetchDistance
(
MEDIALIBRARY_PAGE_SIZE
/
5
)
.
setEnablePlaceholders
(
true
)
.
build
()
private
val
pagingConfig
=
Config
(
pageSize
=
MEDIALIBRARY_PAGE_SIZE
,
prefetchDistance
=
MEDIALIBRARY_PAGE_SIZE
/
5
,
enablePlaceholders
=
true
,
initialLoadSizeHint
=
MEDIALIBRARY_PAGE_SIZE
*
3
,
maxSize
=
MEDIALIBRARY_PAGE_SIZE
*
3
)
val
pagedList
=
LivePagedListBuilder
(
MLDatasourceFactory
(),
pagingConfig
)
.
build
()
val
pagedList
=
MLDatasourceFactory
().
toLiveData
(
pagingConfig
)
init
{
medialibrary
.
addOnMedialibraryReadyListener
(
this
)
...
...
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