diff --git a/AwesomeSpinner/build.gradle b/AwesomeSpinner/build.gradle index 112fdde..f87e444 100644 --- a/AwesomeSpinner/build.gradle +++ b/AwesomeSpinner/build.gradle @@ -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" diff --git a/AwesomeSpinner/src/main/java/com/isapanah/awesomespinner/AwesomeSpinner.java b/AwesomeSpinner/src/main/java/com/isapanah/awesomespinner/AwesomeSpinner.java index 3bb4b36..97207e1 100644 --- a/AwesomeSpinner/src/main/java/com/isapanah/awesomespinner/AwesomeSpinner.java +++ b/AwesomeSpinner/src/main/java/com/isapanah/awesomespinner/AwesomeSpinner.java @@ -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"); @@ -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); diff --git a/README.md b/README.md index a84365a..0d7c182 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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` | diff --git a/app/build.gradle b/app/build.gradle index a9aeb40..35b8cc1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 { @@ -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' } \ No newline at end of file diff --git a/app/src/main/java/com/isapanah/awsomespinnerexample/MainActivity.java b/app/src/main/java/com/isapanah/awsomespinnerexample/MainActivity.java index 4ee4dc8..f150497 100644 --- a/app/src/main/java/com/isapanah/awsomespinnerexample/MainActivity.java +++ b/app/src/main/java/com/isapanah/awsomespinnerexample/MainActivity.java @@ -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);