Skip to content
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
4 changes: 2 additions & 2 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ext {
minSdkVersion = 14
targetSdkVersion = 25
versionCode = 5
versionName = "1.1.5"
versionName = "1.1.8"

supportVersion = '25.3.1'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class SwitchMultiButton extends View {
private static final float STROKE_WIDTH = 2;
private static final float TEXT_SIZE = 14;
private static final int SELECTED_COLOR = 0xffeb7b00;
private static final int BACKGROUND_COLOR = 0xffffffff;
private static final int SELECTED_TAB = 0;
private static final String FONTS_DIR = "fonts/";
/*other*/
Expand All @@ -62,6 +63,7 @@ public class SwitchMultiButton extends View {
private float mStrokeRadius;
private float mStrokeWidth;
private int mSelectedColor;
private int mBackgroundColor;
private float mTextSize;
private int mSelectedTab;
private String mTypeface;
Expand Down Expand Up @@ -97,6 +99,7 @@ private void initAttrs(Context context, AttributeSet attrs) {
mStrokeWidth = typedArray.getDimension(R.styleable.SwitchMultiButton_strokeWidth, STROKE_WIDTH);
mTextSize = typedArray.getDimension(R.styleable.SwitchMultiButton_textSize, TEXT_SIZE);
mSelectedColor = typedArray.getColor(R.styleable.SwitchMultiButton_selectedColor, SELECTED_COLOR);
mBackgroundColor = typedArray.getColor(R.styleable.SwitchMultiButton_backgroundColor, BACKGROUND_COLOR);
mSelectedTab = typedArray.getInteger(R.styleable.SwitchMultiButton_selectedTab, SELECTED_TAB);
mTypeface = typedArray.getString(R.styleable.SwitchMultiButton_typeface);
int mSwitchTabsResId = typedArray.getResourceId(R.styleable.SwitchMultiButton_switchTabs, 0);
Expand Down Expand Up @@ -128,7 +131,7 @@ private void initPaint() {
// selected text paint
mSelectedTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mSelectedTextPaint.setTextSize(mTextSize);
mSelectedTextPaint.setColor(0xffffffff);
mSelectedTextPaint.setColor(mBackgroundColor);
mStrokePaint.setAntiAlias(true);
// unselected text paint
mUnselectedTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
Expand Down Expand Up @@ -405,6 +408,7 @@ protected Parcelable onSaveInstanceState() {
bundle.putFloat("StrokeWidth", mStrokeWidth);
bundle.putFloat("TextSize", mTextSize);
bundle.putInt("SelectedColor", mSelectedColor);
bundle.putInt("BackgroundColor", mBackgroundColor);
bundle.putInt("SelectedTab", mSelectedTab);
return bundle;
}
Expand All @@ -417,6 +421,7 @@ protected void onRestoreInstanceState(Parcelable state) {
mStrokeWidth = bundle.getFloat("StrokeWidth");
mTextSize = bundle.getFloat("TextSize");
mSelectedColor = bundle.getInt("SelectedColor");
mBackgroundColor = bundle.getInt("BackgroundColor");
mSelectedTab = bundle.getInt("SelectedTab");
super.onRestoreInstanceState(bundle.getParcelable("View"));
} else {
Expand Down
3 changes: 2 additions & 1 deletion libk-switchbutton/src/main/res/values/attr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<attr name="textSize" format="dimension" />
<attr name="selectedTab" format="integer" />
<attr name="selectedColor" format="color|reference" />
<attr name="backgroundColor" format="color|reference" />
<attr name="switchTabs" format="reference" />
<attr name="typeface" format="string" />
</declare-styleable>
</resources>
</resources>