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
7d4d7004
Commit
7d4d7004
authored
5 years ago
by
Nicolas Pomepuy
Committed by
Geoffrey Métais
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix audio lists position restoration
Fixes
#1027
(cherry picked from commit
fd22be91
)
parent
6e6560e9
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/audio/AudioBrowserFragment.kt
+10
-2
10 additions, 2 deletions
...id/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
with
10 additions
and
2 deletions
vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.kt
+
10
−
2
View file @
7d4d7004
...
...
@@ -25,6 +25,7 @@ import android.content.SharedPreferences
import
android.content.res.Configuration
import
android.os.Bundle
import
android.os.Message
import
android.util.SparseArray
import
android.view.*
import
android.widget.Button
import
android.widget.TextView
...
...
@@ -71,6 +72,7 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>(), SwipeRef
private
lateinit
var
fastScroller
:
FastScroller
override
val
hasTabs
=
true
private
var
spacing
=
0
private
var
restorePositions
:
SparseArray
<
Int
>
=
SparseArray
()
/**
* Handle changes on the list
...
...
@@ -133,13 +135,15 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>(), SwipeRef
viewPager
.
adapter
=
audioPagerAdapter
val
tabPosition
=
settings
.
getInt
(
KEY_AUDIO_CURRENT_TAB
,
0
)
currentTab
=
tabPosition
val
positions
=
savedInstanceState
?.
getIntegerArrayList
(
KEY_LISTS_POSITIONS
)
val
position
=
savedInstanceState
?.
getIntegerArrayList
(
KEY_LISTS_POSITIONS
)
position
?.
withIndex
()
?.
forEach
{
restorePositions
.
put
(
it
.
index
,
it
.
value
)
}
for
(
i
in
0
until
MODE_TOTAL
)
{
setupLayoutManager
(
i
)
(
lists
[
i
].
layoutManager
as
LinearLayoutManager
).
recycleChildrenOnDetach
=
true
val
list
=
lists
[
i
]
list
.
adapter
=
adapters
[
i
]
if
(
positions
!=
null
)
list
.
scrollToPosition
(
positions
[
i
])
list
.
addOnScrollListener
(
scrollListener
)
if
(
viewModel
.
providersInCard
[
i
])
{
val
lp
=
list
.
layoutParams
...
...
@@ -216,6 +220,10 @@ class AudioBrowserFragment : BaseAudioBrowser<AudioBrowserViewModel>(), SwipeRef
provider
.
pagedList
.
observe
(
this
,
Observer
{
items
->
@Suppress
(
"UNCHECKED_CAST"
)
if
(
items
!=
null
)
adapters
[
index
].
submitList
(
items
as
PagedList
<
MediaLibraryItem
>?)
restorePositions
.
get
(
index
)
?.
let
{
lists
[
index
].
scrollToPosition
(
it
)
restorePositions
.
delete
(
index
)
}
})
provider
.
loading
.
observe
(
this
,
Observer
{
loading
->
if
(
loading
==
null
||
currentTab
!=
index
)
return
@Observer
...
...
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