Skip to content

Commit d80651b

Browse files
committed
Refactor ErrorTextAlignment to TextAlignment for reusable with other text alignment
1 parent 6d46f4c commit d80651b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

demojava/src/main/java/com/chivorn/demojava/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private void initSpinnerInJava() {
3232
spCustomColor.setItem(provinceList);
3333

3434
spSearchable.setSearchDialogGravity(Gravity.TOP);
35-
spSearchable.setErrorTextAlignment(SmartMaterialSpinner.ErrorTextAlignment.ALIGN_LEFT);
35+
spSearchable.setErrorTextAlignment(SmartMaterialSpinner.TextAlignment.ALIGN_LEFT);
3636
spSearchable.setArrowPaddingRight(19);
3737
spCustomColor.setItemColor(ContextCompat.getColor(this, R.color.custom_item_color));
3838
spCustomColor.setSelectedItemListColor(ContextCompat.getColor(this, R.color.custom_selected_item_color));

smartmaterialspinner/src/main/java/com/chivorn/smartmaterialspinner/SmartMaterialSpinner.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public class SmartMaterialSpinner<T> extends AppCompatSpinner implements Adapter
112112
private int errorLabelPosX;
113113
private int minNbErrorLine;
114114
private float currentNbErrorLines;
115-
private ErrorTextAlignment errorTextAlignment = ErrorTextAlignment.ALIGN_LEFT;
115+
private TextAlignment errorTextAlignment = TextAlignment.ALIGN_LEFT;
116116

117117

118118
//Properties about Floating Label (
@@ -988,8 +988,8 @@ public void setErrorTextColor(int errorTextColor) {
988988
invalidate();
989989
}
990990

991-
private Layout.Alignment getErrorTextLayoutAlignment(ErrorTextAlignment errorTextAlignment) {
992-
switch (errorTextAlignment) {
991+
private Layout.Alignment getErrorTextLayoutAlignment(TextAlignment textAlignment) {
992+
switch (textAlignment) {
993993
case ALIGN_LEFT:
994994
return Layout.Alignment.ALIGN_NORMAL;
995995
case ALIGN_CENTER:
@@ -1001,24 +1001,24 @@ private Layout.Alignment getErrorTextLayoutAlignment(ErrorTextAlignment errorTex
10011001
}
10021002
}
10031003

1004-
private ErrorTextAlignment getErrorTextAlignment(int attrNum) {
1004+
private TextAlignment getErrorTextAlignment(int attrNum) {
10051005
switch (attrNum) {
10061006
case 0:
1007-
return ErrorTextAlignment.ALIGN_LEFT;
1007+
return TextAlignment.ALIGN_LEFT;
10081008
case 1:
1009-
return ErrorTextAlignment.ALIGN_CENTER;
1009+
return TextAlignment.ALIGN_CENTER;
10101010
case 2:
1011-
return ErrorTextAlignment.ALIGN_RIGHT;
1011+
return TextAlignment.ALIGN_RIGHT;
10121012
default:
1013-
return ErrorTextAlignment.ALIGN_LEFT;
1013+
return TextAlignment.ALIGN_LEFT;
10141014
}
10151015
}
10161016

1017-
public ErrorTextAlignment getErrorTextAlignment() {
1017+
public TextAlignment getErrorTextAlignment() {
10181018
return errorTextAlignment;
10191019
}
10201020

1021-
public void setErrorTextAlignment(ErrorTextAlignment errorTextAlignment) {
1021+
public void setErrorTextAlignment(TextAlignment errorTextAlignment) {
10221022
this.errorTextAlignment = errorTextAlignment;
10231023
invalidate();
10241024
}
@@ -1696,7 +1696,7 @@ public interface OnSpinnerEventListener {
16961696
void onSpinnerClosed(SmartMaterialSpinner spinner);
16971697
}
16981698

1699-
public enum ErrorTextAlignment {
1699+
public enum TextAlignment {
17001700
ALIGN_LEFT,
17011701
ALIGN_CENTER,
17021702
ALIGN_RIGHT,

0 commit comments

Comments
 (0)