1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-24 09:00:31 +00:00

Expand import/export options by default when subscriptions list is empty

This commit is contained in:
Mauricio Colli 2019-10-10 10:31:43 -03:00
parent 8b87893248
commit f05b8c9542
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85

View File

@ -57,7 +57,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
@State @JvmField var itemsListState: Parcelable? = null @State @JvmField var itemsListState: Parcelable? = null
@State @JvmField var feedGroupsListState: Parcelable? = null @State @JvmField var feedGroupsListState: Parcelable? = null
@State @JvmField var importExportItemExpandedState: Boolean = false @State @JvmField var importExportItemExpandedState: Boolean? = null
init { init {
setHasOptionsMenu(true) setHasOptionsMenu(true)
@ -221,7 +221,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
{ onImportPreviousSelected() }, { onImportPreviousSelected() },
{ onImportFromServiceSelected(it) }, { onImportFromServiceSelected(it) },
{ onExportSelected() }, { onExportSelected() },
importExportItemExpandedState) importExportItemExpandedState ?: false)
groupAdapter.add(Section(importExportItem, listOf(subscriptionsSection))) groupAdapter.add(Section(importExportItem, listOf(subscriptionsSection)))
} }
@ -307,6 +307,13 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
subscriptionsSection.update(result.subscriptions) subscriptionsSection.update(result.subscriptions)
subscriptionsSection.setHideWhenEmpty(false) subscriptionsSection.setHideWhenEmpty(false)
if (result.subscriptions.isEmpty() && importExportItemExpandedState == null) {
items_list.post {
importExportItem.isExpanded = true
importExportItem.notifyChanged(FeedImportExportItem.REFRESH_EXPANDED_STATUS)
}
}
if (itemsListState != null) { if (itemsListState != null) {
items_list.layoutManager?.onRestoreInstanceState(itemsListState) items_list.layoutManager?.onRestoreInstanceState(itemsListState)
itemsListState = null itemsListState = null