Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
Conflicts:
	build.gradle
	example/build.gradle
  • Loading branch information
vinc3m1 committed Oct 22, 2014
2 parents 0e78899 + 4bfdb72 commit c1fe691
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
4 changes: 2 additions & 2 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ dependencies {
}

android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
compileSdkVersion 21g
buildToolsVersion '21.0.1'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand Down
7 changes: 6 additions & 1 deletion example/src/main/res/layout/picasso_item.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="200dip"
>
Expand All @@ -13,6 +12,8 @@
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:padding="10dip"
android:src="@drawable/photo1"
android:scaleType="center"
Expand All @@ -24,8 +25,10 @@
android:layout_height="wrap_content"
android:layout_marginBottom="36dp"
android:layout_marginLeft="36dp"
android:layout_marginStart="36dp"
android:layout_alignBottom="@+id/imageView1"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignStart="@+id/imageView1"
android:background="#7f000000"
android:paddingLeft="8dp"
android:paddingRight="8dp"
Expand All @@ -38,6 +41,7 @@
android:layout_height="wrap_content"
android:layout_above="@+id/textView3"
android:layout_alignLeft="@+id/textView3"
android:layout_alignStart="@+id/textView3"
android:layout_marginBottom="4dp"
android:background="#7f000000"
android:paddingLeft="8dp"
Expand All @@ -51,6 +55,7 @@
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_alignLeft="@+id/textView2"
android:layout_alignStart="@+id/textView2"
android:layout_marginBottom="4dp"
android:background="#7f000000"
android:paddingLeft="8dp"
Expand Down
14 changes: 10 additions & 4 deletions example/src/main/res/layout/rounded_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:padding="10dip"
android:src="@drawable/photo1"
android:scaleType="center"
app:corner_radius="30dip"
app:border_width="3dip"
app:oval="false"
app:border_color="@color/border"
app:riv_corner_radius="30dip"
app:riv_border_width="3dip"
app:riv_oval="false"
app:riv_border_color="@color/border"
/>

<TextView
Expand All @@ -28,8 +30,10 @@
android:layout_height="wrap_content"
android:layout_marginBottom="36dp"
android:layout_marginLeft="36dp"
android:layout_marginStart="36dp"
android:layout_alignBottom="@+id/imageView1"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignStart="@+id/imageView1"
android:background="#7f000000"
android:paddingLeft="8dp"
android:paddingRight="8dp"
Expand All @@ -42,6 +46,7 @@
android:layout_height="wrap_content"
android:layout_above="@+id/textView3"
android:layout_alignLeft="@+id/textView3"
android:layout_alignStart="@+id/textView3"
android:layout_marginBottom="4dp"
android:background="#7f000000"
android:paddingLeft="8dp"
Expand All @@ -55,6 +60,7 @@
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_alignLeft="@+id/textView2"
android:layout_alignStart="@+id/textView2"
android:layout_marginBottom="4dp"
android:background="#7f000000"
android:paddingLeft="8dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public static Bitmap drawableToBitmap(Drawable drawable) {
}

Bitmap bitmap;
int width = Math.max(drawable.getIntrinsicWidth(), 1);
int height = Math.max(drawable.getIntrinsicHeight(), 1);
int width = Math.max(drawable.getIntrinsicWidth(), 2);
int height = Math.max(drawable.getIntrinsicHeight(), 2);
try {
bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
setScaleType(ScaleType.FIT_CENTER);
}

cornerRadius = a.getDimensionPixelSize(R.styleable.RoundedImageView_corner_radius, -1);
borderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_border_width, -1);
cornerRadius = a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_corner_radius, -1);
borderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_riv_border_width, -1);

// don't allow negative values for radius and border
if (cornerRadius < 0) {
Expand All @@ -74,13 +74,13 @@ public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
borderWidth = DEFAULT_BORDER_WIDTH;
}

borderColor = a.getColorStateList(R.styleable.RoundedImageView_border_color);
borderColor = a.getColorStateList(R.styleable.RoundedImageView_riv_border_color);
if (borderColor == null) {
borderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
}

mutateBackground = a.getBoolean(R.styleable.RoundedImageView_mutate_background, false);
isOval = a.getBoolean(R.styleable.RoundedImageView_oval, false);
mutateBackground = a.getBoolean(R.styleable.RoundedImageView_riv_mutate_background, false);
isOval = a.getBoolean(R.styleable.RoundedImageView_riv_oval, false);

updateDrawableAttrs();
updateBackgroundDrawableAttrs(true);
Expand Down
10 changes: 5 additions & 5 deletions roundedimageview/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="RoundedImageView">
<attr name="corner_radius" format="dimension" />
<attr name="border_width" format="dimension" />
<attr name="border_color" format="color" />
<attr name="mutate_background" format="boolean" />
<attr name="oval" format="boolean" />
<attr name="riv_corner_radius" format="dimension" />
<attr name="riv_border_width" format="dimension" />
<attr name="riv_border_color" format="color" />
<attr name="riv_mutate_background" format="boolean" />
<attr name="riv_oval" format="boolean" />
<attr name="android:scaleType" />
</declare-styleable>
</resources>

0 comments on commit c1fe691

Please sign in to comment.