Skip to content

Commit 903bb6f

Browse files
committed
version 1.1.5
add getter for for textview in headerview you can set username and email with a Spannable you can set typeface for username and email
1 parent 0eeb157 commit 903bb6f

8 files changed

Lines changed: 88 additions & 49 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repositories {
1818
```
1919
```Gradle
2020
dependencies {
21-
compile 'rebus:header-view:1.1.3'
21+
compile 'rebus:header-view:1.1.5'
2222
}
2323
```
2424
### How to use

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 23
5-
buildToolsVersion '23.0.2'
5+
buildToolsVersion '23.0.3'
66

77
defaultConfig {
88
applicationId "rebus.header.view.sample"
@@ -21,7 +21,7 @@ android {
2121

2222
dependencies {
2323
compile project(':headerview')
24-
compile 'com.android.support:appcompat-v7:23.1.1'
25-
compile 'com.android.support:design:23.1.1'
24+
compile 'com.android.support:appcompat-v7:23.4.0'
25+
compile 'com.android.support:design:23.4.0'
2626
compile 'com.squareup.picasso:picasso:2.5.2'
2727
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ buildscript {
2929
jcenter()
3030
}
3131
dependencies {
32-
classpath 'com.android.tools.build:gradle:1.5.0'
32+
classpath 'com.android.tools.build:gradle:2.1.2'
3333
classpath 'com.novoda:bintray-release:0.3.4'
3434

3535
// NOTE: Do not place your application dependencies here; they belong

headerview/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
22
apply plugin: 'bintray-release'
33
android {
44
compileSdkVersion 23
5-
buildToolsVersion '23.0.2'
5+
buildToolsVersion '23.0.3'
66

77
defaultConfig {
88
minSdkVersion 8
99
targetSdkVersion 23
10-
versionCode 6
11-
versionName "1.1.4"
10+
versionCode 7
11+
versionName "1.1.5"
1212
}
1313
buildTypes {
1414
release {
@@ -21,7 +21,7 @@ android {
2121
userOrg = 'raphaelbussa'
2222
groupId = 'rebus'
2323
artifactId = 'header-view'
24-
publishVersion = '1.1.4'
24+
publishVersion = '1.1.5'
2525
}
2626

2727
}

headerview/src/main/java/rebus/header/view/AvatarView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import android.widget.ImageView;
3838

3939
@Deprecated
40-
public class AvatarView extends ImageView{
40+
public class AvatarView extends ImageView {
4141

4242
public AvatarView(Context context) {
4343
super(context);

headerview/src/main/java/rebus/header/view/BezelImageView.java

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public class BezelImageView extends ImageView {
7272

7373
private boolean isPressed = false;
7474
private boolean isSelected;
75+
private ColorMatrixColorFilter mTempDesaturateColorFilter;
76+
private ColorFilter mTempSelectorFilter;
7577

7678
public BezelImageView(Context context) {
7779
this(context, null);
@@ -128,23 +130,6 @@ protected void onSizeChanged(int w, int h, int old_w, int old_h) {
128130
}
129131
}
130132

131-
@TargetApi(21)
132-
private class CustomOutline extends ViewOutlineProvider {
133-
134-
int width;
135-
int height;
136-
137-
CustomOutline(int width, int height) {
138-
this.width = width;
139-
this.height = height;
140-
}
141-
142-
@Override
143-
public void getOutline(View view, Outline outline) {
144-
outline.setOval(0, 0, width, height);
145-
}
146-
}
147-
148133
@Override
149134
protected boolean setFrame(int l, int t, int r, int b) {
150135
final boolean changed = super.setFrame(l, t, r, b);
@@ -231,7 +216,6 @@ protected void onDraw(Canvas canvas) {
231216
isPressed = isPressed();
232217
}
233218

234-
235219
@Override
236220
public boolean dispatchTouchEvent(MotionEvent event) {
237221
// Check for clickable state and do nothing if disabled
@@ -280,7 +264,6 @@ protected boolean verifyDrawable(Drawable who) {
280264
return who == mMaskDrawable || super.verifyDrawable(who);
281265
}
282266

283-
284267
/**
285268
* Sets the color of the selector to be draw over the
286269
* CircularImageView. Be sure to provide some opacity.
@@ -293,7 +276,6 @@ public void setSelectorColor(int selectorColor) {
293276
this.invalidate();
294277
}
295278

296-
297279
@Override
298280
public void setImageDrawable(Drawable drawable) {
299281
super.setImageDrawable(drawable);
@@ -309,9 +291,6 @@ public void setImageBitmap(Bitmap bm) {
309291
super.setImageBitmap(bm);
310292
}
311293

312-
private ColorMatrixColorFilter mTempDesaturateColorFilter;
313-
private ColorFilter mTempSelectorFilter;
314-
315294
public void disableTouchFeedback(boolean disable) {
316295
if (disable) {
317296
mTempDesaturateColorFilter = this.mDesaturateColorFilter;
@@ -327,4 +306,21 @@ public void disableTouchFeedback(boolean disable) {
327306
}
328307
}
329308
}
309+
310+
@TargetApi(21)
311+
private class CustomOutline extends ViewOutlineProvider {
312+
313+
int width;
314+
int height;
315+
316+
CustomOutline(int width, int height) {
317+
this.width = width;
318+
this.height = height;
319+
}
320+
321+
@Override
322+
public void getOutline(View view, Outline outline) {
323+
outline.setOval(0, 0, width, height);
324+
}
325+
}
330326
}

headerview/src/main/java/rebus/header/view/HeaderCompactView.java

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,10 @@
2626

2727
import android.annotation.SuppressLint;
2828
import android.content.Context;
29-
import android.graphics.Bitmap;
30-
import android.graphics.Canvas;
3129
import android.graphics.Color;
32-
import android.graphics.Paint;
33-
import android.graphics.PorterDuff;
34-
import android.graphics.PorterDuffXfermode;
35-
import android.graphics.Rect;
3630
import android.graphics.Typeface;
37-
import android.graphics.drawable.BitmapDrawable;
38-
import android.graphics.drawable.Drawable;
3931
import android.os.Build;
32+
import android.text.Spannable;
4033
import android.text.TextUtils;
4134
import android.util.TypedValue;
4235
import android.view.Gravity;
@@ -222,6 +215,35 @@ public void email(String email) {
222215
this.userEmail.setText(email);
223216
}
224217

218+
219+
public void usernameTypeface(Typeface typeface) {
220+
if (typeface == null) return;
221+
this.userName.setTypeface(typeface);
222+
}
223+
224+
public void emailTypeface(Typeface typeface) {
225+
if (typeface == null) return;
226+
this.userEmail.setTypeface(typeface);
227+
}
228+
229+
public void username(Spannable username) {
230+
if (username == null) this.userName.setVisibility(GONE);
231+
this.userName.setText(username);
232+
}
233+
234+
public void email(Spannable email) {
235+
if (email == null) this.userEmail.setVisibility(GONE);
236+
this.userEmail.setText(email);
237+
}
238+
239+
public TextView getEmail() {
240+
return userEmail;
241+
}
242+
243+
public TextView getUsername() {
244+
return userName;
245+
}
246+
225247
private int height(Context context) {
226248
int result = getResources().getDimensionPixelSize(R.dimen.compact);
227249
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !belowToolbar) {

headerview/src/main/java/rebus/header/view/HeaderView.java

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,10 @@
2626

2727
import android.annotation.SuppressLint;
2828
import android.content.Context;
29-
import android.graphics.Bitmap;
30-
import android.graphics.Canvas;
3129
import android.graphics.Color;
32-
import android.graphics.Paint;
33-
import android.graphics.PorterDuff;
34-
import android.graphics.PorterDuffXfermode;
35-
import android.graphics.Rect;
3630
import android.graphics.Typeface;
37-
import android.graphics.drawable.BitmapDrawable;
38-
import android.graphics.drawable.Drawable;
3931
import android.os.Build;
32+
import android.text.Spannable;
4033
import android.text.TextUtils;
4134
import android.util.TypedValue;
4235
import android.view.Gravity;
@@ -203,6 +196,34 @@ public void email(String email) {
203196
this.userEmail.setText(email);
204197
}
205198

199+
public void usernameTypeface(Typeface typeface) {
200+
if (typeface == null) return;
201+
this.userName.setTypeface(typeface);
202+
}
203+
204+
public void emailTypeface(Typeface typeface) {
205+
if (typeface == null) return;
206+
this.userEmail.setTypeface(typeface);
207+
}
208+
209+
public void username(Spannable username) {
210+
if (username == null) this.userName.setVisibility(GONE);
211+
this.userName.setText(username);
212+
}
213+
214+
public void email(Spannable email) {
215+
if (email == null) this.userEmail.setVisibility(GONE);
216+
this.userEmail.setText(email);
217+
}
218+
219+
public TextView getEmail() {
220+
return userEmail;
221+
}
222+
223+
public TextView getUsername() {
224+
return userName;
225+
}
226+
206227
private int height(Context context) {
207228
int result = getResources().getDimensionPixelSize(R.dimen.normal);
208229
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !belowToolbar) {

0 commit comments

Comments
 (0)