Skip to content

Commit

Permalink
version 1.1.5
Browse files Browse the repository at this point in the history
add getter for for textview in headerview
you can set username and email with a Spannable
you can set typeface for username and email
  • Loading branch information
raphaelbussa committed Jun 10, 2016
1 parent 0eeb157 commit 903bb6f
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repositories {
```
```Gradle
dependencies {
compile 'rebus:header-view:1.1.3'
compile 'rebus:header-view:1.1.5'
}
```
### How to use
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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'
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions headerview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -21,7 +21,7 @@ android {
userOrg = 'raphaelbussa'
groupId = 'rebus'
artifactId = 'header-view'
publishVersion = '1.1.4'
publishVersion = '1.1.5'
}

}
Expand Down
2 changes: 1 addition & 1 deletion headerview/src/main/java/rebus/header/view/AvatarView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
42 changes: 19 additions & 23 deletions headerview/src/main/java/rebus/header/view/BezelImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -293,7 +276,6 @@ public void setSelectorColor(int selectorColor) {
this.invalidate();
}


@Override
public void setImageDrawable(Drawable drawable) {
super.setImageDrawable(drawable);
Expand All @@ -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;
Expand All @@ -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);
}
}
}
38 changes: 30 additions & 8 deletions headerview/src/main/java/rebus/header/view/HeaderCompactView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
37 changes: 29 additions & 8 deletions headerview/src/main/java/rebus/header/view/HeaderView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 903bb6f

Please sign in to comment.