Search in sources :

Example 1 with EmptyViewHandler

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);
}
Also used : EmptyViewHandler(de.danoeh.antennapod.view.EmptyViewHandler)

Example 2 with EmptyViewHandler

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;
}
Also used : FeedSearchResultAdapter(de.danoeh.antennapod.adapter.FeedSearchResultAdapter) EmptyViewHandler(de.danoeh.antennapod.view.EmptyViewHandler) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) RecyclerView(androidx.recyclerview.widget.RecyclerView) InputMethodManager(android.view.inputmethod.InputMethodManager) MainActivity(de.danoeh.antennapod.activity.MainActivity) EpisodeItemListAdapter(de.danoeh.antennapod.adapter.EpisodeItemListAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(androidx.appcompat.widget.SearchView) Nullable(androidx.annotation.Nullable)

Example 3 with EmptyViewHandler

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;
}
Also used : SimpleItemAnimator(androidx.recyclerview.widget.SimpleItemAnimator) EmptyViewHandler(de.danoeh.antennapod.view.EmptyViewHandler) FeedItemMenuHandler(de.danoeh.antennapod.menuhandler.FeedItemMenuHandler) Handler(android.os.Handler) EmptyViewHandler(de.danoeh.antennapod.view.EmptyViewHandler) RecyclerView(androidx.recyclerview.widget.RecyclerView) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) NonNull(androidx.annotation.NonNull)

Example 4 with EmptyViewHandler

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);
}
Also used : ListView(android.widget.ListView) EmptyViewHandler(de.danoeh.antennapod.view.EmptyViewHandler) DownloadLogAdapter(de.danoeh.antennapod.adapter.DownloadLogAdapter)

Example 5 with EmptyViewHandler

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;
}
Also used : EmptyViewHandler(de.danoeh.antennapod.view.EmptyViewHandler) MainActivity(de.danoeh.antennapod.activity.MainActivity) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) View(android.view.View)

Aggregations

EmptyViewHandler (de.danoeh.antennapod.view.EmptyViewHandler)7 View (android.view.View)4 EpisodeItemListRecyclerView (de.danoeh.antennapod.view.EpisodeItemListRecyclerView)4 RecyclerView (androidx.recyclerview.widget.RecyclerView)3 MainActivity (de.danoeh.antennapod.activity.MainActivity)3 Handler (android.os.Handler)2 TextView (android.widget.TextView)2 SimpleItemAnimator (androidx.recyclerview.widget.SimpleItemAnimator)2 SwipeRefreshLayout (androidx.swiperefreshlayout.widget.SwipeRefreshLayout)2 FeedItemMenuHandler (de.danoeh.antennapod.menuhandler.FeedItemMenuHandler)2 InputMethodManager (android.view.inputmethod.InputMethodManager)1 ListView (android.widget.ListView)1 NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 SearchView (androidx.appcompat.widget.SearchView)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 SpeedDialView (com.leinardi.android.speeddial.SpeedDialView)1 DownloadLogAdapter (de.danoeh.antennapod.adapter.DownloadLogAdapter)1 EpisodeItemListAdapter (de.danoeh.antennapod.adapter.EpisodeItemListAdapter)1 FeedSearchResultAdapter (de.danoeh.antennapod.adapter.FeedSearchResultAdapter)1