ManuelPeinado / MultiChoiceAdapter

Android - A ListView adapter with support for multiple choice modal selection
Apache License 2.0
849 stars 260 forks source link

MultiChoiceAdapter

MultiChoiceAdapter is an implementation of ListAdapter which adds support for modal multiple choice selection as in the native Gmail app.

It provides a functionality similar to that of the CHOICE_MODE_MULTIPLE_MODAL ListView mode, with two additional benefits:

A version of the library that works with the stock action is also provided, for those apps with minSdkVersion=11 or newer.

Example Image

Try out the sample application:

<img alt="Android app on Google Play" src="https://developer.android.com/images/brand/en_app_rgb_wo_45.png" />

Or browse the source code of the sample application for a complete example of use.

Including in your project

The library is pushed to Maven Central as a AAR, so you just need to add a dependency for it to your build.gradle:

dependencies {
    // Use the following if your project uses ActionBarCompat
    compile 'com.github.manuelpeinado.multichoiceadapter:multichoiceadapter-abc:3.0.0'
    // Or the following if your projet uses ActionBarSherlock
    compile 'com.github.manuelpeinado.multichoiceadapter:multichoiceadapter-abs:3.0.0'
}

Or if your project uses the stock action bar (yes, it makes sense to use MultiChoiceAdapter event in that case, as it will make your life easier):

    dependencies {
    compile 'com.github.manuelpeinado.multichoiceadapter:multichoiceadapter:3.0.0'
}

Usage

Check any of the provided tutorials:

Customization

You can customize the way the adapter behaves when an item is clicked and the action mode was already active. To do so, add an item named multiChoiceAdapterStyle to your theme, and have it reference an additional style which you define like this:

<style name="MyCustomMultiChoiceAdapter">
    <item name="itemClickInActionMode">selectItem</item>
</style>

Two values are supported:

Acknowledgements

Who's using it

Does your app use MultiChoiceAdapter? If you want to be featured on this list drop me a line.

Developed By

Manuel Peinado Gallego - manuel.peinado@gmail.com

<img alt="Follow me on Twitter" src="https://raw.github.com/ManuelPeinado/NumericPageIndicator/master/art/twitter.png" /> <img alt="Follow me on Twitter" src="https://raw.github.com/ManuelPeinado/NumericPageIndicator/master/art/google-plus.png" /> <img alt="Follow me on Twitter" src="https://raw.github.com/ManuelPeinado/NumericPageIndicator/master/art/linkedin.png" />

License

Copyright 2013 Manuel Peinado

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.