• Stars
    star
    850
  • Rank 51,818 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 11 years ago
  • Updated about 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android - A ListView adapter with support for multiple choice modal selection

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:

  • It's easier to use, as it keeps count of the selected items, updates their background accordingly and handles checkboxes transparently.
  • It is compatible with every version of Android from 2.x. Of course, this implies that your project must use either ActionBarSherlock or the support library's ActionBarCompat.

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:

Android app on Google Play

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:

  • selectItem. Changes the selection state of the clicked item, just as if it had been long clicked. This is what the native MULTICHOICE_MODAL mode of ListView does, and what almost every app does, and thus the default value.
  • openItem. Opens the clicked item, just as if it had been clicked outside of the action mode. This is what the native Gmail app does.

Acknowledgements

Who's using it

  • My App List. With this app you can save installed applications in a list to restore them after flash or install a new ROM.
  • NFC Basic. NFC Basic is an application that allows writing and reading data using wireless technology NFC. It allows you to write content following the NFC-FORUM standards, writing tasks for Android phones, create your custom profiles (so you can do some actions in the same time), delete and clone any tags,

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

Developed By

Manuel Peinado Gallego - [email protected]

Follow me on Twitter Follow me on Twitter Follow me on Twitter

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.

More Repositories

1

FadingActionBar

Android library implementing a fading effect for the action bar, similar to the one found in the Play Music app
Java
2,872
star
2

GlassActionBar

Android - a library that adds a glass-like effect to the action bar.
Java
1,214
star
3

RefreshActionItem

Android - An action bar item which acts both as a refresh button and as a progress indicator
Java
650
star
4

ImageLayout

Android - A layout that arranges its children in relation to a background image
Java
422
star
5

QuickReturnHeader

A ListView/ScrollView header that hides when scrolling down and reappears immediately when scrolling up, regardless of how far down the list we've gone. Like the one from the Google Keep app.
Java
377
star
6

NumericPageIndicator

Android - A ViewPager page indicator that displays the current page number and (optionally) the page count
Java
251
star
7

FadingActionBar-Native

Android - A version of FadingActionBar that works with the native action bar.
Java
74
star
8

RefreshActionItem-Native

Android - A version of RefreshActionItem that works with the native action bar
Java
57
star
9

GoogleDirectionsClient

An Android client for the Google Directions API
Java
18
star
10

Android-Links

A bunch of links to Android libraries and other useful resources (blog posts, tutorials, etc.)
14
star
11

TwelveRules

Android - a library that makes it easier and safe to work with SQLite databases
Java
11
star
12

LocationService

Android library that simplifies working with the new fused location provider
Java
10
star
13

GeocodingTask

Classes to perform direct and reverse geocoding tasks in the background
Java
9
star
14

AddressFragment

Java
9
star
15

MinionAndroidHttp

An Asynchronous OkHttp Library for Android
Java
6
star
16

EasyFacebookConnect

Easy integration with Facebook for User authenticate purpose, in Android
Java
6
star
17

NumQuest

Java
1
star