Skip to content

Commit

Permalink
Merge pull request #10 from sadra/hintTextColor
Browse files Browse the repository at this point in the history
Hint text color
  • Loading branch information
sadra authored Dec 17, 2018
2 parents 55030f8 + 9ccff54 commit 900981f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions AwesomeSpinner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 12
versionName "1.2.0"
versionCode 13
versionName "1.3.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AwesomeSpinner extends RelativeLayout {
private boolean _isItemResourceDeclared = false;
private int _spinnerType = 0;
private boolean _isSelected;
private final int HINT_BUTTON_NOT_SELECTED_COLOR = Color.parseColor("#aaaaaa");
private int HINT_BUTTON_NOT_SELECTED_COLOR = Color.parseColor("#aaaaaa");
private final int HINT_BUTTON_DISABLED_COLOR = Color.parseColor("#BDBDBD");
private int HINT_BUTTON_COLOR = Color.BLACK;
private final int DOWN_ARROW_DEFAULT_TINT_COLOR = Color.parseColor("#797979");
Expand Down Expand Up @@ -258,6 +258,11 @@ private void setHitButtonStyle(){
);
}

public void setHintTextColor(int color){
this.HINT_BUTTON_NOT_SELECTED_COLOR = color;
this._hintButton.setTextColor(isSelected() ? this.HINT_BUTTON_COLOR : this.HINT_BUTTON_NOT_SELECTED_COLOR);
}

public void setSelectedItemHintColor(int color){
this.HINT_BUTTON_COLOR = color;
this._hintButton.setTextColor(isSelected() ? this.HINT_BUTTON_COLOR : this.HINT_BUTTON_NOT_SELECTED_COLOR);
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ allprojects {

**Step 2.** Add the dependency:
```groovy
implementation 'com.github.sadra:AwesomeSpinner:1.2.0'
implementation 'com.github.sadra:AwesomeSpinner:1.3.0'
```

## How To Use
Expand Down Expand Up @@ -93,6 +93,7 @@ there is some controls for your spinner:
| setSelection(TEXT) | `String` value | You should pass the **item value** to select the item programatically |
| setSpinnerEnable(BOOLEAN); | `Boolean` value | If you want enable or disable the spinner, you should call this method. |
| isSpinnerEnable(); | - | Result = `boolean`: Returns **true** if the spinner is enabled, and vice versa |
| setHintTextColor(); | `int` Color | If you need to change the **Spinner Hint Text** color, just call the method and pass you color, ex: `Color.BLUE` |
| setSelectedItemHintColor(); | `int` Color | If you need to change the **Selected Item Hint** color, just call the method and pass you color, ex: `Color.BLUE` |
| setDownArrowTintColor(); | `int` Color | If you need to change the **Down Arrow** hint color, just call the method and pass you color, ex: `Color.BLUE` |

Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId "com.isapanah.awsomespinnerexample"
minSdkVersion 14
targetSdkVersion 25
versionCode 12
versionName "1.2.0"
versionCode 13
versionName "1.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -32,5 +32,5 @@ android {
dependencies {
compile 'com.android.support:design:25.4.0'
implementation project(":AwesomeSpinner")
// implementation 'com.github.sadra:AwesomeSpinner:1.2.0'
// implementation 'com.github.sadra:AwesomeSpinner:1.3.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ protected void onCreate(Bundle savedInstanceState) {
spinnerRTL = (AwesomeSpinner) findViewById(R.id.awesomeSpinner_example_rtl);
spinnerLTR = (AwesomeSpinner) findViewById(R.id.awesomeSpinner_example_ltr);

//Modify styles of spinner
spinnerRTL.setHintTextColor(Color.MAGENTA);
spinnerLTR.setSelectedItemHintColor(Color.BLUE);
spinnerLTR.setDownArrowTintColor(Color.RED);

Expand Down

0 comments on commit 900981f

Please sign in to comment.