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

Shadow displaying as square on FloatingActionButton Glide V4 #2125

Closed
olddustysocksunderthecouch opened this issue Jul 10, 2017 · 2 comments
Closed
Labels

Comments

@olddustysocksunderthecouch

I recently upgraded Glide to version 4 which has caused problems with the image I display in a floating action button. I have attempted 2 methods and I use the same XML for both:

XML:

<android.support.design.widget.FloatingActionButton
    android:id="@+id/profilepic_fab"
    android:layout_width="150dp"
    android:layout_height="150dp"
    android:scaleType="center"
    app:layout_anchor="@id/appbar"
    app:layout_anchorGravity="bottom|center_horizontal"
    app:srcCompat="@mipmap/bookmark_checked_white" />

Method #1:

            RequestOptions optionsCentre = new RequestOptions()
                    .placeholder(R.drawable.profilepic_placeholder)
                    error(R.drawable.profilepic_placeholder).dontTransform()
                    .dontAnimate().CircleCrop();

            Glide.with(context)
                    .load(userinfo.getprofilePic())
                    .apply(optionsCentre)
                    .into(profilepic);

Result of Method #1: It looks good on Android 7.1.2 but on 4.4 it looks like the image below:
Method #1 on Android 4.4

Method #2:

RequestOptions options = new RequestOptions()
                .fitCenter()
                .placeholder(R.drawable.profilepic_placeholder)
                .error(R.drawable.profilepic_placeholder)
                .priority(Priority.HIGH);

    Glide.with(context)
            .asBitmap()
            .apply(options)
            .load(url)
            .into(new BitmapImageViewTarget(fab) {
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable =
                            RoundedBitmapDrawableFactory.create(context.getResources(), resource);
                    circularBitmapDrawable.setCircular(true);
                    fab.setImageDrawable(circularBitmapDrawable);
                }
            });

Result of Method #2: The results look different on Android 7.1.2 and 4.4

Android 7.1.2:
Method #2 on Android 7.1.2

Android 4.4:
Method #2 on Android 4.4

Method #2 is what used to work with Glide v3... Any help would be greatly appreciated!

@olddustysocksunderthecouch
Copy link
Author

Any thoughts on what might be causing this issue?

@stale
Copy link

stale bot commented Nov 12, 2017

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.

@stale stale bot added the stale label Nov 12, 2017
@stale stale bot closed this as completed Nov 19, 2017
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

1 participant