Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Added font family implementation for inner text #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
134 changes: 134 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.Gravity;
Expand Down Expand Up @@ -139,6 +141,7 @@ public void setHasActivationState(boolean hasActivationState) {
this.hasActivationState = hasActivationState;
}

@RequiresApi(api = Build.VERSION_CODES.O)
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
hasActivationState = true;

Expand Down Expand Up @@ -205,6 +208,8 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr, int def
centerText.setTextColor(typedArray.getColor(R.styleable.SwipeButton_inner_text_color,
Color.WHITE));

centerText.setTypeface(typedArray.getFont(R.styleable.SwipeButton_inner_text_font_family)); //adding font family up above API 26

float textSize = DimentionUtils.converPixelsToSp(
typedArray.getDimension(R.styleable.SwipeButton_inner_text_size, 0), context);

Expand Down
1 change: 1 addition & 0 deletions swipe-button/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<attr name="button_bottom_padding" format="dimension"/>
<attr name="button_background" format="reference"/>
<attr name="has_activate_state" format="boolean"/>
<attr name="inner_text_font_family" format="reference"/>
<attr name="initial_state" format="enum">
<enum name="enabled" value="0"/>
<enum name="disabled" value="1"/>
Expand Down