Search in sources :

Example 1 with SwipeActionsDialog

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

the class SwipePreferencesFragment method onCreatePreferences.

// private static final String PREF_SWIPE_INBOX = "prefSwipeInbox";
// private static final String PREF_SWIPE_EPISODES = "prefSwipeEpisodes";
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
    addPreferencesFromResource(R.xml.preferences_swipe);
    findPreference(PREF_SWIPE_FEED).setOnPreferenceClickListener(preference -> {
        new SwipeActionsDialog(requireContext(), FeedItemlistFragment.TAG).show(() -> {
        });
        return true;
    });
    findPreference(PREF_SWIPE_QUEUE).setOnPreferenceClickListener(preference -> {
        new SwipeActionsDialog(requireContext(), QueueFragment.TAG).show(() -> {
        });
        return true;
    });
}
Also used : SwipeActionsDialog(de.danoeh.antennapod.dialog.SwipeActionsDialog)

Example 2 with SwipeActionsDialog

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

the class SwipeActions method onSwiped.

@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int swipeDir) {
    if (!actions.hasActions()) {
        // open settings dialog if no prefs are set
        new SwipeActionsDialog(fragment.requireContext(), tag).show(this::reloadPreference);
        return;
    }
    FeedItem item = ((EpisodeItemViewHolder) viewHolder).getFeedItem();
    (swipeDir == ItemTouchHelper.RIGHT ? actions.right : actions.left).performAction(item, fragment, filter);
}
Also used : EpisodeItemViewHolder(de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder) FeedItem(de.danoeh.antennapod.model.feed.FeedItem) SwipeActionsDialog(de.danoeh.antennapod.dialog.SwipeActionsDialog)

Aggregations

SwipeActionsDialog (de.danoeh.antennapod.dialog.SwipeActionsDialog)2 FeedItem (de.danoeh.antennapod.model.feed.FeedItem)1 EpisodeItemViewHolder (de.danoeh.antennapod.view.viewholder.EpisodeItemViewHolder)1