Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Thumbnail of images #68

Open
smedic opened this issue May 24, 2019 · 5 comments
Open

Thumbnail of images #68

smedic opened this issue May 24, 2019 · 5 comments
Labels

Comments

@smedic
Copy link

smedic commented May 24, 2019

Is it possible to implement thumbnails for images?
On left side, there can be a thumbnail instead of small file icon.

@hedzr
Copy link
Owner

hedzr commented May 25, 2019

There is no shortcut but:

.withAdapterSetter(new ChooserDialog.AdapterSetter() {
    @Override
    public void apply(DirAdapter adapter) {
		// since 1.1.17
		adapter.overrideGetView((file, isSelected, isFocused, convertView, parent, inflater) -> {
			ViewGroup view = (ViewGroup) inflater.inflate(R.layout.li_row, parent, false);
			...
			return view;
		}
    }
})

@smedic
Copy link
Author

smedic commented May 26, 2019

How to use that? To set custom layout for every row, right?

@hedzr
Copy link
Owner

hedzr commented May 26, 2019

no bother so much:

	adapter.overrideGetView((file, isSelected, isFocused, convertView, parent, inflater) -> {
		ViewGroup view = (ViewGroup) inflater.inflate(com.obsez.filechooser.R.layout.li_row, parent, false);
		// ...
		// set filename, isSelected, isFocused to control views
		// ...
		ImageView iv = view.findViewById(com.obsez.filechooser.R.layout.icon) // ?? find the right res id from xml source file pls.
		// ...generate thumb image and set it to iv

		return view;
	}

pls refer the redIds from the source xml of R.layout.li_row.
sorry for the simple reply from phone editor.

@Guiorgy
Copy link
Collaborator

Guiorgy commented May 27, 2019

@smedic, if the only thing you want to change are the icons, you can copy the source code of getView in DirAdapter here

@smedic
Copy link
Author

smedic commented May 27, 2019

Thanks for prompt answers, I ll try this :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants