Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About using custom DownSampleStrategy #5119

Open
WSWSKIM opened this issue Apr 8, 2023 · 0 comments
Open

About using custom DownSampleStrategy #5119

WSWSKIM opened this issue Apr 8, 2023 · 0 comments

Comments

@WSWSKIM
Copy link

WSWSKIM commented Apr 8, 2023

Glide Version: #4.12.0

Device/Android Version:
Android Tiramisu

Issue details / Repro steps / Use case background:
I am using custom DownSampleStrategy (extends DownSampleStrategy).
When I put the new constructor in downsample() as shown in code 1 attached below,
A flickering phenomenon occurs when the change of images is notify.(RecyclerView)

If I use a static variable like number 2, there is no issue.

Do you know why,
For example, does it take a lot of memory or time to create a new DownSampleStrategy?

The code:
1. using new constructor

RequestOptions options = new RequestOptions().error(R.drawable.error_image);
options = options.downsample(new CustomDownSampleStrategy()).optionalTransform(new CenterCrop());

Glide.with(context)
.load(url)
.apply(options)
.into(imageView);

2. using static variable

private static final CustomDownSampleStrategy CUSTOM_STRATEGY = new CustomDownSampleStrategy();

RequestOptions options = new RequestOptions().error(R.drawable.error_image);
options = options.downsample(CUSTOM_STRATEGY).optionalTransform(new CenterCrop());

Glide.with(context)
.load(url)
.apply(options)
.into(imageView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant