使用 Picasso 加载 Dropbox 照片?

Load Dropbox Photos With Picasso?

当我想从 Dropbox 获取我的照片并将其加载到 GridView 时遇到问题,我也想在适配器中使用 Picasso。 方法 load() 将采用可下载的 URL ,

PS:我正在使用 Dropbox Android SDK 1.6.1

如果我使用方法 media() 并像这样从保管箱中获取 url :

// Get the metadata for a directory , | request |
DropboxAPI.Entry dirent = Log_in.mApi.metadata(Log_in.APP_DIR + "/images/", 1000, null, true, null);
if (!dirent.isDir || dirent.contents == null) {
    // It's not a directory, or there's nothing in it
    mErrorMsg = "File or empty directory";
    //return false;
}

// Make a list of everything in it that we can get a thumbnail for
thumbs = new ArrayList<>();
imagePath = new ArrayList<>();
for (DropboxAPI.Entry ent : dirent.contents) {
    if (ent.thumbExists) {
        // Add it to the list of thumbs we can choose from
        thumbs.add(ent);
        // do another requests (many requests to dropbox to get the urls , and this is terrible it takes request time for each image !
            imagePath.add(Log_in.mApi.media(ent.path,true).url);
        }
    }

这根本不切实际,因为每个 url 都需要花费很多时间,这就是情况:

  1. 在照片文件夹中搜索图像(1 个请求)
  2. 使用 [媒体][1] 获得直接 URL(1 *(图像)请求)
  3. 在适配器中使用 Picasso(1 *(图像)请求) 我将有 count(images) * 2 + 1 个请求 count

太糟糕了,需要更好的解决方案。

PS :我试过这个 https://medium.com/@jpardogo/requesthandler-api-for-picasso-library-c3ee7c4bec25#.wpmea1eci

但代码不完整有一些 类 不是 resolved/exist 和一些未定义的变量。

所以任何人都知道如何使用 picasso 处理保管箱图像 api。

我认为 dropbox 中有关于此的示例,请尝试查看此 link dropbox sample

您需要查看 2 个文件 PicassoClient.java 和 FileThumbnailRequestHandler.java