Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Fix the error when only one data (#152)
Browse files Browse the repository at this point in the history
If the list just one data,spinner can’t show anything
  • Loading branch information
Saxxhw authored and Angelo Marchesin committed Nov 20, 2019
1 parent fced8a4 commit a314c38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/src/main/java/org/angmarch/views/NiceSpinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public PopUpTextAlignment getPopUpTextAlignment() {
}

private <T> void setAdapterInternal(NiceSpinnerBaseAdapter<T> adapter) {
if (adapter.getCount() > 0) {
if (adapter.getCount() >= 0) {
// If the adapter needs to be set again, ensure to reset the selected index as well
selectedIndex = 0;
popupWindow.setAdapter(adapter);
Expand All @@ -372,7 +372,7 @@ private <T> void setAdapterInternal(NiceSpinnerBaseAdapter<T> adapter) {
@Override
public boolean onTouchEvent(MotionEvent event) {
if (isEnabled() && event.getAction() == MotionEvent.ACTION_UP) {
if (!popupWindow.isShowing()) {
if (!popupWindow.isShowing() && adapter.getCount() > 0) {
showDropDown();
} else {
dismissDropDown();
Expand Down

0 comments on commit a314c38

Please sign in to comment.