Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug !!!To avoid calling the return key, you can mask a line of code in the OnCancel method of the multispinnersearch class。 #96

Open
piaomiao8179 opened this issue Oct 20, 2021 · 0 comments

Comments

@piaomiao8179
Copy link

@pratikbutani To avoid calling the return key, you can mask a line of code in the OnCancel method of the multispinnersearch class。
`
@OverRide
public void onCancel(DialogInterface dialog) {
// refresh text on spinner
// super.performClick()
StringBuilder spinnerBuffer = new StringBuilder();

    ArrayList<KeyPairBoolData> selectedData = new ArrayList<>();
    for (int i = 0; i < items.size(); i++) {
        KeyPairBoolData currentData = items.get(i);
        if (currentData.isSelected()) {
            selectedData.add(currentData);
            spinnerBuffer.append(currentData.getName());
            spinnerBuffer.append(", ");
        }
    }

    String spinnerText = spinnerBuffer.toString();
    if (spinnerText.length() > 2)
        spinnerText = spinnerText.substring(0, spinnerText.length() - 2);
    else
        spinnerText = this.getHintText();

//
ArrayAdapter adapterSpinner = new ArrayAdapter<>(getContext(), R.layout.simple_spinner, new String[]{spinnerText});
setAdapter(adapterSpinner);

    if (adapter != null)
        adapter.notifyDataSetChanged();

    listener.onItemsSelected(selectedData);
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants