Skip to content

Commit dbb002e

Browse files
committed
Add Known Issues
1 parent 667243a commit dbb002e

File tree

9 files changed

+60
-19
lines changed

9 files changed

+60
-19
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ Also has proper support for:
2929
* Support for LayerDrawables (including TransitionDrawables)
3030
* TileModes for repeating drawables
3131

32+
Known Issues
33+
----
34+
- VectorDrawables are **not** supported. This library is designed for BitmapDrawables only. Other drawables will likely fail or cause high memory usage.
35+
- ColorDrawables are poorly supported, use your own rounded VectorDrawables instead if you want less memory pressure.
36+
- Glide transforms are **not** supported, please use [wasabeef/glide-transformations](https://github
37+
.com/wasabeef/glide-transformations) if you want to round images loaded from Glide.
3238

3339
Gradle
3440
----

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.2'
8+
classpath 'com.android.tools.build:gradle:2.3.0'
99
}
1010
}
1111

example/build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ dependencies {
1212
//compile 'com.makeramen:roundedimageview:2.0.0-SNAPSHOT'
1313
compile project(':roundedimageview')
1414
compile 'com.squareup.picasso:picasso:2.5.2'
15-
compile 'com.android.support:support-v4:23.1.0'
16-
compile 'com.android.support:appcompat-v7:23.1.0'
15+
compile 'com.github.bumptech.glide:glide:3.7.0'
16+
compile 'com.android.support:support-v4:25.3.1'
17+
compile 'com.android.support:appcompat-v7:25.3.1'
1718
}
1819

1920
android {
@@ -23,7 +24,7 @@ android {
2324
defaultConfig {
2425
applicationId "com.makeramen.roundedimageview.example"
2526
minSdkVersion 14
26-
targetSdkVersion 23
27+
targetSdkVersion 25
2728
versionCode 1
2829
versionName version
2930
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Dec 04 13:37:35 PST 2016
1+
#Mon Apr 03 18:53:38 PDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

roundedimageview/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ android {
2424

2525
dependencies {
2626
provided 'com.squareup.picasso:picasso:2.5.2'
27-
provided 'com.android.support:support-annotations:23.1.0'
27+
provided 'com.android.support:support-annotations:25.3.1'
2828
}
2929

3030
task androidJavadocs(type: Javadoc) {

roundedimageview/src/main/java/com/makeramen/roundedimageview/Corner.java

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2017 Vincent Mi
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.makeramen.roundedimageview;
218

319
import android.support.annotation.IntDef;

roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedDrawable.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2015 Vincent Mi
2+
* Copyright (C) 2017 Vincent Mi
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,8 +61,8 @@ public class RoundedDrawable extends Drawable {
6161
private Shader.TileMode mTileModeY = Shader.TileMode.CLAMP;
6262
private boolean mRebuildShader = true;
6363

64-
// [ topLeft, topRight, bottomLeft, bottomRight ]
6564
private float mCornerRadius = 0f;
65+
// [ topLeft, topRight, bottomLeft, bottomRight ]
6666
private final boolean[] mCornersRounded = new boolean[] { true, true, true, true };
6767

6868
private boolean mOval = false;

roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedImageView.java

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2015 Vincent Mi
2+
* Copyright (C) 2017 Vincent Mi
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@
2727
import android.graphics.drawable.Drawable;
2828
import android.graphics.drawable.LayerDrawable;
2929
import android.net.Uri;
30-
import android.os.Build;
3130
import android.support.annotation.ColorInt;
3231
import android.support.annotation.DimenRes;
3332
import android.support.annotation.DrawableRes;
@@ -164,10 +163,6 @@ public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
164163
updateBackgroundDrawableAttrs(true);
165164

166165
if (mMutateBackground) {
167-
// when setBackground() is called by View constructor, mMutateBackground is not loaded from the attribute,
168-
// so it's false by default, what doesn't allow to create the RoundedDrawable. At this point, after load
169-
// mMutateBackground and updated BackgroundDrawable to RoundedDrawable, the View's background drawable needs to
170-
// be changed to this new drawable.
171166
//noinspection deprecation
172167
super.setBackgroundDrawable(mBackgroundDrawable);
173168
}
@@ -534,10 +529,22 @@ public void setBorderColor(ColorStateList colors) {
534529
}
535530
}
536531

532+
/**
533+
* Return true if this view should be oval and always set corner radii to half the height or
534+
* width.
535+
*
536+
* @return if this {@link RoundedImageView} is set to oval.
537+
*/
537538
public boolean isOval() {
538539
return mIsOval;
539540
}
540541

542+
/**
543+
* Set if the drawable should ignore the corner radii set and always round the source to
544+
* exactly half the height or width.
545+
*
546+
* @param oval if this {@link RoundedImageView} should be oval.
547+
*/
541548
public void setOval(boolean oval) {
542549
mIsOval = oval;
543550
updateDrawableAttrs();
@@ -571,10 +578,22 @@ public void setTileModeY(Shader.TileMode tileModeY) {
571578
invalidate();
572579
}
573580

581+
/**
582+
* If {@code true}, we will also round the background drawable according to the settings on this
583+
* ImageView.
584+
*
585+
* @return whether the background is mutated.
586+
*/
574587
public boolean mutatesBackground() {
575588
return mMutateBackground;
576589
}
577590

591+
/**
592+
* Set whether the {@link RoundedImageView} should round the background drawable according to
593+
* the settings in addition to the source drawable.
594+
*
595+
* @param mutate true if this view should mutate the background drawable.
596+
*/
578597
public void mutateBackground(boolean mutate) {
579598
if (mMutateBackground == mutate) { return; }
580599

roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedTransformationBuilder.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2015 Vincent Mi
2+
* Copyright (C) 2017 Vincent Mi
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@
2727

2828
public final class RoundedTransformationBuilder {
2929

30-
//private final Resources mResources;
3130
private final DisplayMetrics mDisplayMetrics;
3231

3332
private float[] mCornerRadii = new float[] { 0, 0, 0, 0 };
@@ -68,7 +67,7 @@ public RoundedTransformationBuilder cornerRadius(float radius) {
6867
* @param radius the radius in px.
6968
* @return the builder for chaning.
7069
*/
71-
public RoundedTransformationBuilder cornerRadius(int corner, float radius) {
70+
public RoundedTransformationBuilder cornerRadius(@Corner int corner, float radius) {
7271
mCornerRadii[corner] = radius;
7372
return this;
7473
}
@@ -91,7 +90,7 @@ public RoundedTransformationBuilder cornerRadiusDp(float radius) {
9190
* @param radius the radius in density independent pixels.
9291
* @return the builder for chaining.
9392
*/
94-
public RoundedTransformationBuilder cornerRadiusDp(int corner, float radius) {
93+
public RoundedTransformationBuilder cornerRadiusDp(@Corner int corner, float radius) {
9594
return cornerRadius(corner,
9695
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, radius, mDisplayMetrics));
9796
}

0 commit comments

Comments
 (0)