fix crash in NotificationsFragment (#1119)

* fix crash in NotificationsFragment

* don't reload notifications

* add updateAdapter()
This commit is contained in:
Konrad Pozniak 2019-03-13 09:32:59 +01:00 committed by GitHub
parent 5f390b378b
commit 08c1bbd253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View file

@ -47,6 +47,8 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
private lateinit var touchHelper: ItemTouchHelper
private lateinit var addTabAdapter: TabAdapter
private var tabsChanged = false
private val selectedItemElevation by lazy { resources.getDimension(R.dimen.selected_drag_item_elevation) }
override fun onCreate(savedInstanceState: Bundle?) {
@ -188,6 +190,7 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
.subscribe()
}
tabsChanged = true
}
override fun onBackPressed() {
@ -208,8 +211,10 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
override fun onPause() {
super.onPause()
if(tabsChanged) {
eventHub.dispatch(MainTabsChangedEvent(currentTabs))
}
}
companion object {
private const val MIN_TAB_COUNT = 2

View file

@ -207,14 +207,19 @@ public class NotificationsFragment extends SFragment implements
adapter.setUseAbsoluteTime(useAbsoluteTime);
recyclerView.setAdapter(adapter);
notifications.clear();
topLoading = false;
bottomLoading = false;
bottomId = null;
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
updateAdapter();
if (notifications.isEmpty()) {
sendFetchNotificationsRequest(null, null, FetchEnd.BOTTOM, -1);
} else {
progressBar.setVisibility(View.GONE);
}
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
return rootView;
}