Coder Social home page Coder Social logo

multichoiceadapter's Introduction

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 ActionBarSherlock.

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

If you’re using Eclipse with the ADT plugin you can include MultiChoiceAdapter as a library project. Create a new Android project using the library/ folder as the existing source. Then, open the properties of this new project and, in the 'Android' category, add a reference to the ActionBarSherlock library project. Finally, in your application project properties, add a reference to the created library project.

If you use maven to build your Android project you can simply add a dependency for this library.

<dependency>
    <groupId>com.github.manuelpeinado.multichoiceadapter</groupId>
    <artifactId>multichoiceadapter</artifactId>
    <version>2.2.4</version>
    <type>apklib</type>
</dependency>

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.

Libraries used

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.

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
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.

multichoiceadapter's People

Contributors

manuelpeinado avatar antoniolg avatar intrications avatar drumonii avatar

Watchers

James Cloos avatar

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.