MultiSpinner

Spinner widget with multi selectable list

License

License

GroupId

GroupId

com.thomashaertel
ArtifactId

ArtifactId

multispinner
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

aar
Description

Description

MultiSpinner
Spinner widget with multi selectable list
Project URL

Project URL

https://github.com/thomashaertel/MultiSpinner
Source Code Management

Source Code Management

https://github.com/thomashaertel/MultiSpinner

Download multispinner

How to add to project

<!-- https://jarcasting.com/artifacts/com.thomashaertel/multispinner/ -->
<dependency>
    <groupId>com.thomashaertel</groupId>
    <artifactId>multispinner</artifactId>
    <version>0.1.1</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.thomashaertel/multispinner/
implementation 'com.thomashaertel:multispinner:0.1.1'
// https://jarcasting.com/artifacts/com.thomashaertel/multispinner/
implementation ("com.thomashaertel:multispinner:0.1.1")
'com.thomashaertel:multispinner:aar:0.1.1'
<dependency org="com.thomashaertel" name="multispinner" rev="0.1.1">
  <artifact name="multispinner" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.thomashaertel', module='multispinner', version='0.1.1')
)
libraryDependencies += "com.thomashaertel" % "multispinner" % "0.1.1"
[com.thomashaertel/multispinner "0.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

MultiSpinner

Download Build Status

Android Spinner Widget with multi selectable list

Overview

MultiSpinner is a class with can be used by Android developers that need a spinner widget with multi selection capabilities. When the user touches on the spinner widget a dialog pops up with a checkbox list.

Spinner with single selection

Spinner item selection dialog

Spinner with multiple selection

Usage

Integrating the widget is quite simple. In your layout.xml add the following snippet:

...
<com.thomashaertel.widget.MultiSpinner
    android:id="@+id/spinnerMulti"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
...

After inserting the widget in your layout add the following code to your activity:

   public class MyActivity extends Activity {
       private MultiSpinner spinner;
       private ArrayAdapter<String> adapter;

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
    
           // create spinner list elements
           adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item);
           adapter.add("Item1");
           adapter.add("Item2");
           adapter.add("Item3");
           adapter.add("Item4");
           adapter.add("Item5");
    
           // get spinner and set adapter
           spinner = (MultiSpinner) findViewById(R.id.spinnerMulti);
           spinner.setAdapter(adapter, false, onSelectedListener);
    
           // set initial selection
           boolean[] selectedItems = new boolean[adapter.getCount()];
           selectedItems[1] = true; // select second item
           spinner.setSelected(selectedItems);
       }

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

Building

Gradle

From Bintray

Add maven central to your build.gradle:

buildscript {
  repositories {
    jcenter()
  }
}

repositories {
  jcenter()
}

From maven central

Add maven central to your build.gradle:

buildscript {
  repositories {
    mavenCentral()
  }
}

repositories {
  mavenCentral()
}

Then declare MultiSpinner within your dependencies:

dependencies {
  ...
  compile('com.thomashaertel:multispinner:0.1.0@aar') {
  }
  ...
}

Maven

From maven central

To use MultiSpinner within your maven build simply add

<dependency>
  <artifactId>multispinner</artifactId>
  <version>${multispinner.version}</version>
  <groupId>com.thomashaertel</groupId>
</dependency>

to your pom.xml

If you also want the sources or javadoc add the respective classifier

  <classifier>sources</classifier>

or

  <classifier>javadoc</classifier>

to the dependency.

License

Versions

Version
0.1.1