From 63af621a49a35f142ec29bdfd27a6e44025d06a4 Mon Sep 17 00:00:00 2001 From: Gilberto Santaella Date: Fri, 21 Sep 2018 18:11:10 -0500 Subject: [PATCH] Generate method to edit programmatically Typeface for CenterTextView --- .../java/com/ebanx/swipebtn/SwipeButton.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/swipe-button/src/main/java/com/ebanx/swipebtn/SwipeButton.java b/swipe-button/src/main/java/com/ebanx/swipebtn/SwipeButton.java index d8f45b2..ceec939 100644 --- a/swipe-button/src/main/java/com/ebanx/swipebtn/SwipeButton.java +++ b/swipe-button/src/main/java/com/ebanx/swipebtn/SwipeButton.java @@ -9,6 +9,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; @@ -403,7 +404,7 @@ public void onAnimationUpdate(ValueAnimator animation) { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); - if (layer!=null) { + if (layer != null) { layer.setVisibility(View.GONE); } } @@ -449,7 +450,7 @@ public void onAnimationEnd(Animator animation) { if (onStateChangeListener != null) { onStateChangeListener.onStateChange(active); } - if (layer!=null) { + if (layer != null) { layer.setVisibility(View.GONE); } } @@ -519,4 +520,18 @@ public void toggleState() { public void setCenterTextColor(Context context, int color) { centerText.setTextColor(context.getResources().getColor(color)); } + + /** + * Method for change Typeface for Text on Swipe Control + */ + public void setTypeface(Typeface typeface, int style) { + this.centerText.setTypeface(typeface, style); + } + + /** + * Method for change Typeface for Text on Swipe Control + */ + public void setTypeface(Typeface typeface) { + this.centerText.setTypeface(typeface); + } }