Skip to content

Commit

Permalink
Release v1.1.1
Browse files Browse the repository at this point in the history
- Fix arrow up and down not update when touch outside
- Improve scroll item for search type
  • Loading branch information
Chivorns committed Jul 3, 2019
1 parent 7284527 commit 9740c01
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 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.0'
implementation 'com.github.chivorns:smartmaterialspinner:1.1.1'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.chivorn.resourcemodule.MainApp;
import com.chivorn.smartmaterialspinner.SmartMaterialSpinner;
Expand Down Expand Up @@ -43,11 +47,10 @@ private void initItemListMap() {

private void renderView() {
for (int i = 0; i < 6; i++) {
SmartMaterialSpinner<String> smsp = new SmartMaterialSpinner<>(this);
final SmartMaterialSpinner<String> smsp = new SmartMaterialSpinner<>(this);
smsp.setReSelectable(true);
smsp.setHintColor(Color.GRAY);
smsp.setUnderlineColor(Color.GRAY);
// smsp.setErrorTextSize(13);
// smsp.setMultilineError(true);
smsp.setErrorText("This is error text. Hello Cambodia Kingdom of Wonder. This is error text. Hello Cambodia Kingdom of Wonder. This is error text. Hello Cambodia Kingdom of Wonder. This is error text. Hello Cambodia Kingdom of Wonder. ");
smsp.setItem(itemListMap.get(i));
smsp.setHint("Spinner " + (i + 1));
Expand All @@ -56,6 +59,18 @@ private void renderView() {
smsp.setSearchable(true);
}

smsp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(), "You selected on " + smsp.getSelectedItem(), Toast.LENGTH_SHORT).show();
}

@Override
public void onNothingSelected(AdapterView<?> parent) {
Log.i("AAA", "onNothingSelected: ");
}
});

layoutContainer.addView(smsp);
}
}
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.0'
PUBLISH_VERSION = '1.1.1'

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

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private void setGravity(Dialog dialog) {

private void scrollToSelectedItem() {
if (selectedPosition >= 0 && searchListView.isSmoothScrollbarEnabled()) {
searchListView.smoothScrollToPositionFromTop(selectedPosition, 0, 0);
searchListView.smoothScrollToPositionFromTop(selectedPosition, 0, 10);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ public void dismiss() {
if (spinnerEventsListener != null) {
spinnerEventsListener.onSpinnerClosed(this);
}
invalidate();
}

public boolean isShowing() {
Expand Down

0 comments on commit 9740c01

Please sign in to comment.