我想要从Dropbox获取照片并将其加载到GridView中,并且我想在适配器中使用Picasso时出现问题。 方法负载()将采取可下载的URL,加载Dropbox与毕加索的照片?
PS:我使用升降梭箱的Android SDK 1.6.1
,如果我的方法使用的介质()和从收存箱那样的提取网址:
// 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);
}
}
它不是practicle在所有cuz它会采取这么多时间让每一个URL这是情景:
- 搜索图像在照片文件夹(1个请求)
- 使用[media] [1]获取直接URL(1 *(图像)请求)
- 在适配器中使用毕加索(1 *(图像)请求) 我将计数(图像)* 2 + 1请求计数
这很可怕,需要更好的解决方案。
PS:我想这https://medium.com/@jpardogo/requesthandler-api-for-picasso-library-c3ee7c4bec25#.wpmea1eci
但代码是不完整的有存在着一些类没有解决/和一些变量没有定义。
所以任何人都有一个关于如何使用pbox的dropbox图像API的想法。
您可能需要下载缩略图2个文件直接代替使用媒体链接:https://www.dropboxstatic.com/static/developers/dropbox-android-sdk-1.6.3-docs/com/dropbox/client2/DropboxAPI.html#getThumbnail(java.lang.String ,%20java.io.OutputStream,%20com.dropbox.client2.DropboxAPI.ThumbSize,%20com.dropbox.client2.DropboxAPI.ThumbFormat,%20com.dropbox.client2.ProgressListener) – Greg
@Greg方法加载毕加索不能下载输入流和drob pox下载取决于输入流。 – mhdjazmati