Skip to content

Commit 0a88de2

Browse files
committed
Release v1.1.5 : Fix onItemSelected call twice when call setSelection
1 parent 6a20fad commit 0a88de2

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The best Android spinner library for your android application with more customiz
113113

114114
```gradle
115115
dependencies {
116-
implementation 'com.github.chivorns:smartmaterialspinner:1.1.4'
116+
implementation 'com.github.chivorns:smartmaterialspinner:1.1.5'
117117
}
118118
```
119119

smartmaterialspinner/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ext {
55
LIBRARY_NAME = 'SmartMaterialSpinner'
66
PUBLISH_GROUP_ID = 'com.github.chivorns'
77
PUBLISH_ARTIFACT_ID = LIBRARY_NAME.toLowerCase()
8-
PUBLISH_VERSION = '1.1.4'
8+
PUBLISH_VERSION = '1.1.5'
99

1010
// Bintray
1111
BINTRAY_REPO = 'maven'
@@ -32,7 +32,7 @@ android {
3232
defaultConfig {
3333
minSdkVersion 14
3434
targetSdkVersion 28
35-
versionCode 19
35+
versionCode 20
3636
versionName "$PUBLISH_VERSION"
3737

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

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,14 @@ public void setSelection(int position) {
794794
if (isShowing && !isSearchable && hint != null) {
795795
position -= 1;
796796
}
797-
SmartMaterialSpinner.super.setSelection(hint != null ? position + 1 : position);
798-
checkReSelectable(position);
797+
final int finalPosition = position;
798+
this.post(new Runnable() {
799+
@Override
800+
public void run() {
801+
SmartMaterialSpinner.super.setSelection(hint != null ? finalPosition + 1 : finalPosition, false);
802+
checkReSelectable(finalPosition);
803+
}
804+
});
799805
}
800806

801807
@Override

0 commit comments

Comments
 (0)