Skip to content

Commit

Permalink
Release v1.0.12
Browse files Browse the repository at this point in the history
- Fix multiple click on searchable spinner
- Fix spinner not show item if its parent is not visible before setItem
Chivorns committed Jun 10, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0bcca2d commit 8d9f1c2
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ The best Android spinner library for your android application with more customiz

```gradle
dependencies {
implementation 'com.github.chivorns:smartmaterialspinner:1.0.11'
implementation 'com.github.chivorns:smartmaterialspinner:1.0.12'
}
```

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

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

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Original file line number Diff line number Diff line change
@@ -292,8 +292,10 @@ public void onGlobalLayout() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
SmartMaterialSpinner.this.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
SmartMaterialSpinner.this.setDropDownWidth(SmartMaterialSpinner.this.getWidth());
SmartMaterialSpinner.this.setDropDownVerticalOffset(SmartMaterialSpinner.this.getHeight());
if (getWidth() != 0 && getHeight() != 0) {
SmartMaterialSpinner.this.setDropDownWidth(getWidth());
SmartMaterialSpinner.this.setDropDownVerticalOffset(getHeight());
}
if (isSpinnerEmpty()) {
SmartMaterialSpinner.this.setDropDownWidth(0);
SmartMaterialSpinner.this.setDropDownVerticalOffset(0);
@@ -484,7 +486,7 @@ private void configStaticLayout(CharSequence charSequence, TextPaint textPaint,
StaticLayout.Builder builder = StaticLayout.Builder.obtain(charSequence, 0, charSequence.length(), textPaint, mWidth)
.setAlignment(Layout.Alignment.ALIGN_NORMAL)
.setLineSpacing(0.0F, 1.0F)
.setIncludePad(false);
.setIncludePad(true);
staticLayout = builder.build();
} else {
staticLayout = new StaticLayout(errorText, textPaint, mWidth, Layout.Alignment.ALIGN_NORMAL, 1.0F, 0.0F, true);
@@ -649,6 +651,7 @@ public boolean onTouchEvent(MotionEvent event) {
public boolean performClick() {
SoftKeyboardUtil.hideSoftKeyboard(getContext());
if (isSpinnerClickable()) {
isShowing = false;
onEmptySpinnerClickListener.onEmptySpinnerClicked();
return true;
} else if (isSearchable && hintAdapter != null) {
@@ -663,18 +666,22 @@ public boolean performClick() {
AppCompatActivity appCompatActivity = scanForActivity(getContext());
if (appCompatActivity != null) {
FragmentManager fragmentManager = appCompatActivity.getSupportFragmentManager();
searchableSpinnerDialog.show(fragmentManager, "TAG");
if (!isShowing()) {
isShowing = true;
searchableSpinnerDialog.show(fragmentManager, "TAG");
}
if (spinnerEventsListener != null) {
spinnerEventsListener.onSpinnerOpened(SmartMaterialSpinner.this);
}
return true;
}
} else if (isSpinnerEmpty()) {
isShowing = false;
return true;
}

isShowing = true;
if (spinnerEventsListener != null) {
isShowing = true;
spinnerEventsListener.onSpinnerOpened(this);
}
return super.performClick();
@@ -1423,7 +1430,6 @@ public View getView(int position, View convertView, ViewGroup parent) {

@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
parent.setPadding(0, 0, 0, 0);
return buildView(position, convertView, parent, true);
}

@@ -1451,6 +1457,7 @@ private View getItemView(final View convertView, final ViewGroup parent, final b
final LayoutInflater inflater = LayoutInflater.from(mContext);
final int resId = isDropDownView ? dropdownView : itemView;
final TextView textView = (TextView) inflater.inflate(resId, parent, false);
// parent.setPadding(0, 0, 0, 0);
if (isShowing()) {
textView.setOnClickListener(new OnClickListener() {
@Override

0 comments on commit 8d9f1c2

Please sign in to comment.