Skip to content

Commit cd6f485

Browse files
committed
* change dependency of core to appcompat-v7 v23.1.0
* implement new IconicsCompatButton THANKS @aacanakin
1 parent 6e2f185 commit cd6f485

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

library-core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ if (project.hasProperty('pushall') || project.hasProperty('librarycoreonly')) {
2525
}
2626

2727
dependencies {
28-
compile 'com.android.support:support-v4:23.1.0'
28+
compile 'com.android.support:appcompat-v7:23.1.0'
2929
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.mikepenz.iconics.view;
2+
3+
import android.content.Context;
4+
import android.os.Build;
5+
import android.support.v7.widget.AppCompatButton;
6+
import android.util.AttributeSet;
7+
import android.widget.TextView;
8+
9+
import com.mikepenz.iconics.Iconics;
10+
11+
public class IconicsCompatButton extends AppCompatButton {
12+
13+
public IconicsCompatButton(Context context) {
14+
super(context);
15+
}
16+
17+
public IconicsCompatButton(Context context, AttributeSet attrs) {
18+
super(context, attrs);
19+
}
20+
21+
public IconicsCompatButton(Context context, AttributeSet attrs, int defStyle) {
22+
super(context, attrs, defStyle);
23+
}
24+
25+
@Override
26+
public void setText(CharSequence text, TextView.BufferType type) {
27+
// NOTES:
28+
// 1. Need to disable the All Caps option to make Spannable work properly!
29+
// 2. This method will be called from the constructor of the super class
30+
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
31+
setAllCaps(false);
32+
}
33+
34+
if (!isInEditMode()) {
35+
super.setText(new Iconics.IconicsBuilder().ctx(getContext()).on(text).build(), type);
36+
} else {
37+
super.setText(text, type);
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)