Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff2feb4c authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Fix UserAvatarView.setDisabled method."

parents c0b2f09a a9459755
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ public class UserAvatarView extends View {
        float halfW = getWidth() / 2f;
        float halfH = getHeight() / 2f;
        float halfSW = Math.min(halfH, halfW);
        updateDrawableIfDisabled();
        if (mBitmap != null && mScale > 0) {
            int saveCount = canvas.getSaveCount();
            canvas.save();
@@ -249,22 +250,25 @@ public class UserAvatarView extends View {
            return;
        }
        mIsDisabled = disabled;
        invalidate();
    }

    private void updateDrawableIfDisabled() {
        int disabledColor = getContext().getColor(R.color.qs_tile_disabled_color);
        PorterDuffColorFilter filter = new PorterDuffColorFilter(disabledColor,
                PorterDuff.Mode.SRC_ATOP);
        if (mBitmap != null) {
            if (disabled) {
            if (mIsDisabled) {
                mBitmapPaint.setColorFilter(filter);
            } else {
                mBitmapPaint.setColorFilter(null);
            }
        } else if (mDrawable != null) {
            if (disabled) {
            if (mIsDisabled) {
                mDrawable.setColorFilter(filter);
            } else {
                mDrawable.setColorFilter(null);
            }
        }
        invalidate();
    }
}