mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
fix: subscriptions feed scroll state reset after rotating phone
This commit is contained in:
parent
9318a2b277
commit
a96367139a
@ -1,6 +1,7 @@
|
|||||||
package com.github.libretube.ui.fragments
|
package com.github.libretube.ui.fragments
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup.MarginLayoutParams
|
import android.view.ViewGroup.MarginLayoutParams
|
||||||
@ -440,6 +441,13 @@ class SubscriptionsFragment : DynamicLayoutManagerFragment(R.layout.fragment_sub
|
|||||||
binding.toggleSubs.text = "${getString(R.string.subscriptions)} ($subCount)"
|
binding.toggleSubs.text = "${getString(R.string.subscriptions)} ($subCount)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
|
super.onConfigurationChanged(newConfig)
|
||||||
|
// manually restore the recyclerview state after rotation due to https://github.com/material-components/material-components-android/issues/3473
|
||||||
|
binding.subChannels.layoutManager?.onRestoreInstanceState(viewModel.subChannelsRecyclerViewState)
|
||||||
|
binding.subFeed.layoutManager?.onRestoreInstanceState(viewModel.subFeedRecyclerViewState)
|
||||||
|
}
|
||||||
|
|
||||||
fun removeItem(videoId: String) {
|
fun removeItem(videoId: String) {
|
||||||
feedAdapter.removeItemById(videoId)
|
feedAdapter.removeItemById(videoId)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user