diff --git a/README.md b/README.md
index c7431eb..3a978c5 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
CircleImageView
===============
-A fast circular ImageView perfect for profile images. This is based on [RoundedImageView from Vince Mi](https://github.com/vinc3m1/RoundedImageView) which itself is based on [techniques recommended by Romain Guy](http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/).
+A fast circular ImageView perfect for profile images. This is based on [RoundedImageView from Vince Mi](https://github.com/vinc3m1/RoundedImageView) which itself is based on techniques recommended by [Romain Guy](https://twitter.com/romainguy).

@@ -17,7 +17,7 @@ Gradle
```
dependencies {
...
- compile 'de.hdodenhof:circleimageview:2.0.0'
+ implementation 'de.hdodenhof:circleimageview:3.1.0'
}
```
@@ -41,8 +41,47 @@ Limitations
* If you use an image loading library like Picasso or Glide, you need to disable their fade animations to avoid messed up images. For Picasso use the `noFade()` option, for Glide use `dontAnimate()`. If you want to keep the fadeIn animation, you have to fetch the image into a `Target` and apply a custom animation yourself when receiving the `Bitmap`.
* Using a `TransitionDrawable` with `CircleImageView` doesn't work properly and leads to messed up images.
+FAQ
+---
+**How can I use a `VectorDrawable` with `CircleImageView`?**
+
+Short answer: you shouldn't. Using a `VectorDrawable` with `CircleImageView` is very inefficient. You should modify your vectors to be in a circular shape and use them with a regular ImageView instead.
+
+**Why doesn't `CircleImageView` extend `AppCompatImageView`?**
+
+Extending `AppCompatImageView` would require adding a runtime dependency for the support library without any real benefit.
+
+**How can I add a selector (e.g. ripple effect) bound to a circle?**
+
+There's currently no direct support for a circle bound selector but you can follow [these steps](https://github.com/hdodenhof/CircleImageView/issues/153#issuecomment-249692049) to implement it yourself.
+
+**How can I add a gap between image and border?**
+
+Adding a gap is also not supported directly but [there's a workaround](https://github.com/hdodenhof/CircleImageView/issues/133#issuecomment-225437930).
+
Changelog
---------
+* **3.1.0**
+ * Align bitmap paint flags with BitmapDrawable (improves scaling)
+* **3.0.2**
+ * Fix NPE during initialization on API level <= 19
+ * Fix wrong outline being provided if circular transformation is disabled
+* **3.0.1**
+ * Fix touch event not fired if view is empty
+ * Fix touchable area limited to a circle even if transformation is disabled
+* **3.0.0**
+ * Limit touch event handling to circle area
+ * Migrate to AndroidX
+ * Remove deprecated properties and methods
+* **2.2.0**
+ * Add support for elevation
+ * Add circle background color attribute to replace fill color
+* **2.1.0**
+ * Add support for padding
+ * Add option to disable circular transformation
+ * Fix hairline gap being drawn between image and border under some conditions
+ * Fix NPE when using tint attribute (which is not supported)
+ * Deprecate fill color as it seems to cause quite some confusion
* **2.0.0**
* BREAKING: Custom xml attributes are now prefixed with "civ_"
* Graceful handling of incompatible drawables
@@ -73,7 +112,7 @@ Changelog
License
-------
- Copyright 2014 - 2015 Henning Dodenhof
+ Copyright 2014 - 2020 Henning Dodenhof
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/build.gradle b/build.gradle
index ec1c36d..167a9f7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,11 @@
buildscript {
repositories {
- mavenCentral()
+ jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
+ classpath 'com.android.tools.build:gradle:3.6.1'
}
}
@@ -13,6 +14,7 @@ allprojects {
group = GROUP
repositories {
- mavenCentral()
+ jcenter()
+ google()
}
-}
\ No newline at end of file
+}
diff --git a/circleimageview/build.gradle b/circleimageview/build.gradle
index ea9b66b..3c55fc5 100644
--- a/circleimageview/build.gradle
+++ b/circleimageview/build.gradle
@@ -1,17 +1,17 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 23
- buildToolsVersion '23.0.2'
+ compileSdkVersion 29
+ buildToolsVersion '29.0.3'
defaultConfig {
- minSdkVersion 8
- targetSdkVersion 23
+ minSdkVersion 14
+ targetSdkVersion 29
}
}
dependencies {
- provided 'com.android.support:support-annotations:23.1.1'
+ compileOnly 'androidx.annotation:annotation:1.1.0'
}
-apply from: 'https://raw.github.com/hdodenhof/gradle-mvn-push/master/gradle-mvn-push.gradle'
\ No newline at end of file
+apply from: 'https://raw.github.com/hdodenhof/gradle-mvn-push/master/gradle-mvn-push.gradle'
diff --git a/circleimageview/gradle.properties b/circleimageview/gradle.properties
index aeb7191..657a307 100644
--- a/circleimageview/gradle.properties
+++ b/circleimageview/gradle.properties
@@ -1,3 +1,3 @@
POM_NAME=CircleImageView
POM_ARTIFACT_ID=circleimageview
-POM_PACKAGING=aar
\ No newline at end of file
+POM_PACKAGING=aar
diff --git a/circleimageview/src/main/AndroidManifest.xml b/circleimageview/src/main/AndroidManifest.xml
index 432e859..d9f621e 100644
--- a/circleimageview/src/main/AndroidManifest.xml
+++ b/circleimageview/src/main/AndroidManifest.xml
@@ -4,4 +4,4 @@
-
\ No newline at end of file
+
diff --git a/circleimageview/src/main/java/de/hdodenhof/circleimageview/CircleImageView.java b/circleimageview/src/main/java/de/hdodenhof/circleimageview/CircleImageView.java
index 782c34a..2f27195 100644
--- a/circleimageview/src/main/java/de/hdodenhof/circleimageview/CircleImageView.java
+++ b/circleimageview/src/main/java/de/hdodenhof/circleimageview/CircleImageView.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 - 2015 Henning Dodenhof
+ * Copyright 2014 - 2020 Henning Dodenhof
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package de.hdodenhof.circleimageview;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
@@ -23,19 +24,28 @@
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
+import android.graphics.Outline;
import android.graphics.Paint;
+import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.support.annotation.ColorInt;
-import android.support.annotation.ColorRes;
-import android.support.annotation.DrawableRes;
+import android.os.Build;
import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewOutlineProvider;
import android.widget.ImageView;
+import androidx.annotation.ColorInt;
+import androidx.annotation.ColorRes;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+@SuppressWarnings("UnusedDeclaration")
public class CircleImageView extends ImageView {
private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;
@@ -45,7 +55,8 @@ public class CircleImageView extends ImageView {
private static final int DEFAULT_BORDER_WIDTH = 0;
private static final int DEFAULT_BORDER_COLOR = Color.BLACK;
- private static final int DEFAULT_FILL_COLOR = Color.TRANSPARENT;
+ private static final int DEFAULT_CIRCLE_BACKGROUND_COLOR = Color.TRANSPARENT;
+ private static final int DEFAULT_IMAGE_ALPHA = 255;
private static final boolean DEFAULT_BORDER_OVERLAY = false;
private final RectF mDrawableRect = new RectF();
@@ -54,25 +65,27 @@ public class CircleImageView extends ImageView {
private final Matrix mShaderMatrix = new Matrix();
private final Paint mBitmapPaint = new Paint();
private final Paint mBorderPaint = new Paint();
- private final Paint mFillPaint = new Paint();
+ private final Paint mCircleBackgroundPaint = new Paint();
private int mBorderColor = DEFAULT_BORDER_COLOR;
private int mBorderWidth = DEFAULT_BORDER_WIDTH;
- private int mFillColor = DEFAULT_FILL_COLOR;
+ private int mCircleBackgroundColor = DEFAULT_CIRCLE_BACKGROUND_COLOR;
+ private int mImageAlpha = DEFAULT_IMAGE_ALPHA;
private Bitmap mBitmap;
- private BitmapShader mBitmapShader;
- private int mBitmapWidth;
- private int mBitmapHeight;
+ private Canvas mBitmapCanvas;
private float mDrawableRadius;
private float mBorderRadius;
private ColorFilter mColorFilter;
- private boolean mReady;
- private boolean mSetupPending;
+ private boolean mInitialized;
+ private boolean mRebuildShader;
+ private boolean mDrawableDirty;
+
private boolean mBorderOverlay;
+ private boolean mDisableCircularTransformation;
public CircleImageView(Context context) {
super(context);
@@ -92,7 +105,7 @@ public CircleImageView(Context context, AttributeSet attrs, int defStyle) {
mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_civ_border_width, DEFAULT_BORDER_WIDTH);
mBorderColor = a.getColor(R.styleable.CircleImageView_civ_border_color, DEFAULT_BORDER_COLOR);
mBorderOverlay = a.getBoolean(R.styleable.CircleImageView_civ_border_overlay, DEFAULT_BORDER_OVERLAY);
- mFillColor = a.getColor(R.styleable.CircleImageView_civ_fill_color, DEFAULT_FILL_COLOR);
+ mCircleBackgroundColor = a.getColor(R.styleable.CircleImageView_civ_circle_background_color, DEFAULT_CIRCLE_BACKGROUND_COLOR);
a.recycle();
@@ -100,18 +113,28 @@ public CircleImageView(Context context, AttributeSet attrs, int defStyle) {
}
private void init() {
+ mInitialized = true;
+
super.setScaleType(SCALE_TYPE);
- mReady = true;
- if (mSetupPending) {
- setup();
- mSetupPending = false;
- }
- }
+ mBitmapPaint.setAntiAlias(true);
+ mBitmapPaint.setDither(true);
+ mBitmapPaint.setFilterBitmap(true);
+ mBitmapPaint.setAlpha(mImageAlpha);
+ mBitmapPaint.setColorFilter(mColorFilter);
- @Override
- public ScaleType getScaleType() {
- return SCALE_TYPE;
+ mBorderPaint.setStyle(Paint.Style.STROKE);
+ mBorderPaint.setAntiAlias(true);
+ mBorderPaint.setColor(mBorderColor);
+ mBorderPaint.setStrokeWidth(mBorderWidth);
+
+ mCircleBackgroundPaint.setStyle(Paint.Style.FILL);
+ mCircleBackgroundPaint.setAntiAlias(true);
+ mCircleBackgroundPaint.setColor(mCircleBackgroundColor);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ setOutlineProvider(new OutlineProvider());
+ }
}
@Override
@@ -128,25 +151,68 @@ public void setAdjustViewBounds(boolean adjustViewBounds) {
}
}
+ @SuppressLint("CanvasSize")
@Override
protected void onDraw(Canvas canvas) {
- if (mBitmap == null) {
+ if (mDisableCircularTransformation) {
+ super.onDraw(canvas);
return;
}
- if (mFillColor != Color.TRANSPARENT) {
- canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mFillPaint);
+ if (mCircleBackgroundColor != Color.TRANSPARENT) {
+ canvas.drawCircle(mDrawableRect.centerX(), mDrawableRect.centerY(), mDrawableRadius, mCircleBackgroundPaint);
}
- canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mBitmapPaint);
- if (mBorderWidth != 0) {
- canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mBorderRadius, mBorderPaint);
+
+ if (mBitmap != null) {
+ if (mDrawableDirty && mBitmapCanvas != null) {
+ mDrawableDirty = false;
+ Drawable drawable = getDrawable();
+ drawable.setBounds(0, 0, mBitmapCanvas.getWidth(), mBitmapCanvas.getHeight());
+ drawable.draw(mBitmapCanvas);
+ }
+
+ if (mRebuildShader) {
+ mRebuildShader = false;
+
+ BitmapShader bitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
+ bitmapShader.setLocalMatrix(mShaderMatrix);
+
+ mBitmapPaint.setShader(bitmapShader);
+ }
+
+ canvas.drawCircle(mDrawableRect.centerX(), mDrawableRect.centerY(), mDrawableRadius, mBitmapPaint);
+ }
+
+ if (mBorderWidth > 0) {
+ canvas.drawCircle(mBorderRect.centerX(), mBorderRect.centerY(), mBorderRadius, mBorderPaint);
}
}
+ @Override
+ public void invalidateDrawable(@NonNull Drawable dr) {
+ mDrawableDirty = true;
+ invalidate();
+ }
+
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
- setup();
+ updateDimensions();
+ invalidate();
+ }
+
+ @Override
+ public void setPadding(int left, int top, int right, int bottom) {
+ super.setPadding(left, top, right, bottom);
+ updateDimensions();
+ invalidate();
+ }
+
+ @Override
+ public void setPaddingRelative(int start, int top, int end, int bottom) {
+ super.setPaddingRelative(start, top, end, bottom);
+ updateDimensions();
+ invalidate();
}
public int getBorderColor() {
@@ -159,30 +225,30 @@ public void setBorderColor(@ColorInt int borderColor) {
}
mBorderColor = borderColor;
- mBorderPaint.setColor(mBorderColor);
+ mBorderPaint.setColor(borderColor);
invalidate();
}
- public void setBorderColorResource(@ColorRes int borderColorRes) {
- setBorderColor(getContext().getResources().getColor(borderColorRes));
- }
-
- public int getFillColor() {
- return mFillColor;
+ public int getCircleBackgroundColor() {
+ return mCircleBackgroundColor;
}
- public void setFillColor(@ColorInt int fillColor) {
- if (fillColor == mFillColor) {
+ public void setCircleBackgroundColor(@ColorInt int circleBackgroundColor) {
+ if (circleBackgroundColor == mCircleBackgroundColor) {
return;
}
- mFillColor = fillColor;
- mFillPaint.setColor(fillColor);
+ mCircleBackgroundColor = circleBackgroundColor;
+ mCircleBackgroundPaint.setColor(circleBackgroundColor);
invalidate();
}
- public void setFillColorResource(@ColorRes int fillColorRes) {
- setFillColor(getContext().getResources().getColor(fillColorRes));
+ /**
+ * @deprecated Use {@link #setCircleBackgroundColor(int)} instead
+ */
+ @Deprecated
+ public void setCircleBackgroundColorResource(@ColorRes int circleBackgroundRes) {
+ setCircleBackgroundColor(getContext().getResources().getColor(circleBackgroundRes));
}
public int getBorderWidth() {
@@ -195,7 +261,9 @@ public void setBorderWidth(int borderWidth) {
}
mBorderWidth = borderWidth;
- setup();
+ mBorderPaint.setStrokeWidth(borderWidth);
+ updateDimensions();
+ invalidate();
}
public boolean isBorderOverlay() {
@@ -208,35 +276,81 @@ public void setBorderOverlay(boolean borderOverlay) {
}
mBorderOverlay = borderOverlay;
- setup();
+ updateDimensions();
+ invalidate();
+ }
+
+ public boolean isDisableCircularTransformation() {
+ return mDisableCircularTransformation;
+ }
+
+ public void setDisableCircularTransformation(boolean disableCircularTransformation) {
+ if (disableCircularTransformation == mDisableCircularTransformation) {
+ return;
+ }
+
+ mDisableCircularTransformation = disableCircularTransformation;
+
+ if (disableCircularTransformation) {
+ mBitmap = null;
+ mBitmapCanvas = null;
+ mBitmapPaint.setShader(null);
+ } else {
+ initializeBitmap();
+ }
+
+ invalidate();
}
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
- mBitmap = bm;
- setup();
+ initializeBitmap();
+ invalidate();
}
@Override
public void setImageDrawable(Drawable drawable) {
super.setImageDrawable(drawable);
- mBitmap = getBitmapFromDrawable(drawable);
- setup();
+ initializeBitmap();
+ invalidate();
}
@Override
public void setImageResource(@DrawableRes int resId) {
super.setImageResource(resId);
- mBitmap = getBitmapFromDrawable(getDrawable());
- setup();
+ initializeBitmap();
+ invalidate();
}
@Override
public void setImageURI(Uri uri) {
super.setImageURI(uri);
- mBitmap = uri != null ? getBitmapFromDrawable(getDrawable()) : null;
- setup();
+ initializeBitmap();
+ invalidate();
+ }
+
+ @Override
+ public void setImageAlpha(int alpha) {
+ alpha &= 0xFF;
+
+ if (alpha == mImageAlpha) {
+ return;
+ }
+
+ mImageAlpha = alpha;
+
+ // This might be called during ImageView construction before
+ // member initialization has finished on API level >= 16.
+ if (mInitialized) {
+ mBitmapPaint.setAlpha(alpha);
+ invalidate();
+ }
+ }
+
+ @Override
+ public int getImageAlpha() {
+ return mImageAlpha;
}
@Override
@@ -246,8 +360,18 @@ public void setColorFilter(ColorFilter cf) {
}
mColorFilter = cf;
- mBitmapPaint.setColorFilter(mColorFilter);
- invalidate();
+
+ // This might be called during ImageView construction before
+ // member initialization has finished on API level <= 19.
+ if (mInitialized) {
+ mBitmapPaint.setColorFilter(cf);
+ invalidate();
+ }
+ }
+
+ @Override
+ public ColorFilter getColorFilter() {
+ return mColorFilter;
}
private Bitmap getBitmapFromDrawable(Drawable drawable) {
@@ -278,70 +402,111 @@ private Bitmap getBitmapFromDrawable(Drawable drawable) {
}
}
- private void setup() {
- if (!mReady) {
- mSetupPending = true;
- return;
- }
+ private void initializeBitmap() {
+ mBitmap = getBitmapFromDrawable(getDrawable());
- if (getWidth() == 0 && getHeight() == 0) {
- return;
+ if (mBitmap != null && mBitmap.isMutable()) {
+ mBitmapCanvas = new Canvas(mBitmap);
+ } else {
+ mBitmapCanvas = null;
}
- if (mBitmap == null) {
- invalidate();
+ if (!mInitialized) {
return;
}
- mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
-
- mBitmapPaint.setAntiAlias(true);
- mBitmapPaint.setShader(mBitmapShader);
-
- mBorderPaint.setStyle(Paint.Style.STROKE);
- mBorderPaint.setAntiAlias(true);
- mBorderPaint.setColor(mBorderColor);
- mBorderPaint.setStrokeWidth(mBorderWidth);
-
- mFillPaint.setStyle(Paint.Style.FILL);
- mFillPaint.setAntiAlias(true);
- mFillPaint.setColor(mFillColor);
-
- mBitmapHeight = mBitmap.getHeight();
- mBitmapWidth = mBitmap.getWidth();
+ if (mBitmap != null) {
+ updateShaderMatrix();
+ } else {
+ mBitmapPaint.setShader(null);
+ }
+ }
- mBorderRect.set(0, 0, getWidth(), getHeight());
+ private void updateDimensions() {
+ mBorderRect.set(calculateBounds());
mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2.0f, (mBorderRect.width() - mBorderWidth) / 2.0f);
mDrawableRect.set(mBorderRect);
- if (!mBorderOverlay) {
- mDrawableRect.inset(mBorderWidth, mBorderWidth);
+ if (!mBorderOverlay && mBorderWidth > 0) {
+ mDrawableRect.inset(mBorderWidth - 1.0f, mBorderWidth - 1.0f);
}
mDrawableRadius = Math.min(mDrawableRect.height() / 2.0f, mDrawableRect.width() / 2.0f);
updateShaderMatrix();
- invalidate();
+ }
+
+ private RectF calculateBounds() {
+ int availableWidth = getWidth() - getPaddingLeft() - getPaddingRight();
+ int availableHeight = getHeight() - getPaddingTop() - getPaddingBottom();
+
+ int sideLength = Math.min(availableWidth, availableHeight);
+
+ float left = getPaddingLeft() + (availableWidth - sideLength) / 2f;
+ float top = getPaddingTop() + (availableHeight - sideLength) / 2f;
+
+ return new RectF(left, top, left + sideLength, top + sideLength);
}
private void updateShaderMatrix() {
+ if (mBitmap == null) {
+ return;
+ }
+
float scale;
float dx = 0;
float dy = 0;
mShaderMatrix.set(null);
- if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) {
- scale = mDrawableRect.height() / (float) mBitmapHeight;
- dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f;
+ int bitmapHeight = mBitmap.getHeight();
+ int bitmapWidth = mBitmap.getWidth();
+
+ if (bitmapWidth * mDrawableRect.height() > mDrawableRect.width() * bitmapHeight) {
+ scale = mDrawableRect.height() / (float) bitmapHeight;
+ dx = (mDrawableRect.width() - bitmapWidth * scale) * 0.5f;
} else {
- scale = mDrawableRect.width() / (float) mBitmapWidth;
- dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f;
+ scale = mDrawableRect.width() / (float) bitmapWidth;
+ dy = (mDrawableRect.height() - bitmapHeight * scale) * 0.5f;
}
mShaderMatrix.setScale(scale, scale);
mShaderMatrix.postTranslate((int) (dx + 0.5f) + mDrawableRect.left, (int) (dy + 0.5f) + mDrawableRect.top);
- mBitmapShader.setLocalMatrix(mShaderMatrix);
+ mRebuildShader = true;
+ }
+
+ @SuppressLint("ClickableViewAccessibility")
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mDisableCircularTransformation) {
+ return super.onTouchEvent(event);
+ }
+
+ return inTouchableArea(event.getX(), event.getY()) && super.onTouchEvent(event);
+ }
+
+ private boolean inTouchableArea(float x, float y) {
+ if (mBorderRect.isEmpty()) {
+ return true;
+ }
+
+ return Math.pow(x - mBorderRect.centerX(), 2) + Math.pow(y - mBorderRect.centerY(), 2) <= Math.pow(mBorderRadius, 2);
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+ private class OutlineProvider extends ViewOutlineProvider {
+
+ @Override
+ public void getOutline(View view, Outline outline) {
+ if (mDisableCircularTransformation) {
+ ViewOutlineProvider.BACKGROUND.getOutline(view, outline);
+ } else {
+ Rect bounds = new Rect();
+ mBorderRect.roundOut(bounds);
+ outline.setRoundRect(bounds, bounds.width() / 2.0f);
+ }
+ }
+
}
}
diff --git a/circleimageview/src/main/res/values/attrs.xml b/circleimageview/src/main/res/values/attrs.xml
index ab6c430..bdfc2b1 100644
--- a/circleimageview/src/main/res/values/attrs.xml
+++ b/circleimageview/src/main/res/values/attrs.xml
@@ -4,6 +4,6 @@
-
+
diff --git a/gradle.properties b/gradle.properties
index b283d0b..b65822a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-VERSION_NAME=2.0.1-SNAPSHOT
+VERSION_NAME=4.0.0-SNAPSHOT
GROUP=de.hdodenhof
POM_DESCRIPTION=A fast circular ImageView for Android
@@ -10,4 +10,7 @@ POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=hdodenhof
-POM_DEVELOPER_NAME=Henning Dodenhof
\ No newline at end of file
+POM_DEVELOPER_NAME=Henning Dodenhof
+
+android.useAndroidX=true
+android.enableJetifier=false
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 9851e51..d5e0f6f 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@
+#Wed Jan 01 12:46:55 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/sample/build.gradle b/sample/build.gradle
index b5d8d9a..38166e6 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 23
- buildToolsVersion '23.0.2'
+ compileSdkVersion 29
+ buildToolsVersion '29.0.3'
defaultConfig {
- minSdkVersion 8
- targetSdkVersion 23
+ minSdkVersion 14
+ targetSdkVersion 29
}
}
dependencies {
- compile project(':circleimageview')
-}
\ No newline at end of file
+ implementation project(':circleimageview')
+}
diff --git a/sample/proguard-rules.txt b/sample/proguard-rules.txt
index 21a30b1..59985f0 100644
--- a/sample/proguard-rules.txt
+++ b/sample/proguard-rules.txt
@@ -14,4 +14,4 @@
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
-#}
\ No newline at end of file
+#}
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index ffe9dd1..74ca48e 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -1,12 +1,16 @@
-
+ android:theme="@style/AppTheme"
+ tools:ignore="GoogleAppIndexingWarning">
+
@@ -16,6 +20,7 @@
+
diff --git a/sample/src/main/res/values/colors.xml b/sample/src/main/res/values/colors.xml
index f7fe3c0..ea49b51 100644
--- a/sample/src/main/res/values/colors.xml
+++ b/sample/src/main/res/values/colors.xml
@@ -4,4 +4,4 @@
#FF222222
#FFEEEEEE
-
\ No newline at end of file
+
diff --git a/settings.gradle b/settings.gradle
index 8fbd5fe..0503e7f 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':circleimageview', ':sample'
\ No newline at end of file
+include ':circleimageview', ':sample'