Search in sources :

Example 1 with InvalidTransfer

use of com.frostwire.android.gui.transfers.InvalidTransfer in project frostwire by frostwire.

the class StartDownloadTask method onPostExecute.

@Override
protected void onPostExecute(Context ctx, Transfer transfer) {
    if (transfer != null) {
        if (ctx instanceof Activity) {
            Offers.showInterstitialOfferIfNecessary((Activity) ctx, Offers.PLACEMENT_INTERSTITIAL_EXIT, false, false);
        }
        if (!(transfer instanceof InvalidTransfer)) {
            TransferManager tm = TransferManager.instance();
            if (tm.isBittorrentDownloadAndMobileDataSavingsOn(transfer)) {
                UIUtils.showLongMessage(ctx, R.string.torrent_transfer_enqueued_on_mobile_data);
                ((BittorrentDownload) transfer).pause();
            } else {
                if (tm.isBittorrentDownloadAndMobileDataSavingsOff(transfer)) {
                    UIUtils.showLongMessage(ctx, R.string.torrent_transfer_consuming_mobile_data);
                }
                if (message != null) {
                    UIUtils.showShortMessage(ctx, message);
                }
            }
            UIUtils.showTransfersOnDownloadStart(ctx);
        } else if (!(transfer instanceof ExistingDownload)) {
            UIUtils.showLongMessage(ctx, ((InvalidTransfer) transfer).getReasonResId());
        }
    }
}
Also used : TransferManager(com.frostwire.android.gui.transfers.TransferManager) ExistingDownload(com.frostwire.android.gui.transfers.ExistingDownload) BittorrentDownload(com.frostwire.transfers.BittorrentDownload) Activity(android.app.Activity) InvalidTransfer(com.frostwire.android.gui.transfers.InvalidTransfer)

Aggregations

Activity (android.app.Activity)1 ExistingDownload (com.frostwire.android.gui.transfers.ExistingDownload)1 InvalidTransfer (com.frostwire.android.gui.transfers.InvalidTransfer)1 TransferManager (com.frostwire.android.gui.transfers.TransferManager)1 BittorrentDownload (com.frostwire.transfers.BittorrentDownload)1