From f0358eb344ab3f0782f613861dca59d483f60b6f Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 19 Feb 2021 20:39:34 +0100 Subject: [PATCH] Don't flicker progress bar while refreshing --- .../fragment/SubscriptionFragment.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index 470d815c3..9bbc03fba 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -231,16 +231,19 @@ public class SubscriptionFragment extends Fragment implements Toolbar.OnMenuItem disposable.dispose(); } emptyView.hide(); - progressBar.setVisibility(View.VISIBLE); disposable = Observable.fromCallable(DBReader::getNavDrawerData) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(result -> { - navDrawerData = result; - subscriptionAdapter.notifyDataSetChanged(); - emptyView.updateVisibility(); - progressBar.setVisibility(View.GONE); - }, error -> Log.e(TAG, Log.getStackTraceString(error))); + .subscribe( + result -> { + navDrawerData = result; + subscriptionAdapter.notifyDataSetChanged(); + emptyView.updateVisibility(); + progressBar.setVisibility(View.GONE); // Keep hidden to avoid flickering while refreshing + }, error -> { + Log.e(TAG, Log.getStackTraceString(error)); + progressBar.setVisibility(View.GONE); + }); if (UserPreferences.getSubscriptionsFilter().isEnabled()) { feedsFilteredMsg.setText("{md-info-outline} " + getString(R.string.subscriptions_are_filtered));