Fixed header not updating after feed refresh

This commit is contained in:
ByteHamster 2020-03-20 19:02:46 +01:00
parent 4da4b0e1c2
commit 8e10b986b2
1 changed files with 3 additions and 4 deletions

View File

@ -407,7 +407,6 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onFeedListChanged(FeedListUpdateEvent event) { public void onFeedListChanged(FeedListUpdateEvent event) {
if (event.contains(feed)) { if (event.contains(feed)) {
refreshHeaderView();
updateUi(); updateUi();
} }
} }
@ -441,7 +440,8 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
} }
private void refreshHeaderView() { private void refreshHeaderView() {
if (recyclerView == null || feed == null || !headerCreated) { setupHeaderView();
if (recyclerView == null || feed == null) {
Log.e(TAG, "Unable to refresh header view"); Log.e(TAG, "Unable to refresh header view");
return; return;
} }
@ -487,7 +487,6 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
} }
}); });
headerCreated = true; headerCreated = true;
refreshHeaderView();
} }
private void showFeedInfo() { private void showFeedInfo() {
@ -528,7 +527,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> { .subscribe(result -> {
feed = result.orElse(null); feed = result.orElse(null);
setupHeaderView(); refreshHeaderView();
displayList(); displayList();
}, error -> Log.e(TAG, Log.getStackTraceString(error))); }, error -> Log.e(TAG, Log.getStackTraceString(error)));
} }