diff --git a/README.md b/README.md index e8f0735..c48a52a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ repositories { ``` ```Gradle dependencies { - compile 'rebus:header-view:1.1.3' + compile 'rebus:header-view:1.1.5' } ``` ### How to use diff --git a/app/build.gradle b/app/build.gradle index 0553984..ab8366f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 23 - buildToolsVersion '23.0.2' + buildToolsVersion '23.0.3' defaultConfig { applicationId "rebus.header.view.sample" @@ -21,7 +21,7 @@ android { dependencies { compile project(':headerview') - compile 'com.android.support:appcompat-v7:23.1.1' - compile 'com.android.support:design:23.1.1' + compile 'com.android.support:appcompat-v7:23.4.0' + compile 'com.android.support:design:23.4.0' compile 'com.squareup.picasso:picasso:2.5.2' } diff --git a/build.gradle b/build.gradle index 9f161d0..b048fbc 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' + classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.novoda:bintray-release:0.3.4' // NOTE: Do not place your application dependencies here; they belong diff --git a/headerview/build.gradle b/headerview/build.gradle index 6bb0376..7f64964 100644 --- a/headerview/build.gradle +++ b/headerview/build.gradle @@ -2,13 +2,13 @@ apply plugin: 'com.android.library' apply plugin: 'bintray-release' android { compileSdkVersion 23 - buildToolsVersion '23.0.2' + buildToolsVersion '23.0.3' defaultConfig { minSdkVersion 8 targetSdkVersion 23 - versionCode 6 - versionName "1.1.4" + versionCode 7 + versionName "1.1.5" } buildTypes { release { @@ -21,7 +21,7 @@ android { userOrg = 'raphaelbussa' groupId = 'rebus' artifactId = 'header-view' - publishVersion = '1.1.4' + publishVersion = '1.1.5' } } diff --git a/headerview/src/main/java/rebus/header/view/AvatarView.java b/headerview/src/main/java/rebus/header/view/AvatarView.java index 417048d..5db98a5 100644 --- a/headerview/src/main/java/rebus/header/view/AvatarView.java +++ b/headerview/src/main/java/rebus/header/view/AvatarView.java @@ -37,7 +37,7 @@ import android.widget.ImageView; @Deprecated -public class AvatarView extends ImageView{ +public class AvatarView extends ImageView { public AvatarView(Context context) { super(context); diff --git a/headerview/src/main/java/rebus/header/view/BezelImageView.java b/headerview/src/main/java/rebus/header/view/BezelImageView.java index 51c8b52..dbaed26 100644 --- a/headerview/src/main/java/rebus/header/view/BezelImageView.java +++ b/headerview/src/main/java/rebus/header/view/BezelImageView.java @@ -72,6 +72,8 @@ public class BezelImageView extends ImageView { private boolean isPressed = false; private boolean isSelected; + private ColorMatrixColorFilter mTempDesaturateColorFilter; + private ColorFilter mTempSelectorFilter; public BezelImageView(Context context) { this(context, null); @@ -128,23 +130,6 @@ protected void onSizeChanged(int w, int h, int old_w, int old_h) { } } - @TargetApi(21) - private class CustomOutline extends ViewOutlineProvider { - - int width; - int height; - - CustomOutline(int width, int height) { - this.width = width; - this.height = height; - } - - @Override - public void getOutline(View view, Outline outline) { - outline.setOval(0, 0, width, height); - } - } - @Override protected boolean setFrame(int l, int t, int r, int b) { final boolean changed = super.setFrame(l, t, r, b); @@ -231,7 +216,6 @@ protected void onDraw(Canvas canvas) { isPressed = isPressed(); } - @Override public boolean dispatchTouchEvent(MotionEvent event) { // Check for clickable state and do nothing if disabled @@ -280,7 +264,6 @@ protected boolean verifyDrawable(Drawable who) { return who == mMaskDrawable || super.verifyDrawable(who); } - /** * Sets the color of the selector to be draw over the * CircularImageView. Be sure to provide some opacity. @@ -293,7 +276,6 @@ public void setSelectorColor(int selectorColor) { this.invalidate(); } - @Override public void setImageDrawable(Drawable drawable) { super.setImageDrawable(drawable); @@ -309,9 +291,6 @@ public void setImageBitmap(Bitmap bm) { super.setImageBitmap(bm); } - private ColorMatrixColorFilter mTempDesaturateColorFilter; - private ColorFilter mTempSelectorFilter; - public void disableTouchFeedback(boolean disable) { if (disable) { mTempDesaturateColorFilter = this.mDesaturateColorFilter; @@ -327,4 +306,21 @@ public void disableTouchFeedback(boolean disable) { } } } + + @TargetApi(21) + private class CustomOutline extends ViewOutlineProvider { + + int width; + int height; + + CustomOutline(int width, int height) { + this.width = width; + this.height = height; + } + + @Override + public void getOutline(View view, Outline outline) { + outline.setOval(0, 0, width, height); + } + } } diff --git a/headerview/src/main/java/rebus/header/view/HeaderCompactView.java b/headerview/src/main/java/rebus/header/view/HeaderCompactView.java index 580d42a..b5c2512 100644 --- a/headerview/src/main/java/rebus/header/view/HeaderCompactView.java +++ b/headerview/src/main/java/rebus/header/view/HeaderCompactView.java @@ -26,17 +26,10 @@ import android.annotation.SuppressLint; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffXfermode; -import android.graphics.Rect; import android.graphics.Typeface; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.os.Build; +import android.text.Spannable; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; @@ -222,6 +215,35 @@ public void email(String email) { this.userEmail.setText(email); } + + public void usernameTypeface(Typeface typeface) { + if (typeface == null) return; + this.userName.setTypeface(typeface); + } + + public void emailTypeface(Typeface typeface) { + if (typeface == null) return; + this.userEmail.setTypeface(typeface); + } + + public void username(Spannable username) { + if (username == null) this.userName.setVisibility(GONE); + this.userName.setText(username); + } + + public void email(Spannable email) { + if (email == null) this.userEmail.setVisibility(GONE); + this.userEmail.setText(email); + } + + public TextView getEmail() { + return userEmail; + } + + public TextView getUsername() { + return userName; + } + private int height(Context context) { int result = getResources().getDimensionPixelSize(R.dimen.compact); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !belowToolbar) { diff --git a/headerview/src/main/java/rebus/header/view/HeaderView.java b/headerview/src/main/java/rebus/header/view/HeaderView.java index c3625e9..a1e2f7b 100644 --- a/headerview/src/main/java/rebus/header/view/HeaderView.java +++ b/headerview/src/main/java/rebus/header/view/HeaderView.java @@ -26,17 +26,10 @@ import android.annotation.SuppressLint; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffXfermode; -import android.graphics.Rect; import android.graphics.Typeface; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.os.Build; +import android.text.Spannable; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; @@ -203,6 +196,34 @@ public void email(String email) { this.userEmail.setText(email); } + public void usernameTypeface(Typeface typeface) { + if (typeface == null) return; + this.userName.setTypeface(typeface); + } + + public void emailTypeface(Typeface typeface) { + if (typeface == null) return; + this.userEmail.setTypeface(typeface); + } + + public void username(Spannable username) { + if (username == null) this.userName.setVisibility(GONE); + this.userName.setText(username); + } + + public void email(Spannable email) { + if (email == null) this.userEmail.setVisibility(GONE); + this.userEmail.setText(email); + } + + public TextView getEmail() { + return userEmail; + } + + public TextView getUsername() { + return userName; + } + private int height(Context context) { int result = getResources().getDimensionPixelSize(R.dimen.normal); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !belowToolbar) {