当前位置: 首页>>代码示例>>Java>>正文


Java FileDownloadStatus.paused方法代码示例

本文整理汇总了Java中com.liulishuo.filedownloader.model.FileDownloadStatus.paused方法的典型用法代码示例。如果您正苦于以下问题:Java FileDownloadStatus.paused方法的具体用法?Java FileDownloadStatus.paused怎么用?Java FileDownloadStatus.paused使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liulishuo.filedownloader.model.FileDownloadStatus的用法示例。


在下文中一共展示了FileDownloadStatus.paused方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateNotDownloaded

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
public void updateNotDownloaded(final int status, final long sofar, final long total) {
    if (sofar > 0 && total > 0) {
        final float percent = sofar
                / (float) total;
        taskPb.setMax(100);
        taskPb.setProgress((int) (percent * 100));
    } else {
        taskPb.setMax(1);
        taskPb.setProgress(0);
    }

    switch (status) {
        case FileDownloadStatus.error:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_error);
            break;
        case FileDownloadStatus.paused:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_paused);
            break;
        default:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_not_downloaded);
            break;
    }
 //   taskActionBtn.setText(R.string.start);
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:25,代码来源:DownMusicAdapter.java

示例2: updateNotDownloaded

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
public void updateNotDownloaded(final int status, final long sofar, final long total) {
    if (sofar > 0 && total > 0) {
        final float percent = sofar
                / (float) total;
        taskPb.setMax(100);
        taskPb.setProgress((int) (percent * 100));
    } else {
        taskPb.setMax(1);
        taskPb.setProgress(0);
    }

    switch (status) {
        case FileDownloadStatus.error:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_error);
            break;
        case FileDownloadStatus.paused:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_paused);
            break;
        default:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_not_downloaded);
            break;
    }
    taskActionBtn.setText(R.string.start);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:TasksManagerDemoActivity.java

示例3: onStatusChanged

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
private void onStatusChanged(final byte status) {
    // In current situation, it maybe invoke this method simultaneously between #onPause() and
    // others.
    if (status == FileDownloadStatus.paused) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * Already paused or the current status is paused.
             *
             * We don't need to call-back to Task in here, because the pause status has
             * already handled by {@link BaseDownloadTask#pause()} manually.
             *
             * In some case, it will arrive here by High concurrent cause.  For performance
             * more make sense.
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, Already paused and we don't " +
                    "need to call-back to Task in here, %d", model.getId());
        }
        return;
    }

    MessageSnapshotFlow.getImpl().inflow(
            MessageSnapshotTaker.take(status, model, processParams));
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:26,代码来源:DownloadStatusCallback.java

示例4: onStatusChanged

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
private void onStatusChanged(final byte status) {
    // In current situation, it maybe invoke this method simultaneously between #onPause() and
    // others.
    if (model.getStatus() == FileDownloadStatus.paused) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * Already paused or the current status is paused.
             *
             * We don't need to call-back to Task in here, because the pause status has
             * already handled by {@link BaseDownloadTask#pause()} manually.
             *
             * In some case, it will arrive here by High concurrent cause.  For performance
             * more make sense.
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, Already paused and we don't " +
                    "need to call-back to Task in here, %d", model.getId());
        }
        return;
    }

    MessageSnapshotFlow.getImpl().inflow(MessageSnapshotTaker.take(status, model, processParams));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:DownloadStatusCallback.java

示例5: updateKeepFlow

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public boolean updateKeepFlow(MessageSnapshot snapshot) {
    final int currentStatus = getStatus();
    final int nextStatus = snapshot.getStatus();

    if (FileDownloadStatus.paused == currentStatus && FileDownloadStatus.isIng(nextStatus)) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * Occur such situation, must be the running-mStatus waiting for turning up in flow
             * thread pool(or binder thread) when there is someone invoked the {@link #pause()} .
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, callback pending, but has already" +
                    " be paused %d", getId());
        }
        return true;
    }

    if (!FileDownloadStatus.isKeepFlow(currentStatus, nextStatus)) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "can't update mStatus change by keep flow, %d, but the" +
                    " current mStatus is %d, %d", mStatus, getStatus(), getId());
        }

        return false;
    }

    update(snapshot);
    return true;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:32,代码来源:DownloadTaskHunter.java

