use of de.danoeh.antennapod.view.EmptyViewHandler in project AntennaPod by AntennaPod.
the class SubscriptionFragment method setupEmptyView.
private void setupEmptyView() {
emptyView = new EmptyViewHandler(getContext());
emptyView.setIcon(R.drawable.ic_folder);
emptyView.setTitle(R.string.no_subscriptions_head_label);
emptyView.setMessage(R.string.no_subscriptions_label);
emptyView.attachToRecyclerView(subscriptionRecycler);
}
use of de.danoeh.antennapod.view.EmptyViewHandler in project AntennaPod by AntennaPod.
the class SearchFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.search_fragment, container, false);
setupToolbar(layout.findViewById(R.id.toolbar));
progressBar = layout.findViewById(R.id.progressBar);
recyclerView = layout.findViewById(R.id.recyclerView);
recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
adapter = new EpisodeItemListAdapter((MainActivity) getActivity());
recyclerView.setAdapter(adapter);
RecyclerView recyclerViewFeeds = layout.findViewById(R.id.recyclerViewFeeds);
LinearLayoutManager layoutManagerFeeds = new LinearLayoutManager(getActivity());
layoutManagerFeeds.setOrientation(RecyclerView.HORIZONTAL);
recyclerViewFeeds.setLayoutManager(layoutManagerFeeds);
adapterFeeds = new FeedSearchResultAdapter((MainActivity) getActivity());
recyclerViewFeeds.setAdapter(adapterFeeds);
emptyViewHandler = new EmptyViewHandler(getContext());
emptyViewHandler.attachToRecyclerView(recyclerView);
emptyViewHandler.setIcon(R.drawable.ic_search);
emptyViewHandler.setTitle(R.string.search_status_no_results);
emptyViewHandler.setMessage(R.string.type_to_search);
EventBus.getDefault().register(this);
chip = layout.findViewById(R.id.feed_title_chip);
chip.setOnCloseIconClickListener(v -> {
getArguments().putLong(ARG_FEED, 0);
searchWithProgressBar();
});
chip.setVisibility((getArguments().getLong(ARG_FEED, 0) == 0) ? View.GONE : View.VISIBLE);
chip.setText(getArguments().getString(ARG_FEED_NAME, ""));
if (getArguments().getString(ARG_QUERY, null) != null) {
search();
}
searchView.setOnQueryTextFocusChangeListener((view, hasFocus) -> {
if (hasFocus) {
showInputMethod(view.findFocus());
}
});
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(recyclerView.getWindowToken(), 0);
}
}
});
return layout;
}
use of de.danoeh.antennapod.view.EmptyViewHandler in project AntennaPod by AntennaPod.
the class EpisodesListFragment method onCreateView.
@NonNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View root = inflater.inflate(R.layout.all_episodes_fragment, container, false);
txtvInformation = root.findViewById(R.id.txtvInformation);
recyclerView = root.findViewById(android.R.id.list);
recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
setupLoadMoreScrollListener();
RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh);
swipeRefreshLayout.setDistanceToTriggerSync(getResources().getInteger(R.integer.swipe_refresh_distance));
swipeRefreshLayout.setOnRefreshListener(() -> {
AutoUpdateManager.runImmediate(requireContext());
new Handler(Looper.getMainLooper()).postDelayed(() -> swipeRefreshLayout.setRefreshing(false), getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms));
});
progLoading = root.findViewById(R.id.progLoading);
progLoading.setVisibility(View.VISIBLE);
loadingMoreView = root.findViewById(R.id.loadingMore);
emptyView = new EmptyViewHandler(getContext());
emptyView.attachToRecyclerView(recyclerView);
emptyView.setIcon(R.drawable.ic_feed);
emptyView.setTitle(R.string.no_all_episodes_head_label);
emptyView.setMessage(R.string.no_all_episodes_label);
createRecycleAdapter(recyclerView, emptyView);
emptyView.hide();
return root;
}
use of de.danoeh.antennapod.view.EmptyViewHandler in project AntennaPod by AntennaPod.
the class DownloadLogFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// add padding
final ListView lv = getListView();
lv.setClipToPadding(false);
final int vertPadding = getResources().getDimensionPixelSize(R.dimen.list_vertical_padding);
lv.setPadding(0, vertPadding, 0, vertPadding);
setListShown(true);
EmptyViewHandler emptyView = new EmptyViewHandler(getActivity());
emptyView.setIcon(R.drawable.ic_download);
emptyView.setTitle(R.string.no_log_downloads_head_label);
emptyView.setMessage(R.string.no_log_downloads_label);
emptyView.attachToListView(getListView());
adapter = new DownloadLogAdapter(getActivity(), this);
setListAdapter(adapter);
EventBus.getDefault().register(this);
}
use of de.danoeh.antennapod.view.EmptyViewHandler in project AntennaPod by AntennaPod.
the class PlaybackHistoryFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.simple_list_fragment, container, false);
toolbar = root.findViewById(R.id.toolbar);
toolbar.setTitle(R.string.playback_history_label);
toolbar.setOnMenuItemClickListener(this);
displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0;
if (savedInstanceState != null) {
displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW);
}
((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow);
toolbar.inflateMenu(R.menu.playback_history);
refreshToolbarState();
recyclerView = root.findViewById(R.id.recyclerView);
recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
adapter = new PlaybackHistoryListAdapter((MainActivity) getActivity());
recyclerView.setAdapter(adapter);
progressBar = root.findViewById(R.id.progLoading);
emptyView = new EmptyViewHandler(getActivity());
emptyView.setIcon(R.drawable.ic_history);
emptyView.setTitle(R.string.no_history_head_label);
emptyView.setMessage(R.string.no_history_label);
emptyView.attachToRecyclerView(recyclerView);
return root;
}
Aggregations