Search in sources :

Example 1 with FilterDialog

use of de.danoeh.antennapod.dialog.FilterDialog in project AntennaPod by AntennaPod.

the class FeedItemlistFragment method refreshHeaderView.

private void refreshHeaderView() {
    setupHeaderView();
    if (recyclerView == null || feed == null) {
        Log.e(TAG, "Unable to refresh header view");
        return;
    }
    loadFeedImage();
    if (feed.hasLastUpdateFailed()) {
        txtvFailure.setVisibility(View.VISIBLE);
    } else {
        txtvFailure.setVisibility(View.GONE);
    }
    if (!feed.getPreferences().getKeepUpdated()) {
        txtvUpdatesDisabled.setText("{md-pause-circle-outline} " + this.getString(R.string.updates_disabled_label));
        Iconify.addIcons(txtvUpdatesDisabled);
        txtvUpdatesDisabled.setVisibility(View.VISIBLE);
    } else {
        txtvUpdatesDisabled.setVisibility(View.GONE);
    }
    txtvTitle.setText(feed.getTitle());
    txtvAuthor.setText(feed.getAuthor());
    if (feed.getItemFilter() != null) {
        FeedItemFilter filter = feed.getItemFilter();
        if (filter.getValues().length > 0) {
            txtvInformation.setText("{md-info-outline} " + this.getString(R.string.filtered_label));
            Iconify.addIcons(txtvInformation);
            txtvInformation.setOnClickListener((l) -> {
                FilterDialog filterDialog = new FilterDialog(requireContext(), feed.getItemFilter()) {

                    @Override
                    protected void updateFilter(Set<String> filterValues) {
                        feed.setItemFilter(filterValues.toArray(new String[0]));
                        DBWriter.setFeedItemsFilter(feed.getId(), filterValues);
                    }
                };
                filterDialog.openDialog();
            });
            txtvInformation.setVisibility(View.VISIBLE);
        } else {
            txtvInformation.setVisibility(View.GONE);
        }
    } else {
        txtvInformation.setVisibility(View.GONE);
    }
}
Also used : Set(java.util.Set) FeedItemFilter(de.danoeh.antennapod.model.feed.FeedItemFilter) FilterDialog(de.danoeh.antennapod.dialog.FilterDialog)

Example 2 with FilterDialog

use of de.danoeh.antennapod.dialog.FilterDialog in project AntennaPod by AntennaPod.

the class AllEpisodesFragment method showFilterDialog.

private void showFilterDialog() {
    FilterDialog filterDialog = new FilterDialog(getContext(), feedItemFilter) {

        @Override
        protected void updateFilter(Set<String> filterValues) {
            feedItemFilter = new FeedItemFilter(filterValues.toArray(new String[0]));
            SharedPreferences prefs = getActivity().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
            prefs.edit().putString(PREF_FILTER, StringUtils.join(filterValues, ",")).apply();
            loadItems();
        }
    };
    filterDialog.openDialog();
}
Also used : Set(java.util.Set) SharedPreferences(android.content.SharedPreferences) FeedItemFilter(de.danoeh.antennapod.model.feed.FeedItemFilter) FilterDialog(de.danoeh.antennapod.dialog.FilterDialog)

Example 3 with FilterDialog

use of de.danoeh.antennapod.dialog.FilterDialog in project AntennaPod by AntennaPod.

the class FeedMenuHandler method showFilterDialog.

private static void showFilterDialog(Context context, Feed selectedFeed) {
    FilterDialog filterDialog = new FilterDialog(context, selectedFeed.getItemFilter()) {

        @Override
        protected void updateFilter(Set<String> filterValues) {
            selectedFeed.setItemFilter(filterValues.toArray(new String[0]));
            DBWriter.setFeedItemsFilter(selectedFeed.getId(), filterValues);
        }
    };
    filterDialog.openDialog();
}
Also used : Set(java.util.Set) FilterDialog(de.danoeh.antennapod.dialog.FilterDialog)

Aggregations

FilterDialog (de.danoeh.antennapod.dialog.FilterDialog)3 Set (java.util.Set)3 FeedItemFilter (de.danoeh.antennapod.model.feed.FeedItemFilter)2 SharedPreferences (android.content.SharedPreferences)1