Skip to content

Commit

Permalink
Add Known Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vinc3m1 committed Apr 4, 2017
1 parent 667243a commit dbb002e
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 19 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:2.3.0'
}
}

Expand Down
7 changes: 4 additions & 3 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -23,7 +24,7 @@ android {
defaultConfig {
applicationId "com.makeramen.roundedimageview.example"
minSdkVersion 14
targetSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName version
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion roundedimageview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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; }

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -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;
}
Expand All @@ -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));
}
Expand Down

0 comments on commit dbb002e

Please sign in to comment.