From dbb002e95a049ea0e060543840aab275de4624ec Mon Sep 17 00:00:00 2001 From: Vince Mi Date: Mon, 3 Apr 2017 19:24:16 -0700 Subject: [PATCH] Add Known Issues --- README.md | 6 ++++ build.gradle | 2 +- example/build.gradle | 7 +++-- gradle/wrapper/gradle-wrapper.properties | 4 +-- roundedimageview/build.gradle | 2 +- .../makeramen/roundedimageview/Corner.java | 16 ++++++++++ .../roundedimageview/RoundedDrawable.java | 4 +-- .../roundedimageview/RoundedImageView.java | 31 +++++++++++++++---- .../RoundedTransformationBuilder.java | 7 ++--- 9 files changed, 60 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index c4acae8..f80848d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,12 @@ Also has proper support for: * Support for LayerDrawables (including TransitionDrawables) * TileModes for repeating drawables +Known Issues +---- +- VectorDrawables are **not** supported. This library is designed for BitmapDrawables only. Other drawables will likely fail or cause high memory usage. +- ColorDrawables are poorly supported, use your own rounded VectorDrawables instead if you want less memory pressure. +- Glide transforms are **not** supported, please use [wasabeef/glide-transformations](https://github +.com/wasabeef/glide-transformations) if you want to round images loaded from Glide. Gradle ---- diff --git a/build.gradle b/build.gradle index 0e70d17..a5bc5fb 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:2.2.2' + classpath 'com.android.tools.build:gradle:2.3.0' } } diff --git a/example/build.gradle b/example/build.gradle index 6dca3ee..2646aa6 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -12,8 +12,9 @@ dependencies { //compile 'com.makeramen:roundedimageview:2.0.0-SNAPSHOT' compile project(':roundedimageview') compile 'com.squareup.picasso:picasso:2.5.2' - compile 'com.android.support:support-v4:23.1.0' - compile 'com.android.support:appcompat-v7:23.1.0' + compile 'com.github.bumptech.glide:glide:3.7.0' + compile 'com.android.support:support-v4:25.3.1' + compile 'com.android.support:appcompat-v7:25.3.1' } android { @@ -23,7 +24,7 @@ android { defaultConfig { applicationId "com.makeramen.roundedimageview.example" minSdkVersion 14 - targetSdkVersion 23 + targetSdkVersion 25 versionCode 1 versionName version } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 383dd2f..b03e7bd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Dec 04 13:37:35 PST 2016 +#Mon Apr 03 18:53:38 PDT 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/roundedimageview/build.gradle b/roundedimageview/build.gradle index cfaf3ce..63f8ec3 100644 --- a/roundedimageview/build.gradle +++ b/roundedimageview/build.gradle @@ -24,7 +24,7 @@ android { dependencies { provided 'com.squareup.picasso:picasso:2.5.2' - provided 'com.android.support:support-annotations:23.1.0' + provided 'com.android.support:support-annotations:25.3.1' } task androidJavadocs(type: Javadoc) { diff --git a/roundedimageview/src/main/java/com/makeramen/roundedimageview/Corner.java b/roundedimageview/src/main/java/com/makeramen/roundedimageview/Corner.java index b68d562..f10b4f9 100644 --- a/roundedimageview/src/main/java/com/makeramen/roundedimageview/Corner.java +++ b/roundedimageview/src/main/java/com/makeramen/roundedimageview/Corner.java @@ -1,3 +1,19 @@ +/* +* Copyright (C) 2017 Vincent Mi +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + package com.makeramen.roundedimageview; import android.support.annotation.IntDef; diff --git a/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedDrawable.java b/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedDrawable.java index f36e007..22a9700 100644 --- a/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedDrawable.java +++ b/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedDrawable.java @@ -1,5 +1,5 @@ /* -* Copyright (C) 2015 Vincent Mi +* Copyright (C) 2017 Vincent Mi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,8 +61,8 @@ public class RoundedDrawable extends Drawable { private Shader.TileMode mTileModeY = Shader.TileMode.CLAMP; private boolean mRebuildShader = true; - // [ topLeft, topRight, bottomLeft, bottomRight ] private float mCornerRadius = 0f; + // [ topLeft, topRight, bottomLeft, bottomRight ] private final boolean[] mCornersRounded = new boolean[] { true, true, true, true }; private boolean mOval = false; diff --git a/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedImageView.java b/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedImageView.java index 2ccfcc5..d8f7f69 100644 --- a/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedImageView.java +++ b/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedImageView.java @@ -1,5 +1,5 @@ /* -* Copyright (C) 2015 Vincent Mi +* Copyright (C) 2017 Vincent Mi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.net.Uri; -import android.os.Build; import android.support.annotation.ColorInt; import android.support.annotation.DimenRes; import android.support.annotation.DrawableRes; @@ -164,10 +163,6 @@ public RoundedImageView(Context context, AttributeSet attrs, int defStyle) { updateBackgroundDrawableAttrs(true); if (mMutateBackground) { - // when setBackground() is called by View constructor, mMutateBackground is not loaded from the attribute, - // so it's false by default, what doesn't allow to create the RoundedDrawable. At this point, after load - // mMutateBackground and updated BackgroundDrawable to RoundedDrawable, the View's background drawable needs to - // be changed to this new drawable. //noinspection deprecation super.setBackgroundDrawable(mBackgroundDrawable); } @@ -534,10 +529,22 @@ public void setBorderColor(ColorStateList colors) { } } + /** + * Return true if this view should be oval and always set corner radii to half the height or + * width. + * + * @return if this {@link RoundedImageView} is set to oval. + */ public boolean isOval() { return mIsOval; } + /** + * Set if the drawable should ignore the corner radii set and always round the source to + * exactly half the height or width. + * + * @param oval if this {@link RoundedImageView} should be oval. + */ public void setOval(boolean oval) { mIsOval = oval; updateDrawableAttrs(); @@ -571,10 +578,22 @@ public void setTileModeY(Shader.TileMode tileModeY) { invalidate(); } + /** + * If {@code true}, we will also round the background drawable according to the settings on this + * ImageView. + * + * @return whether the background is mutated. + */ public boolean mutatesBackground() { return mMutateBackground; } + /** + * Set whether the {@link RoundedImageView} should round the background drawable according to + * the settings in addition to the source drawable. + * + * @param mutate true if this view should mutate the background drawable. + */ public void mutateBackground(boolean mutate) { if (mMutateBackground == mutate) { return; } diff --git a/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedTransformationBuilder.java b/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedTransformationBuilder.java index 50e94cb..1b5d678 100644 --- a/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedTransformationBuilder.java +++ b/roundedimageview/src/main/java/com/makeramen/roundedimageview/RoundedTransformationBuilder.java @@ -1,5 +1,5 @@ /* -* Copyright (C) 2015 Vincent Mi +* Copyright (C) 2017 Vincent Mi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ public final class RoundedTransformationBuilder { - //private final Resources mResources; private final DisplayMetrics mDisplayMetrics; private float[] mCornerRadii = new float[] { 0, 0, 0, 0 }; @@ -68,7 +67,7 @@ public RoundedTransformationBuilder cornerRadius(float radius) { * @param radius the radius in px. * @return the builder for chaning. */ - public RoundedTransformationBuilder cornerRadius(int corner, float radius) { + public RoundedTransformationBuilder cornerRadius(@Corner int corner, float radius) { mCornerRadii[corner] = radius; return this; } @@ -91,7 +90,7 @@ public RoundedTransformationBuilder cornerRadiusDp(float radius) { * @param radius the radius in density independent pixels. * @return the builder for chaining. */ - public RoundedTransformationBuilder cornerRadiusDp(int corner, float radius) { + public RoundedTransformationBuilder cornerRadiusDp(@Corner int corner, float radius) { return cornerRadius(corner, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, radius, mDisplayMetrics)); }