In my app, I have a SearchManager
search widget. When the user types, matching results show in the dropdown. I can put a thumbnail with these results using:
SearchManager.SUGGEST_COLUMN_ICON_1
The images come from my server so I use the glide (v3.7) library to convert and cache the images into a thumbnail.
The problem is, I can not resize them. They looks like they are ~10px by ~10px.
Is there a way to resize?
Here is my code:
Uri searchIconUri = null;
try {
FutureTarget<File> futureTarget = Glide
.with(getContext().getApplicationContext())
.load(path)
.downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
File cacheFile = futureTarget.get();
searchIconUri = Uri.fromFile(cacheFile);
} catch (Exception e) {
}
customCursor.addRow(new Object[]{
suggestion.id,
suggestion.profile,
suggestion.subcategory,
suggestion.profile,
suggestion.profile,
suggestion.id,
searchIconUri,
"android.intent.action.VIEW"});
This library seems very limiting when using the downloadOnly option.
I am not sure if the thumbnail size is created and displayed as is by glide, or if the SearchManager controls this. However, for results that have no thumbnail on my server, it simply uses my ic_launcher icon. This image is about 3 times the size.
Also note, all images on my server are 150px by 150px. .png files