Code Monkey home page Code Monkey logo

multispinner's People

Contributors

akiller avatar thomashaertel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

multispinner's Issues

"spinnerStyle" has already been defined

We have android.widget.Spinner in our project. Can MultiSpinner coexist with those widgets?

The error we get is "Error:(186) Attribute "spinnerStyle" has already been defined"

Any suggestions?

When mAllText is set, spinner always shows allText if at least one element is selected.

There is a bug in logic:
MultiSpinner, line 197

someUnselected && !(mAllText != null && mAllText.length() > 0)

event if someUnselected is true, when mAllText is set the whole expression will evaluate to false and mAllText will be used
I see that the code in repository has new mAllSelectedDisplayMode property, but it is still broken when UseAllText is used.

I think the intention was for it to work like this:

someUnselected || mAllText == null || mAllText.length() == 0

Cheers,
Greg.

How to use spinner itemSelected listener with custom object data

i have got cityBean type of class (that data is showing in spinner).now when i click on any item i want that item in listener ..how do i do it ..please help

private MultiSpinner.MultiSpinnerListener onSelectedListener = new MultiSpinner.MultiSpinnerListener() {
    public void onItemsSelected(boolean[] selected) {
        // Do something here with the selected items

}

null object reference

I can select the differents choices but when I valid by ok it answers me :

Attempt to invoke interface method 'void com.thomashaertel.widget.MultiSpinner$MultiSpinnerListener.onItemsSelected(boolean[])' on a null object reference at line 69 : "mListener.onItemsSelected(mSelected);"

In my app i've writen this in order to count the choices checked :
onSelectedListener = new MultiSpinner.MultiSpinnerListener() {
public void onItemsSelected(boolean[] selected) {
// Do something here with the selected items
nombrechoix=0;
for (int i=1;i<=adapter.getCount();i++) {
if (selected[i - 1] = true) {
nombrechoix++;
}
}
question1b.setText(""+nombrechoix);
}
};

Please help me !
Thanks (sorry for my bad english)

Showing selected item programmatically

Hello, I'm trying to show selected items.

@BindView(R.id.spDegree)
MultiSpinner spDegree;


String[] degreesList = degrees.split(",");

for (int i = 0; i < degreeModels.size(); i++) {
DegreeModel model = degreeModels.get(i);
for (int j = 0; j <; j++) {
     if (degreesList[i].trim().equalsIgnoreCase(model.getTitle())) {
         spDegree..setSelection(i);
     }
 }
}

But not able to show selected items

setAllText does not always set the text?

Hi,

We have hit an issue with this widget when we select items and then call setAllText some times it does not set at all but if you open the MultiSelect again and click OK it then sets.

Setting up the Multi Select widget

engSpinner = (MultiSpinner) findViewById(R.id.engSpinner);
 engSpinner.setAdapter(adapter, false, onSelectedListener);

The code below on the first run selecting all items it shows the engineers in the toast message but not on the text field of the multi Select.

private MultiSpinner.MultiSpinnerListener onSelectedListener = new MultiSpinner.MultiSpinnerListener() {
        public void onItemsSelected(boolean[] selected) {
            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < selected.length; i++) {
                if (selected[i]) {
                    builder.append(adapter.getItem(i)).append(" ");
                }
            }
            Toast.makeText(getApplicationContext(), builder.toString(), Toast.LENGTH_SHORT).show();
            engSpinner.setAllText(builder.toString());
        }
    };

Any help would be much appreciated it appears to be that just calling engSpinner.setAllText requires the refresh method to be called perhaps?

Trouble Installing

Hi there, I'm having some trouble adding this into my Android Studio app. When I add into my compile dependencies it returns an error upon gradle sync. I tried following the install instructions included, but no go. Can you help?

Error:(26, 13) Failed to resolve: com.thomashaertel:multispinner:0.1.0
Show in File

Show in Project Structure dialog

Not working when used on an overlay (always on top) window

I have a use case where I start a background Service and then draw an overlay over the current screen (always on top) by using:
WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
windowManager.addView(myView, params)

I've added the spinner on myView and it displays correctly, but when I click it I get this Exception:
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application at android.view.ViewRootImpl.setView(ViewRootImpl.java:536) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at android.app.Dialog.show(Dialog.java:286)

Exception is nothing specific to this component, it happens when you try the draw a Dialog on any overlay screen.

I've fixed it by adding this permission to the app (android.permission.SYSTEM_ALERT_WINDOW) and by modifying the code of MultiSpinner, adding this in the OnClickListener.onClick():
AlertDialog dialog = builder.create(); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.show();

I suggest adding a flag to MultiSpinner to support displaying a dialog in this way.

I can't added to my project

Hi, I tried to add your multiSpinner to my project but it's has been imposible. I use Gradle with maven and If I code what you say on readme I obtain this error:

Error:(59, 13) Failed to resolve: com.thomashaertel:multispinner:0.1.0

I tried too many things, but nothing works.

MultiSpinner text not set if every entry is selected

Hi,

as soon as every entry in the multispinner is selected, that is no longer shown in the spinner itself.
I worked around that with a listener for now.

The problem is that "someUnselected" is false if everything is selected, see line 167 class MultiSpinner in version 0.1.1:

if (someUnselected && !(mAllText != null && mAllText.length() > 0)) { spinnerText = spinnerBuffer.toString(); if (spinnerText.length() > 2) spinnerText = spinnerText.substring(0, spinnerText.length() - 2); } else { spinnerText = mAllText; }

Cheers

add select all option

hei thanks fro giving this for open source can you please explain me how to add select all option

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.