Skip to content

Commit

Permalink
Release v1.1.5 : Fix onItemSelected call twice when call setSelection
Browse files Browse the repository at this point in the history
  • Loading branch information
Chivorns committed Jul 12, 2019
1 parent 6a20fad commit 0a88de2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ The best Android spinner library for your android application with more customiz

```gradle
dependencies {
implementation 'com.github.chivorns:smartmaterialspinner:1.1.4'
implementation 'com.github.chivorns:smartmaterialspinner:1.1.5'
}
```

Expand Down
4 changes: 2 additions & 2 deletions smartmaterialspinner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ext {
LIBRARY_NAME = 'SmartMaterialSpinner'
PUBLISH_GROUP_ID = 'com.github.chivorns'
PUBLISH_ARTIFACT_ID = LIBRARY_NAME.toLowerCase()
PUBLISH_VERSION = '1.1.4'
PUBLISH_VERSION = '1.1.5'

// Bintray
BINTRAY_REPO = 'maven'
Expand All @@ -32,7 +32,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 19
versionCode 20
versionName "$PUBLISH_VERSION"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,14 @@ public void setSelection(int position) {
if (isShowing && !isSearchable && hint != null) {
position -= 1;
}
SmartMaterialSpinner.super.setSelection(hint != null ? position + 1 : position);
checkReSelectable(position);
final int finalPosition = position;
this.post(new Runnable() {
@Override
public void run() {
SmartMaterialSpinner.super.setSelection(hint != null ? finalPosition + 1 : finalPosition, false);
checkReSelectable(finalPosition);
}
});
}

@Override
Expand Down

0 comments on commit 0a88de2

Please sign in to comment.