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

Allow setting options before setting models #182

Closed
sjudd opened this issue Oct 9, 2014 · 0 comments · Fixed by #186
Closed

Allow setting options before setting models #182

sjudd opened this issue Oct 9, 2014 · 0 comments · Fixed by #186
Labels
Milestone

Comments

@sjudd
Copy link
Collaborator

sjudd commented Oct 9, 2014

Branching this out of a discussion in #179, it would be nice to be able to apply options to a builder and then use that single builder with those options to load multiple different models. Glide doesn't currently allow this because some options are type specific and currently the only way we know the available types is from the model we're given.

My solution for now has been to wrap load calls in a class that specifies options:

public class GlideManager {

    public GlideManger(Activity activity) {
        requestManager = Glide.with(activity);
    }

    public GlideManger(Fragment fragment) {
        requestManager = Glide.with(fragment)
    }

    public DrawableRequestBuilder<Uri> loadThumb(Uri uri) {
        return requestManager.load(uri)
            .centerCrop()
            ....
    }
}

Which is then used like this:

glideManager.loadThumb(myUri).drawable(R.drawable.spinner).into(myView);

Although this works, it would be more convenient to simply define a builder somewhere at the top of the Activity or fragment and call into repeatedly.

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

Successfully merging a pull request may close this issue.

2 participants