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

pull/2309/head
Mauricio Colli 2019-10-10 10:31:43 -03:00
rodzic 8b87893248
commit f05b8c9542
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F200BFD6F29DDD85
1 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

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