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

Fix the error when only one data #152

Merged
merged 1 commit into from
Nov 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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