Search in sources :

Example 1 with EpisodesApplyActionFragment

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

the class CompletedDownloadsFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.episode_actions:
            EpisodesApplyActionFragment fragment = EpisodesApplyActionFragment.newInstance(items, EpisodesApplyActionFragment.ACTION_REMOVE);
            ((MainActivity) getActivity()).loadChildFragment(fragment);
            return true;
        default:
            return false;
    }
}
Also used : EpisodesApplyActionFragment(de.danoeh.antennapod.dialog.EpisodesApplyActionFragment) MainActivity(de.danoeh.antennapod.activity.MainActivity)

Example 2 with EpisodesApplyActionFragment

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

the class ItemlistFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (!super.onOptionsItemSelected(item)) {
        try {
            if (!FeedMenuHandler.onOptionsItemClicked(getActivity(), item, feed)) {
                switch(item.getItemId()) {
                    case R.id.episode_actions:
                        EpisodesApplyActionFragment fragment = EpisodesApplyActionFragment.newInstance(feed.getItems());
                        ((MainActivity) getActivity()).loadChildFragment(fragment);
                        return true;
                    case R.id.rename_item:
                        new RenameFeedDialog(getActivity(), feed).show();
                        return true;
                    case R.id.remove_item:
                        final FeedRemover remover = new FeedRemover(getActivity(), feed) {

                            @Override
                            protected void onPostExecute(Void result) {
                                super.onPostExecute(result);
                                ((MainActivity) getActivity()).loadFragment(EpisodesFragment.TAG, null);
                            }
                        };
                        ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(), R.string.remove_feed_label, R.string.feed_delete_confirmation_msg) {

                            @Override
                            public void onConfirmButtonPressed(DialogInterface dialog) {
                                dialog.dismiss();
                                remover.executeAsync();
                            }
                        };
                        conDialog.createNewDialog().show();
                        return true;
                    default:
                        return false;
                }
            } else {
                return true;
            }
        } catch (DownloadRequestException e) {
            e.printStackTrace();
            DownloadRequestErrorDialogCreator.newRequestErrorDialog(getActivity(), e.getMessage());
            return true;
        }
    } else {
        return true;
    }
}
Also used : FeedRemover(de.danoeh.antennapod.core.asynctask.FeedRemover) DialogInterface(android.content.DialogInterface) RenameFeedDialog(de.danoeh.antennapod.dialog.RenameFeedDialog) EpisodesApplyActionFragment(de.danoeh.antennapod.dialog.EpisodesApplyActionFragment) MainActivity(de.danoeh.antennapod.activity.MainActivity) DownloadRequestException(de.danoeh.antennapod.core.storage.DownloadRequestException) ConfirmationDialog(de.danoeh.antennapod.core.dialog.ConfirmationDialog)

Aggregations

MainActivity (de.danoeh.antennapod.activity.MainActivity)2 EpisodesApplyActionFragment (de.danoeh.antennapod.dialog.EpisodesApplyActionFragment)2 DialogInterface (android.content.DialogInterface)1 FeedRemover (de.danoeh.antennapod.core.asynctask.FeedRemover)1 ConfirmationDialog (de.danoeh.antennapod.core.dialog.ConfirmationDialog)1 DownloadRequestException (de.danoeh.antennapod.core.storage.DownloadRequestException)1 RenameFeedDialog (de.danoeh.antennapod.dialog.RenameFeedDialog)1