MultiSpinner


Source link: https://github.com/thomashaertel/MultiSpinner

MultiSpinner

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.

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

Resources

A project which showcases usage of AndroidAnnotations among other open source libraries.

Android Lollipop Palette is now easy to use with Picasso.

ContactAutoCompleteTextView is a view which allows the user to search across all his contacts to get email or phone number.

This plugin generates java/android database access code by analysing sqlite migration files or sqlite databases, keeping full control of what code is generated.

sqlite-analyzer creates an in-memory sqlite database, either from a given database file or by reading sql migrations, and analyzes its tables to construct a DatabaseModel. This model is then used to generate database access code.

Merlin aims to simplify network monitoring. Providing 3 registrable callbacks for network connectivity changes: onConnect, onDisconnect and onBind.

A library mimics the circles used in optic forms.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes