Search in sources :

Example 1 with AbstractTorrentSearchResult

use of com.frostwire.search.torrent.AbstractTorrentSearchResult in project frostwire by frostwire.

the class SearchFragment method startTransfer.

private void startTransfer(final SearchResult sr, final String toastMessage) {
    Engine.instance().getVibrator().hapticFeedback();
    if (!(sr instanceof AbstractTorrentSearchResult || sr instanceof TorrentPromotionSearchResult) && ConfigurationManager.instance().getBoolean(Constants.PREF_KEY_GUI_SHOW_NEW_TRANSFER_DIALOG)) {
        if (sr instanceof FileSearchResult && !(sr instanceof YouTubeSearchResult)) {
            try {
                NewTransferDialog dlg = NewTransferDialog.newInstance((FileSearchResult) sr, false);
                dlg.show(getFragmentManager());
            } catch (IllegalStateException e) {
                // android.app.FragmentManagerImpl.checkStateLoss:1323 -> java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
                // just start the download then if the dialog crapped out.
                onDialogClick(NewTransferDialog.TAG, Dialog.BUTTON_POSITIVE);
            }
        } else if (sr instanceof YouTubeSearchResult) {
            startDownload(getActivity(), sr, toastMessage);
        }
    } else {
        if (isVisible()) {
            startDownload(getActivity(), sr, toastMessage);
        }
    }
    uxLogAction(sr);
}
Also used : FileSearchResult(com.frostwire.search.FileSearchResult) TorrentPromotionSearchResult(com.frostwire.frostclick.TorrentPromotionSearchResult) YouTubeSearchResult(com.frostwire.search.youtube.YouTubeSearchResult) AbstractTorrentSearchResult(com.frostwire.search.torrent.AbstractTorrentSearchResult) NewTransferDialog(com.frostwire.android.gui.dialogs.NewTransferDialog)

Example 2 with AbstractTorrentSearchResult

use of com.frostwire.search.torrent.AbstractTorrentSearchResult in project frostwire by frostwire.

the class SearchFragment method startDownload.

public static void startDownload(Context ctx, SearchResult sr, String message) {
    if (sr instanceof AbstractTorrentSearchResult) {
        UIUtils.showShortMessage(ctx, R.string.fetching_torrent_ellipsis);
    }
    StartDownloadTask task = new StartDownloadTask(ctx, sr, message);
    Tasks.executeParallel(task);
}
Also used : AbstractTorrentSearchResult(com.frostwire.search.torrent.AbstractTorrentSearchResult) StartDownloadTask(com.frostwire.android.gui.tasks.StartDownloadTask)

Aggregations

AbstractTorrentSearchResult (com.frostwire.search.torrent.AbstractTorrentSearchResult)2 NewTransferDialog (com.frostwire.android.gui.dialogs.NewTransferDialog)1 StartDownloadTask (com.frostwire.android.gui.tasks.StartDownloadTask)1 TorrentPromotionSearchResult (com.frostwire.frostclick.TorrentPromotionSearchResult)1 FileSearchResult (com.frostwire.search.FileSearchResult)1 YouTubeSearchResult (com.frostwire.search.youtube.YouTubeSearchResult)1