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


Java FileDownloadStatus.connected方法代码示例

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


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

示例1: updateDownloading

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

    switch (status) {
        case FileDownloadStatus.pending:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_pending);
            break;
        case FileDownloadStatus.started:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_started);
            break;
        case FileDownloadStatus.connected:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_connected);
            break;
        case FileDownloadStatus.progress:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_progress);
            break;
        default:
      //      taskStatusTv.setText(MyApplication.CONTEXT.getString(
       //             R.string.tasks_manager_demo_status_downloading, status));
            break;
    }

  //  taskActionBtn.setText(R.string.pause);
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:28,代码来源:DownMusicAdapter.java

示例2: updateDownloading

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

    switch (status) {
        case FileDownloadStatus.pending:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_pending);
            break;
        case FileDownloadStatus.started:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_started);
            break;
        case FileDownloadStatus.connected:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_connected);
            break;
        case FileDownloadStatus.progress:
            taskStatusTv.setText(R.string.tasks_manager_demo_status_progress);
            break;
        default:
            taskStatusTv.setText(DemoApplication.CONTEXT.getString(
                    R.string.tasks_manager_demo_status_downloading, status));
            break;
    }

    taskActionBtn.setText(R.string.pause);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:TasksManagerDemoActivity.java

示例3: updateSameFilePathTaskRunning

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public boolean updateSameFilePathTaskRunning(MessageSnapshot snapshot) {
    if (!mTask.getRunningTask().getOrigin().isPathAsDirectory()) {
        return false;
    }

    if (snapshot.getStatus() != FileDownloadStatus.warn ||
            getStatus() != FileDownloadStatus.connected) {
        return false;
    }

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

示例4: onBindViewHolder

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(TaskItemViewHolder holder, int position) {
    final TasksManagerModel model = TasksManager.getImpl().get(position);

    holder.update(model.getId(), position);
    holder.taskActionBtn.setTag(holder);
    holder.taskNameTv.setText(model.getName());

    TasksManager.getImpl()
            .updateViewHolder(holder.id, holder);

    holder.taskActionBtn.setEnabled(true);


    if (TasksManager.getImpl().isReady()) {
        final int status = TasksManager.getImpl().getStatus(model.getId(), model.getPath());
        if (status == FileDownloadStatus.pending || status == FileDownloadStatus.started ||
                status == FileDownloadStatus.connected) {
            // start task, but file not created yet
            holder.updateDownloading(status, TasksManager.getImpl().getSoFar(model.getId())
                    , TasksManager.getImpl().getTotal(model.getId()));
        } else if (!new File(model.getPath()).exists() &&
                !new File(FileDownloadUtils.getTempPath(model.getPath())).exists()) {
            // not exist file
            holder.updateNotDownloaded(status, 0, 0);
        } else if (TasksManager.getImpl().isDownloaded(status)) {
            // already downloaded and exist
            holder.updateDownloaded();
        } else if (status == FileDownloadStatus.progress) {
            // downloading
            holder.updateDownloading(status, TasksManager.getImpl().getSoFar(model.getId())
                    , TasksManager.getImpl().getTotal(model.getId()));
        } else {
            // not start
            holder.updateNotDownloaded(status, TasksManager.getImpl().getSoFar(model.getId())
                    , TasksManager.getImpl().getTotal(model.getId()));
        }
    } else {
        holder.taskStatusTv.setText(R.string.tasks_manager_demo_status_loading);
        holder.taskActionBtn.setEnabled(false);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:TasksManagerDemoActivity.java

示例5: createFromParcel

import com.liulishuo.filedownloader.model.FileDownloadStatus; //导入方法依赖的package包/类
@Override
public MessageSnapshot createFromParcel(Parcel source) {
    boolean largeFile = source.readByte() == 1;
    byte status = source.readByte();
    final MessageSnapshot snapshot;
    switch (status) {
        case FileDownloadStatus.pending:
            if (largeFile) {
                snapshot = new LargeMessageSnapshot.PendingMessageSnapshot(source);
            } else {
                snapshot = new SmallMessageSnapshot.PendingMessageSnapshot(source);
            }
            break;
        case FileDownloadStatus.started:
            snapshot = new StartedMessageSnapshot(source);
            break;
        case FileDownloadStatus.connected:
            if (largeFile) {
                snapshot = new LargeMessageSnapshot.ConnectedMessageSnapshot(source);
            } else {
                snapshot = new SmallMessageSnapshot.ConnectedMessageSnapshot(source);
            }
            break;
        case FileDownloadStatus.progress:
            if (largeFile) {
                snapshot = new LargeMessageSnapshot.ProgressMessageSnapshot(source);
            } else {
                snapshot = new SmallMessageSnapshot.ProgressMessageSnapshot(source);
            }
            break;
        case FileDownloadStatus.retry:
            if (largeFile) {
                snapshot = new LargeMessageSnapshot.RetryMessageSnapshot(source);
            } else {
                snapshot = new SmallMessageSnapshot.RetryMessageSnapshot(source);
            }
            break;
        case FileDownloadStatus.error:
            if (largeFile) {
                snapshot = new LargeMessageSnapshot.ErrorMessageSnapshot(source);
            } else {
                snapshot = new SmallMessageSnapshot.ErrorMessageSnapshot(source);
            }
            break;
        case FileDownloadStatus.completed:
            if (largeFile) {
                snapshot = new LargeMessageSnapshot.CompletedSnapshot(source);
            } else {
                snapshot = new SmallMessageSnapshot.CompletedSnapshot(source);
            }
            break;
        case FileDownloadStatus.warn:
            if (largeFile) {
                snapshot = new LargeMessageSnapshot.WarnMessageSnapshot(source);
            } else {
                snapshot = new SmallMessageSnapshot.WarnMessageSnapshot(source);
            }
            break;
        default:
            snapshot = null;
    }

    if (snapshot != null) {
        snapshot.isLargeFile = largeFile;
    } else {
        throw new IllegalStateException("Can't restore the snapshot because unknown " +
                "status: " + status);
    }

    return snapshot;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:72,代码来源:MessageSnapshot.java

示例6: getStatus

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


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