bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.67k stars 6.12k forks source link

Fix for bug https://github.com/bumptech/glide/issues/3195 #4419

Open EvgenSoloduha opened 3 years ago

EvgenSoloduha commented 3 years ago

Replace

return crossFade(new DrawableCrossFadeFactory.Builder(duration) to return crossFade(new DrawableCrossFadeFactory.Builder(duration).setCrossFadeEnabled(true));

and

return crossFade(new DrawableCrossFadeFactory.Builder()); to return crossFade(new DrawableCrossFadeFactory.Builder().setCrossFadeEnabled(true));

in DrawableTransitionOptions class

public final class DrawableTransitionOptions extends TransitionOptions<DrawableTransitionOptions, Drawable> {

/**
 * Returns a {@link DrawableTransitionOptions} object that enables a cross fade animation.
 *
 * @see #crossFade()
 */
@NonNull
public static DrawableTransitionOptions withCrossFade() {
    return new DrawableTransitionOptions().crossFade();
}

/**
 * Returns a {@link DrawableTransitionOptions} object that enables a cross fade animation.
 *
 * @see #crossFade(int)
 */
@NonNull
public static DrawableTransitionOptions withCrossFade(int duration) {
    return new DrawableTransitionOptions().crossFade(duration);
}

/**
 * Returns a {@link DrawableTransitionOptions} object that enables a cross fade animation.
 *
 * @see #crossFade(DrawableCrossFadeFactory)
 */
@NonNull
public static DrawableTransitionOptions withCrossFade(
        @NonNull DrawableCrossFadeFactory drawableCrossFadeFactory) {
    return new DrawableTransitionOptions().crossFade(drawableCrossFadeFactory);
}

/**
 * Returns a {@link DrawableTransitionOptions} object that enables a cross fade animation.
 *
 * @see #crossFade(DrawableCrossFadeFactory.Builder)
 */
@NonNull
public static DrawableTransitionOptions withCrossFade(
        @NonNull DrawableCrossFadeFactory.Builder builder) {
    return new DrawableTransitionOptions().crossFade(builder);
}

/**
 * Returns a {@link DrawableTransitionOptions} object that uses the given transition factory.
 *
 * @see com.bumptech.glide.GenericTransitionOptions#with(TransitionFactory)
 */
@NonNull
public static DrawableTransitionOptions with(
        @NonNull TransitionFactory<Drawable> transitionFactory) {
    return new DrawableTransitionOptions().transition(transitionFactory);
}

/**
 * Enables a cross fade animation between both the placeholder and the first resource and between
 * subsequent resources (if thumbnails are used).
 */
@NonNull
public DrawableTransitionOptions crossFade() {
    return crossFade(new DrawableCrossFadeFactory.Builder().setCrossFadeEnabled(true));
}

/**
 * Enables a cross fade animation between both the placeholder and the first resource and between
 * subsequent resources (if thumbnails are used).
 *
 * @param duration The duration of the animation, see {@code
 *     DrawableCrossFadeFactory.Builder(int)}
 * @see com.bumptech.glide.request.transition.DrawableCrossFadeFactory.Builder
 */
@NonNull
public DrawableTransitionOptions crossFade(int duration) {
    return crossFade(new DrawableCrossFadeFactory.Builder(duration).setCrossFadeEnabled(true));
}

/**
 * Enables a cross fade animation between both the placeholder and the first resource and between
 * subsequent resources (if thumbnails are used).
 */
@NonNull
public DrawableTransitionOptions crossFade(
        @NonNull DrawableCrossFadeFactory drawableCrossFadeFactory) {
    return transition(drawableCrossFadeFactory);
}

/**
 * Enables a cross fade animation between both the placeholder and the first resource and between
 * subsequent resources (if thumbnails are used).
 */
@NonNull
public DrawableTransitionOptions crossFade(@NonNull DrawableCrossFadeFactory.Builder builder) {
    return crossFade(builder.build());
}

}

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.