示例6: handleMessage

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public boolean handleMessage(Message msg) {
    final int status = msg.what;

    switch (status) {
        case FileDownloadStatus.progress:
            handleProgress(SystemClock.elapsedRealtime(), true);
            break;
        case FileDownloadStatus.completed:
            if (interceptBeforeCompleted()) {
                return true;
            }

            try {
                handleCompleted();
            } catch (IOException e) {
                onError(e);
                return true;
            }
            break;
        case FileDownloadStatus.retry:
            handleRetry((Exception) msg.obj, msg.arg1);
            break;
        case FileDownloadStatus.paused:
            handlePaused();
            break;
        case FileDownloadStatus.error:
            handleError((Exception) msg.obj);
            break;
    }

    if (FileDownloadStatus.isOver(status)) {
        handlerThread.quit();
    }

    return true;
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:38,代码来源:DownloadStatusCallback.java

示例7: show

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public void show(boolean statusChanged, int status, boolean isShowProgress) {

    String desc = getDesc();
    switch (status) {
        case FileDownloadStatus.pending:
            desc += " pending";
            break;
        case FileDownloadStatus.started:
            desc += " started";
            break;
        case FileDownloadStatus.progress:
            desc += " progress";
            break;
        case FileDownloadStatus.retry:
            desc += " retry";
            break;
        case FileDownloadStatus.error:
            desc += " error";
            break;
        case FileDownloadStatus.paused:
            desc += " paused";
            break;
        case FileDownloadStatus.completed:
            desc += " completed";
            break;
        case FileDownloadStatus.warn:
            desc += " warn";
            break;
    }

    builder.setContentTitle(getTitle())
            .setContentText(desc);


    if (statusChanged) {
        builder.setTicker(desc);
    }

    builder.setProgress(getTotal(), getSofar(), !isShowProgress);
    getManager().notify(getId(), builder.build());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:NotificationMinSetActivity.java

示例8: getStatus

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public byte getStatus() {
    return FileDownloadStatus.paused;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:SmallMessageSnapshot.java

示例9: pause

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public boolean pause() {
    if (FileDownloadStatus.isOver(getStatus())) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * The over-mStatus call-backed and set the over-mStatus to this task between here
             * area and remove from the {@link FileDownloadList}.
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, Already is over, can't pause " +
                    "again, %d %d", getStatus(), mTask.getRunningTask().getOrigin().getId());
        }
        return false;
    }
    this.mStatus = FileDownloadStatus.paused;

    final BaseDownloadTask.IRunningTask runningTask = mTask.getRunningTask();
    final BaseDownloadTask origin = runningTask.getOrigin();

    FileDownloadTaskLauncher.getImpl().expire(this);
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "the task[%d] has been expired from the launch pool.", getId());
    }

    if (!FileDownloader.getImpl().isServiceConnected()) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "request pause the task[%d] to the download service, but" +
                    " the download service isn't connected yet.", origin.getId());
        }
    } else {
        FileDownloadServiceProxy.getImpl().pause(origin.getId());
    }

    // For make sure already added event mListener for receive paused event
    FileDownloadList.getImpl().add(runningTask);
    FileDownloadList.getImpl().remove(runningTask, MessageSnapshotTaker.catchPause(origin));

    FileDownloader.getImpl().getLostConnectedHandler().taskWorkFine(runningTask);

    return true;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:43,代码来源:DownloadTaskHunter.java

示例10: remove

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
/**
 * @param willRemoveDownload will be remove
 */
public boolean remove(final BaseDownloadTask.IRunningTask willRemoveDownload,
                      MessageSnapshot snapshot) {
    final byte removeByStatus = snapshot.getStatus();
    boolean succeed;
    synchronized (mList) {
        succeed = mList.remove(willRemoveDownload);
    }
    if (FileDownloadLog.NEED_LOG) {
        if (mList.size() == 0) {
            FileDownloadLog.v(this, "remove %s left %d %d",
                    willRemoveDownload, removeByStatus, mList.size());
        }
    }

    if (succeed) {
        final IFileDownloadMessenger messenger = willRemoveDownload.getMessageHandler().
                getMessenger();
        // Notify 2 Listener
        switch (removeByStatus) {
            case FileDownloadStatus.warn:
                messenger.notifyWarn(snapshot);
                break;
            case FileDownloadStatus.error:
                messenger.notifyError(snapshot);
                break;
            case FileDownloadStatus.paused:
                messenger.notifyPaused(snapshot);
                break;
            case FileDownloadStatus.completed:
                messenger.notifyBlockComplete(MessageSnapshotTaker.takeBlockCompleted(snapshot));
                break;
        }

    } else {
        FileDownloadLog.e(this, "remove error, not exist: %s %d", willRemoveDownload,
                removeByStatus);
    }

    return succeed;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:44,代码来源:FileDownloadList.java


注:本文中的com.liulishuo.filedownloader.model.FileDownloadStatus.paused方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。