Search in sources :

Example 1 with RenameItemDialog

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

the class SubscriptionFragment method onContextItemSelected.

@Override
public boolean onContextItemSelected(MenuItem item) {
    NavDrawerData.DrawerItem drawerItem = subscriptionAdapter.getSelectedItem();
    if (drawerItem == null) {
        return false;
    }
    int itemId = item.getItemId();
    if (drawerItem.type == NavDrawerData.DrawerItem.Type.TAG && itemId == R.id.rename_folder_item) {
        new RenameItemDialog(getActivity(), drawerItem).show();
        return true;
    }
    Feed feed = ((NavDrawerData.FeedDrawerItem) drawerItem).feed;
    if (itemId == R.id.remove_all_new_flags_item) {
        displayConfirmationDialog(R.string.remove_all_new_flags_label, R.string.remove_all_new_flags_confirmation_msg, () -> DBWriter.removeFeedNewFlag(feed.getId()));
        return true;
    } else if (itemId == R.id.edit_tags) {
        TagSettingsDialog.newInstance(Collections.singletonList(feed.getPreferences())).show(getChildFragmentManager(), TagSettingsDialog.TAG);
        return true;
    } else if (itemId == R.id.rename_item) {
        new RenameItemDialog(getActivity(), feed).show();
        return true;
    } else if (itemId == R.id.remove_feed) {
        RemoveFeedDialog.show(getContext(), feed);
        return true;
    } else if (itemId == R.id.multi_select) {
        speedDialView.setVisibility(View.VISIBLE);
        return subscriptionAdapter.onContextItemSelected(item);
    }
    return super.onContextItemSelected(item);
}
Also used : RenameItemDialog(de.danoeh.antennapod.dialog.RenameItemDialog) NavDrawerData(de.danoeh.antennapod.core.storage.NavDrawerData) SuppressLint(android.annotation.SuppressLint) Feed(de.danoeh.antennapod.model.feed.Feed)

Example 2 with RenameItemDialog

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

the class FeedItemlistFragment method onMenuItemClick.

@Override
public boolean onMenuItemClick(MenuItem item) {
    if (feed == null) {
        ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.please_wait_for_data, Toast.LENGTH_LONG);
        return true;
    }
    boolean feedMenuHandled = FeedMenuHandler.onOptionsItemClicked(getActivity(), item, feed);
    if (feedMenuHandled) {
        return true;
    }
    final int itemId = item.getItemId();
    if (itemId == R.id.rename_item) {
        new RenameItemDialog(getActivity(), feed).show();
        return true;
    } else if (itemId == R.id.remove_feed) {
        ((MainActivity) getActivity()).loadFragment(EpisodesFragment.TAG, null);
        RemoveFeedDialog.show(getContext(), feed);
        return true;
    } else if (itemId == R.id.action_search) {
        ((MainActivity) getActivity()).loadChildFragment(SearchFragment.newInstance(feed.getId(), feed.getTitle()));
        return true;
    }
    return false;
}
Also used : RenameItemDialog(de.danoeh.antennapod.dialog.RenameItemDialog) MainActivity(de.danoeh.antennapod.activity.MainActivity)

Example 3 with RenameItemDialog

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

the class NavDrawerFragment method onFeedContextMenuClicked.

private boolean onFeedContextMenuClicked(Feed feed, MenuItem item) {
    final int itemId = item.getItemId();
    if (itemId == R.id.remove_all_new_flags_item) {
        ConfirmationDialog removeAllNewFlagsConfirmationDialog = new ConfirmationDialog(getContext(), R.string.remove_all_new_flags_label, R.string.remove_all_new_flags_confirmation_msg) {

            @Override
            public void onConfirmButtonPressed(DialogInterface dialog) {
                dialog.dismiss();
                DBWriter.removeFeedNewFlag(feed.getId());
            }
        };
        removeAllNewFlagsConfirmationDialog.createNewDialog().show();
        return true;
    } else if (itemId == R.id.edit_tags) {
        TagSettingsDialog.newInstance(Collections.singletonList(feed.getPreferences())).show(getChildFragmentManager(), TagSettingsDialog.TAG);
        return true;
    } else if (itemId == R.id.rename_item) {
        new RenameItemDialog(getActivity(), feed).show();
        return true;
    } else if (itemId == R.id.remove_feed) {
        ((MainActivity) getActivity()).loadFragment(EpisodesFragment.TAG, null);
        RemoveFeedDialog.show(getContext(), feed);
        return true;
    }
    return super.onContextItemSelected(item);
}
Also used : RenameItemDialog(de.danoeh.antennapod.dialog.RenameItemDialog) DialogInterface(android.content.DialogInterface) ConfirmationDialog(de.danoeh.antennapod.core.dialog.ConfirmationDialog)

Aggregations

RenameItemDialog (de.danoeh.antennapod.dialog.RenameItemDialog)3 SuppressLint (android.annotation.SuppressLint)1 DialogInterface (android.content.DialogInterface)1 MainActivity (de.danoeh.antennapod.activity.MainActivity)1 ConfirmationDialog (de.danoeh.antennapod.core.dialog.ConfirmationDialog)1 NavDrawerData (de.danoeh.antennapod.core.storage.NavDrawerData)1 Feed (de.danoeh.antennapod.model.feed.Feed)1