Merge pull request #6246 from ByteHamster/revert-loading-dummy
Revert back to showing progress bars while loading
This commit is contained in:
commit
fbfd7c43ac
|
@ -41,7 +41,6 @@ public class EpisodeItemListAdapter extends SelectableAdapter<EpisodeItemViewHol
|
||||||
private FeedItem longPressedItem;
|
private FeedItem longPressedItem;
|
||||||
int longPressedPosition = 0; // used to init actionMode
|
int longPressedPosition = 0; // used to init actionMode
|
||||||
private int dummyViews = 0;
|
private int dummyViews = 0;
|
||||||
private boolean wasEverUpdated = false;
|
|
||||||
|
|
||||||
public EpisodeItemListAdapter(MainActivity mainActivity) {
|
public EpisodeItemListAdapter(MainActivity mainActivity) {
|
||||||
super(mainActivity);
|
super(mainActivity);
|
||||||
|
@ -54,15 +53,8 @@ public class EpisodeItemListAdapter extends SelectableAdapter<EpisodeItemViewHol
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDummyViewsIfNeverUpdated(int dummyViews) {
|
|
||||||
if (!wasEverUpdated) {
|
|
||||||
setDummyViews(dummyViews);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateItems(List<FeedItem> items) {
|
public void updateItems(List<FeedItem> items) {
|
||||||
episodes = items;
|
episodes = items;
|
||||||
wasEverUpdated = true;
|
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,6 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
|
||||||
private List<NavDrawerData.DrawerItem> listItems;
|
private List<NavDrawerData.DrawerItem> listItems;
|
||||||
private NavDrawerData.DrawerItem selectedItem = null;
|
private NavDrawerData.DrawerItem selectedItem = null;
|
||||||
int longPressedPosition = 0; // used to init actionMode
|
int longPressedPosition = 0; // used to init actionMode
|
||||||
private int dummyViews = 0;
|
|
||||||
private boolean wasEverUpdated = false;
|
|
||||||
|
|
||||||
public SubscriptionsRecyclerAdapter(MainActivity mainActivity) {
|
public SubscriptionsRecyclerAdapter(MainActivity mainActivity) {
|
||||||
super(mainActivity);
|
super(mainActivity);
|
||||||
|
@ -97,11 +95,6 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull SubscriptionViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull SubscriptionViewHolder holder, int position) {
|
||||||
if (position >= listItems.size()) {
|
|
||||||
holder.selectView.setVisibility(View.GONE);
|
|
||||||
holder.bindDummy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
NavDrawerData.DrawerItem drawerItem = listItems.get(position);
|
NavDrawerData.DrawerItem drawerItem = listItems.get(position);
|
||||||
boolean isFeed = drawerItem.type == NavDrawerData.DrawerItem.Type.FEED;
|
boolean isFeed = drawerItem.type == NavDrawerData.DrawerItem.Type.FEED;
|
||||||
holder.bind(drawerItem);
|
holder.bind(drawerItem);
|
||||||
|
@ -164,7 +157,7 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return listItems.size() + dummyViews;
|
return listItems.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,20 +205,8 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDummyViews(int dummyViews) {
|
|
||||||
this.dummyViews = dummyViews;
|
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showDummyViewsIfNeverUpdated(int dummyViews) {
|
|
||||||
if (!wasEverUpdated) {
|
|
||||||
setDummyViews(dummyViews);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItems(List<NavDrawerData.DrawerItem> listItems) {
|
public void setItems(List<NavDrawerData.DrawerItem> listItems) {
|
||||||
this.listItems = listItems;
|
this.listItems = listItems;
|
||||||
wasEverUpdated = true;
|
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,17 +274,6 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
|
||||||
.load();
|
.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindDummy() {
|
|
||||||
feedTitle.setText("███████");
|
|
||||||
feedTitle.setVisibility(View.VISIBLE);
|
|
||||||
count.setVisibility(View.GONE);
|
|
||||||
new CoverLoader(mainActivityRef.get())
|
|
||||||
.withResource(android.R.color.transparent)
|
|
||||||
.withPlaceholderView(feedTitle, false)
|
|
||||||
.withCoverView(imageView)
|
|
||||||
.load();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float convertDpToPixel(Context context, float dp) {
|
public static float convertDpToPixel(Context context, float dp) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.danoeh.antennapod.fragment;
|
package de.danoeh.antennapod.fragment;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -8,6 +7,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import com.google.android.material.appbar.MaterialToolbar;
|
import com.google.android.material.appbar.MaterialToolbar;
|
||||||
|
@ -58,7 +58,6 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
public static final String TAG = "DownloadsFragment";
|
public static final String TAG = "DownloadsFragment";
|
||||||
public static final String ARG_SHOW_LOGS = "show_logs";
|
public static final String ARG_SHOW_LOGS = "show_logs";
|
||||||
private static final String KEY_UP_ARROW = "up_arrow";
|
private static final String KEY_UP_ARROW = "up_arrow";
|
||||||
private static final String PREF_PREVIOUS_EPISODE_COUNT = "episodeCount";
|
|
||||||
|
|
||||||
private long[] runningDownloads = new long[0];
|
private long[] runningDownloads = new long[0];
|
||||||
private List<FeedItem> items = new ArrayList<>();
|
private List<FeedItem> items = new ArrayList<>();
|
||||||
|
@ -69,6 +68,7 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
private boolean displayUpArrow;
|
private boolean displayUpArrow;
|
||||||
private SpeedDialView speedDialView;
|
private SpeedDialView speedDialView;
|
||||||
private SwipeActions swipeActions;
|
private SwipeActions swipeActions;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
|
@ -93,14 +93,14 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
|
recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
|
||||||
adapter = new CompletedDownloadsListAdapter((MainActivity) getActivity());
|
adapter = new CompletedDownloadsListAdapter((MainActivity) getActivity());
|
||||||
adapter.setOnSelectModeListener(this);
|
adapter.setOnSelectModeListener(this);
|
||||||
int previousEpisodesCount = getContext().getSharedPreferences(TAG, Context.MODE_PRIVATE)
|
|
||||||
.getInt(PREF_PREVIOUS_EPISODE_COUNT, 5);
|
|
||||||
recyclerView.postDelayed(() -> adapter.showDummyViewsIfNeverUpdated(previousEpisodesCount), 250);
|
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
recyclerView.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar)));
|
recyclerView.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar)));
|
||||||
swipeActions = new SwipeActions(this, TAG).attachTo(recyclerView);
|
swipeActions = new SwipeActions(this, TAG).attachTo(recyclerView);
|
||||||
swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.DOWNLOADED));
|
swipeActions.setFilter(new FeedItemFilter(FeedItemFilter.DOWNLOADED));
|
||||||
|
|
||||||
|
progressBar = root.findViewById(R.id.progLoading);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
speedDialView = root.findViewById(R.id.fabSD);
|
speedDialView = root.findViewById(R.id.fabSD);
|
||||||
speedDialView.setOverlayLayout(root.findViewById(R.id.fabSDOverlay));
|
speedDialView.setOverlayLayout(root.findViewById(R.id.fabSDOverlay));
|
||||||
speedDialView.inflate(R.menu.episodes_apply_action_speeddial);
|
speedDialView.inflate(R.menu.episodes_apply_action_speeddial);
|
||||||
|
@ -164,9 +164,6 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
if (disposable != null) {
|
if (disposable != null) {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
}
|
}
|
||||||
getContext().getSharedPreferences(TAG, Context.MODE_PRIVATE).edit()
|
|
||||||
.putInt(PREF_PREVIOUS_EPISODE_COUNT, adapter.getItemCount())
|
|
||||||
.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -303,6 +300,7 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
result -> {
|
result -> {
|
||||||
items = result;
|
items = result;
|
||||||
adapter.setDummyViews(0);
|
adapter.setDummyViews(0);
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
adapter.updateItems(result);
|
adapter.updateItems(result);
|
||||||
}, error -> {
|
}, error -> {
|
||||||
adapter.setDummyViews(0);
|
adapter.setDummyViews(0);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.danoeh.antennapod.fragment;
|
package de.danoeh.antennapod.fragment;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -12,6 +11,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
@ -68,7 +68,6 @@ public abstract class EpisodesListFragment extends Fragment
|
||||||
implements EpisodeItemListAdapter.OnSelectModeListener, Toolbar.OnMenuItemClickListener {
|
implements EpisodeItemListAdapter.OnSelectModeListener, Toolbar.OnMenuItemClickListener {
|
||||||
public static final String TAG = "EpisodesListFragment";
|
public static final String TAG = "EpisodesListFragment";
|
||||||
private static final String KEY_UP_ARROW = "up_arrow";
|
private static final String KEY_UP_ARROW = "up_arrow";
|
||||||
private static final String PREF_PREVIOUS_EPISODE_COUNT = "episodeCount";
|
|
||||||
protected static final int EPISODES_PER_PAGE = 150;
|
protected static final int EPISODES_PER_PAGE = 150;
|
||||||
protected int page = 1;
|
protected int page = 1;
|
||||||
protected boolean isLoadingMore = false;
|
protected boolean isLoadingMore = false;
|
||||||
|
@ -81,6 +80,7 @@ public abstract class EpisodesListFragment extends Fragment
|
||||||
SpeedDialView speedDialView;
|
SpeedDialView speedDialView;
|
||||||
MaterialToolbar toolbar;
|
MaterialToolbar toolbar;
|
||||||
SwipeActions swipeActions;
|
SwipeActions swipeActions;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
List<FeedItem> episodes = new ArrayList<>();
|
List<FeedItem> episodes = new ArrayList<>();
|
||||||
|
@ -115,9 +115,6 @@ public abstract class EpisodesListFragment extends Fragment
|
||||||
if (disposable != null) {
|
if (disposable != null) {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
}
|
}
|
||||||
getContext().getSharedPreferences(getPrefName(), Context.MODE_PRIVATE).edit()
|
|
||||||
.putInt(PREF_PREVIOUS_EPISODE_COUNT, episodes.size())
|
|
||||||
.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -204,10 +201,9 @@ public abstract class EpisodesListFragment extends Fragment
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
listAdapter.setOnSelectModeListener(this);
|
listAdapter.setOnSelectModeListener(this);
|
||||||
int previousEpisodesCount = getContext().getSharedPreferences(getPrefName(), Context.MODE_PRIVATE)
|
|
||||||
.getInt(PREF_PREVIOUS_EPISODE_COUNT, 5);
|
|
||||||
recyclerView.postDelayed(() -> listAdapter.showDummyViewsIfNeverUpdated(previousEpisodesCount), 250);
|
|
||||||
recyclerView.setAdapter(listAdapter);
|
recyclerView.setAdapter(listAdapter);
|
||||||
|
progressBar = root.findViewById(R.id.progressBar);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
emptyView = new EmptyViewHandler(getContext());
|
emptyView = new EmptyViewHandler(getContext());
|
||||||
emptyView.attachToRecyclerView(recyclerView);
|
emptyView.attachToRecyclerView(recyclerView);
|
||||||
|
@ -432,6 +428,7 @@ public abstract class EpisodesListFragment extends Fragment
|
||||||
data -> {
|
data -> {
|
||||||
episodes = data.first;
|
episodes = data.first;
|
||||||
hasMoreItems = !(page == 1 && episodes.size() < EPISODES_PER_PAGE);
|
hasMoreItems = !(page == 1 && episodes.size() < EPISODES_PER_PAGE);
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
listAdapter.setDummyViews(0);
|
listAdapter.setDummyViews(0);
|
||||||
listAdapter.updateItems(episodes);
|
listAdapter.updateItems(episodes);
|
||||||
listAdapter.setTotalNumberOfItems(data.second);
|
listAdapter.setTotalNumberOfItems(data.second);
|
||||||
|
|
|
@ -144,9 +144,9 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
viewBinding.recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
|
viewBinding.recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
|
||||||
adapter = new FeedItemListAdapter((MainActivity) getActivity());
|
adapter = new FeedItemListAdapter((MainActivity) getActivity());
|
||||||
adapter.setOnSelectModeListener(this);
|
adapter.setOnSelectModeListener(this);
|
||||||
viewBinding.recyclerView.postDelayed(() -> adapter.showDummyViewsIfNeverUpdated(10), 250);
|
|
||||||
viewBinding.recyclerView.setAdapter(adapter);
|
viewBinding.recyclerView.setAdapter(adapter);
|
||||||
swipeActions = new SwipeActions(this, TAG).attachTo(viewBinding.recyclerView);
|
swipeActions = new SwipeActions(this, TAG).attachTo(viewBinding.recyclerView);
|
||||||
|
viewBinding.progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
ToolbarIconTintManager iconTintManager = new ToolbarIconTintManager(
|
ToolbarIconTintManager iconTintManager = new ToolbarIconTintManager(
|
||||||
getContext(), viewBinding.toolbar, viewBinding.collapsingToolbar) {
|
getContext(), viewBinding.toolbar, viewBinding.collapsingToolbar) {
|
||||||
|
@ -530,6 +530,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
feed = result;
|
feed = result;
|
||||||
swipeActions.setFilter(feed.getItemFilter());
|
swipeActions.setFilter(feed.getItemFilter());
|
||||||
refreshHeaderView();
|
refreshHeaderView();
|
||||||
|
viewBinding.progressBar.setVisibility(View.GONE);
|
||||||
adapter.setDummyViews(0);
|
adapter.setDummyViews(0);
|
||||||
adapter.updateItems(feed.getItems());
|
adapter.updateItems(feed.getItems());
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
@ -86,13 +87,13 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
|
|
||||||
private static final String PREFS = "QueueFragment";
|
private static final String PREFS = "QueueFragment";
|
||||||
private static final String PREF_SHOW_LOCK_WARNING = "show_lock_warning";
|
private static final String PREF_SHOW_LOCK_WARNING = "show_lock_warning";
|
||||||
private static final String PREF_PREVIOUS_EPISODE_COUNT = "episodeCount";
|
|
||||||
|
|
||||||
private Disposable disposable;
|
private Disposable disposable;
|
||||||
private SwipeActions swipeActions;
|
private SwipeActions swipeActions;
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
private SpeedDialView speedDialView;
|
private SpeedDialView speedDialView;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -124,7 +125,6 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
if (disposable != null) {
|
if (disposable != null) {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
}
|
}
|
||||||
prefs.edit().putInt(PREF_PREVIOUS_EPISODE_COUNT, queue == null ? 0 : queue.size()).apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
@ -445,6 +445,8 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow);
|
((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow);
|
||||||
toolbar.inflateMenu(R.menu.queue);
|
toolbar.inflateMenu(R.menu.queue);
|
||||||
refreshToolbarState();
|
refreshToolbarState();
|
||||||
|
progressBar = root.findViewById(R.id.progressBar);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
infoBar = root.findViewById(R.id.info_bar);
|
infoBar = root.findViewById(R.id.info_bar);
|
||||||
recyclerView = root.findViewById(R.id.recyclerView);
|
recyclerView = root.findViewById(R.id.recyclerView);
|
||||||
|
@ -468,8 +470,6 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
recyclerAdapter.setOnSelectModeListener(this);
|
recyclerAdapter.setOnSelectModeListener(this);
|
||||||
int previousEpisodes = Math.max(1, prefs.getInt(PREF_PREVIOUS_EPISODE_COUNT, 5));
|
|
||||||
recyclerView.postDelayed(() -> recyclerAdapter.showDummyViewsIfNeverUpdated(previousEpisodes), 250);
|
|
||||||
recyclerView.setAdapter(recyclerAdapter);
|
recyclerView.setAdapter(recyclerAdapter);
|
||||||
|
|
||||||
SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh);
|
SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh);
|
||||||
|
@ -559,6 +559,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(items -> {
|
.subscribe(items -> {
|
||||||
queue = items;
|
queue = items;
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
recyclerAdapter.setDummyViews(0);
|
recyclerAdapter.setDummyViews(0);
|
||||||
recyclerAdapter.updateItems(queue);
|
recyclerAdapter.updateItems(queue);
|
||||||
if (restoreScrollPosition) {
|
if (restoreScrollPosition) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -75,7 +76,6 @@ public class SubscriptionFragment extends Fragment
|
||||||
public static final String TAG = "SubscriptionFragment";
|
public static final String TAG = "SubscriptionFragment";
|
||||||
private static final String PREFS = "SubscriptionFragment";
|
private static final String PREFS = "SubscriptionFragment";
|
||||||
private static final String PREF_NUM_COLUMNS = "columns";
|
private static final String PREF_NUM_COLUMNS = "columns";
|
||||||
private static final String PREF_PREVIOUS_EPISODE_COUNT = "episodeCount";
|
|
||||||
private static final String KEY_UP_ARROW = "up_arrow";
|
private static final String KEY_UP_ARROW = "up_arrow";
|
||||||
private static final String ARGUMENT_FOLDER = "folder";
|
private static final String ARGUMENT_FOLDER = "folder";
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ public class SubscriptionFragment extends Fragment
|
||||||
private EmptyViewHandler emptyView;
|
private EmptyViewHandler emptyView;
|
||||||
private TextView feedsFilteredMsg;
|
private TextView feedsFilteredMsg;
|
||||||
private MaterialToolbar toolbar;
|
private MaterialToolbar toolbar;
|
||||||
|
private ProgressBar progressBar;
|
||||||
private String displayedFolder = null;
|
private String displayedFolder = null;
|
||||||
private boolean displayUpArrow;
|
private boolean displayUpArrow;
|
||||||
|
|
||||||
|
@ -161,11 +162,12 @@ public class SubscriptionFragment extends Fragment
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
subscriptionAdapter.setOnSelectModeListener(this);
|
subscriptionAdapter.setOnSelectModeListener(this);
|
||||||
int previousEpisodes = Math.max(1, prefs.getInt(PREF_PREVIOUS_EPISODE_COUNT, 5));
|
|
||||||
subscriptionRecycler.postDelayed(() -> subscriptionAdapter.showDummyViewsIfNeverUpdated(previousEpisodes), 250);
|
|
||||||
subscriptionRecycler.setAdapter(subscriptionAdapter);
|
subscriptionRecycler.setAdapter(subscriptionAdapter);
|
||||||
setupEmptyView();
|
setupEmptyView();
|
||||||
|
|
||||||
|
progressBar = root.findViewById(R.id.progressBar);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
FloatingActionButton subscriptionAddButton = root.findViewById(R.id.subscriptions_add);
|
FloatingActionButton subscriptionAddButton = root.findViewById(R.id.subscriptions_add);
|
||||||
subscriptionAddButton.setOnClickListener(view -> {
|
subscriptionAddButton.setOnClickListener(view -> {
|
||||||
if (getActivity() instanceof MainActivity) {
|
if (getActivity() instanceof MainActivity) {
|
||||||
|
@ -284,8 +286,6 @@ public class SubscriptionFragment extends Fragment
|
||||||
if (disposable != null) {
|
if (disposable != null) {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
}
|
}
|
||||||
prefs.edit().putInt(PREF_PREVIOUS_EPISODE_COUNT, subscriptionAdapter.getItemCount()).apply();
|
|
||||||
|
|
||||||
if (subscriptionAdapter != null) {
|
if (subscriptionAdapter != null) {
|
||||||
subscriptionAdapter.endSelectMode();
|
subscriptionAdapter.endSelectMode();
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ public class SubscriptionFragment extends Fragment
|
||||||
subscriptionAdapter.endSelectMode();
|
subscriptionAdapter.endSelectMode();
|
||||||
}
|
}
|
||||||
listItems = result;
|
listItems = result;
|
||||||
subscriptionAdapter.setDummyViews(0);
|
progressBar.setVisibility(View.GONE);
|
||||||
subscriptionAdapter.setItems(result);
|
subscriptionAdapter.setItems(result);
|
||||||
emptyView.updateVisibility();
|
emptyView.updateVisibility();
|
||||||
}, error -> {
|
}, error -> {
|
||||||
|
|
|
@ -47,6 +47,16 @@
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:indeterminateOnly="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
tools:background="@android:color/holo_red_light" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/multi_select_speed_dial" />
|
layout="@layout/multi_select_speed_dial" />
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,14 @@
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:indeterminateOnly="true"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/more_content"
|
android:id="@+id/more_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -52,6 +52,14 @@
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:indeterminateOnly="true"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/subscriptions_add"
|
android:id="@+id/subscriptions_add"
|
||||||
android:layout_width="56dp"
|
android:layout_width="56dp"
|
||||||
|
|
|
@ -48,6 +48,14 @@
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:indeterminateOnly="true"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/multi_select_speed_dial" />
|
layout="@layout/multi_select_speed_dial" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue