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

Glide 4 - extension annotation procesor, error, fallback #1971

Closed
mare011 opened this issue May 26, 2017 · 3 comments
Closed

Glide 4 - extension annotation procesor, error, fallback #1971

mare011 opened this issue May 26, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@mare011
Copy link

mare011 commented May 26, 2017

Glide Version: 4.0.0-RC0

Integration libraries: okhttp-integration:4.0.0-RC0

Device/Android Version: Galaxy S6 SDK version 25

Issue details / Repro steps / Use case background:
When using an annotation processor, generated class GlideRequests contains duplicate field:

@Override
  public <ResourceType> GlideRequest<ResourceType> as(Class<ResourceType> resourceClass) {
    return new GlideRequest<>(glide, this, resourceClass);
  }
  @Override
  public <ResourceType> GlideRequest<ResourceType> as(Class<ResourceType> resourceClass) {
    return (GlideRequest<ResourceType>) super.as(resourceClass);
  }

My module:

@GlideModule
public class GlideAppModule extends AppGlideModule {
	@Override
	public void applyOptions(Context context, GlideBuilder builder) {
		builder.setDiskCache(new InternalCacheDiskCacheFactory(context, 20 * 1024 * 1024));
	}

	@Override
	public boolean isManifestParsingEnabled() {
		return false;
	}
}

Extension:

@GlideExtension
public final class GlideAppExtension {
	private GlideAppExtension() {}

	@GlideOption
	private static void cropCircle(RequestOptions options) {
		// TODO
	}
}

Should i use in build.gradle:
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
or
compile 'com.github.bumptech.glide:compiler:4.0.0-RC0

I've tried both, and tried SNAPSHOT version
Also in the documentation example the first argument is RequestOptions<?>, but the class from the sources is not generic?

Also in the code bellow, error drawable is not used when the url is null, and docs state: "null models will cause the error drawable to be displayed", this is working in the latest 3.x version.

Glide load line / GlideModule (if any) / list Adapter code (if any):

GlideApp.with(this).load(contractImage) // contractImage is null
			        .transform(new CropCircleTransformation())
			        .error(errorDrawable)
			        .into(imageView);
@sjudd
Copy link
Collaborator

sjudd commented May 26, 2017

I can reproduce this.

Your dependency looks correct to me:

annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'

@sjudd sjudd self-assigned this May 26, 2017
@sjudd sjudd added this to the 4.0 milestone May 26, 2017
sjudd added a commit to sjudd/glide that referenced this issue May 26, 2017
We’re being overly specific. At least for now, there’s only one “as”
method so we can exclude it based on the name alone.

Addresses bumptech#1971.
sjudd added a commit to sjudd/glide that referenced this issue May 26, 2017
@befora
Copy link

befora commented May 28, 2017

compile "com.github.bumptech.glide:glide:4.0.0-RC0"
compile "com.github.bumptech.glide:okhttp3-integration:4.0.0-RC0"

Great to hear this bug is acknowledged. In the meantime, the library still parses the manifest for a legacy (deprecated) GlideModule, so you can use that for testing purposes. Just make sure to remove the annotationProcessor dependency and @GlideModule annotations.

<meta-data
android:name="com.example.test.GlideModule"
android:value="GlideModule" />

@sjudd
Copy link
Collaborator

sjudd commented May 31, 2017

Splitting out a separate issue for the error fallback since it's unrelated.

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

No branches or pull requests

3 participants