Git Product home page Git Product logo

dynamic-ppt-download-android's Introduction

介绍

DynamicPptDownload 用于加载缓存动态Ppt资源,提升移动端动态Ppt体验。

集成

DynamicPptDownload 使用jitpack ,集成时需添加以下仓库依赖

allprojects {
    repositories {
        // Add jitpack repository
        maven { url 'https://jitpack.io' }
    }
}

添加依赖

dependencies {
    // Get the latest version number through the release notes.
    implementation 'com.github.netless-io:dynamic-ppt-download-android:1.0.0'
}

方式一、预加载

为保证首页加载体验,建议提前缓存Ppt资源

// 初始化
DownloadHelper helper = DownloadHelper.getInstance();
// 设置缓存文件夹
helper.setPPTCacheDir(getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath() + "/pptdownload");

// 启动下载任务
DownloadTask task = helper.newTask("a6f9d430d7c211ebae6f1dc0589306eb", "https://white-cn-doc-convert.oss-cn-hangzhou.aliyuncs.com");
task.start();

方式二、RoomState变更时调用

// 初始化
DownloadHelper helper = DownloadHelper.getInstance();
helper.setPPTCacheDir(getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath() + "/pptdownload");

// 加入房间成功后调用
DownloadHelper.updateRoomState(mRoom.getRoomState())

// room状态更新时
@Override
public void onRoomStateChanged(RoomState modifyState) {
    // ...other logic
    DownloadHelper.updateRoomState(modifyState);
}

WebViewClient拦截

缓存的资源需要用于请求拦截,具体拦截方式可参考 PptCacheWebViewClient

dynamic-ppt-download-android's People

Contributors

aderanfeng avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.