DataInitializer.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:Pioneer 作者:
@Subscribe @Keep
public void onAppInitializeRequest(AppInitializeRequestEvent event) {
    // 构造的时候无法执行注入, 推迟到需要的时候再注入
    initialize();

    File dbInCache = new File(cacheDir, "db/store.db");
    if (cacheDir != null && !dbInCache.exists()) {
        appBus.post(new AppInitializeReportEvent("正在缓存数据库"));
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            return;
        }
        if (IoUtils.ensureDirsExist(dbInCache.getParentFile())) {
            IoUtils.copyAssets(AppMain.app().getAssets(), Assets.STORE_DB, dbInCache);
        } else {
            Timber.w("Can't ensure cache dir");
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号