如何在GridView中最好地优化Picasso?(How do I best optimize Picasso in a GridView?)
我正在使用Picasso(2.5.2)通过适配器将本地
content://
图像加载到3列GridView
。Picasso .with(mContext) .load(mCameraImages.getUris().get(position)) .error(android.R.drawable.ic_dialog_alert) .fit() .centerCrop() .into(view);
在我的特定情况下,
mCameraImages
只是一个URI列表,来自本地mediaStore。我发现当我加载
GridView
,Picasso总是从磁盘(蓝色调试指示器)而不是内存中获取图像。这是预期的,但我想通过更快地加载缩略图或图像来优化UX。
如果向下滚动
GridView
并且必须等待〜秒才能完成磁盘提取,那么“性能”特别差。我可以尝试哪些方法来优化Picasso加载,以便本地内容可以像QuickPic一样快速显示?
这是我减少的适配器代码 (非常简单)。
I'm using Picasso (2.5.2) to load local
content://
images into a 3-columnGridView
via an adapter.Picasso .with(mContext) .load(mCameraImages.getUris().get(position)) .error(android.R.drawable.ic_dialog_alert) .fit() .centerCrop() .into(view);
In my particular case,
mCameraImages
is a just a list of URIs, coming out of the local mediaStore.I'm finding that when I load the
GridView
, Picasso always fetches the images from the disk (blue debug indicator) and not memory.This is expected but I'd like to optimize the UX by loading thumbnails or images faster.
The "performance" is particular poor if you scroll the
GridView
down and have to wait for ~seconds for the disk fetch to complete.What methods could I try to optimize Picasso loading so that local content can be displayed as quick as an app like QuickPic?
Here is my reduced adapter code (it is very simple).
原文:https://stackoverflow.com/questions/30496923
最满意答案
我不确定你的问题是否在试图说“如何让Spotlight找到文件?” 或“我想找到一个包含PIP_RESPECT的文件而我不在乎”。
如果是第二个,您可以从终端搜索Mac上的每个文件,如下所示:
sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null
运行需要一些时间! 它说...从文件系统的根目录(顶部)开始,找到所有文件(不是目录)并查看每个文件(使用grep)并查看是否可以找到PIP_RESPECT并打印文件名称你可以扔掉错误信息。
如果您只想在自己的登录目录及下面搜索,那么这样做会更快更容易(感谢@ I'L'I):
find ~ -type f -exec ....
I am not sure from your question if you are trying to say "How do I make Spotlight find a file?" or "I want to find a file containing PIP_RESPECT and I don't care how".
If the second, you can search through every file on your Mac from the terminal like this:
sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null
It will take some time to run! It says... starting at the root (top) of the filesystem, find everything that is a file (not directory) and look in every file (with grep) and see if you can find PIP_RESPECT and print the name of the file if you can and throw away error messages.
If you only want to search in your own login directory and below, it will be quicker and easier to do this (thanks to @I'L'I):
find ~ -type f -exec ....
相关问答
更多-
OS X终端颜色[已关闭](OS X Terminal Colors [closed])[2022-02-19]
我知道,这个线程是老的,但问题不是。 这是一个解决方案,我已经找到了启用全球终端的颜色 。 编辑您的.bash_profile (自OS X 10.8) - 或(10.7及更早版本) .profile /etc/profile或.bashrc或/etc/profile (取决于可用性) - 在您的主目录中,并添加以下代码: export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced CLICOLOR=1只能使您的终端着色。 LSCOLORS=...指定 ... -
这是一个可怕的黑客攻击,并不适用于所有情况。 tmp=${stringZ%%C12*} # Remove the search string and everything after it echo $(( ${#tmp} + 1 )) # Add one to the length of the remaining prefix This is a horrible hack, and may not work for all cases. tmp=${stringZ%%C12*} # ...
-
您正在查看的示例代码完全取决于Windows,使用C:\blah路径。 OS X上的等效路径如下所示: /Users/yourusername/Documents (在转换代码时,你似乎也以某种方式改变了一些东西。不确定那是什么。) The example code you're looking at is totally Windows specific, what with the C:\blah paths. An equivalent path on OS X would look somethi ...
-
听起来像NSLocalizedString的工作。 您可以在法语本地化中添加一个条目(在Localizable.strings中): "bytes" = "octets"; "KB" = "Ko"; "MB" = "Mo"; "GB" = "Go"; 然后使用: return [NSString stringWithFormat:@"%i %@", theSize, NSLocalizedString(@"bytes", nil)]; 为了更具体地回答这个问题,我不知道有任何Cocoa函数可以处理这些转 ...
-
OS X上的VOLTTRON?(VOLTTRON on OS X?)[2023-10-02]
直到大约两年前,我们有一个开发人员在OSX工作,并且当我们在他的环境中破坏某些东西时,他会友好地指出。 从那以后我们还没有真正尝试过。 我们监视文件的两个位置是在运行时更改授权。 这些功能仍然有效,他们只是不会在运行时更新状态。 我不知道我们使用的任何其他库会阻止您在OSX中工作。 Up until about two years ago we had a developer who was working in OSX and would kindly point out whenever we brok ... -
OS X中的PYTHONPATH(PYTHONPATH in OS X)[2021-09-23]
有几个配置文件可用于在OS X中设置PYTHONPATH : 第一个是配置文件,位于hidden / private / etc /文件夹中: /private/etc/profile 您可以使用以下语法在那里设置变量: export MY_CUSTOM_ENV_VARIABLE="/Applications/MyApp/bin" 其他配置文件是.cshrc , .bashrc和. bash_profile . bash_profile (感谢albert为您的信息)位于用户的主目录中,并且基于您的操作 ... -
我不确定你的问题是否在试图说“如何让Spotlight找到文件?” 或“我想找到一个包含PIP_RESPECT的文件而我不在乎”。 如果是第二个,您可以从终端搜索Mac上的每个文件,如下所示: sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null 运行需要一些时间! 它说...从文件系统的根目录(顶部)开始,找到所有文件(不是目录)并查看每个文件(使用grep)并查看是否可以找到PIP_RESPECT并打印文件名称你 ...
-
创建OS X服务(Creating an OS X Service)[2023-11-02]
确保首先启动应用程序以使系统查看服务。 确保使用--setServicesProvider在应用程序中注册服务处理程序: 另外,请检查控制台日志,因为这可能会为您提供一些有用的错误信息。 Make sure you are launching your app first to get the system to see the Service. Make sure you are registering the services handler in your app using - setService ... -
你是open的正确的轨道; 要使用⌘ + F (我假设您的标签上有OS X),您可以使用AppleScript告诉System Events应用程序执行击键: os.system("open " + filename) # You may need to add a sleep() here if the application is not already open and therefore needs time to load os.system("""osascript -e 'tell appl ...
-
在Lion和Mountain Lion上,磁盘工具UI中没有非日志的HFS变体。 如果您确实需要非日志卷,可以使用命令行diskutil工具。 您还可以在格式化卷后关闭日记功能; 在“磁盘工具”中选择它,按“选项”并单击“文件”菜单,然后选择“禁用日记功能”。 On Lion and Mountain Lion, the non-journaled HFS variants are not available in the Disk Utility UI. If you really need a non- ...