Git Product home page Git Product logo

cwac-adapter's Introduction

CWAC AdapterWrapper: Adding Bits o' Functionality

Android comes with a few "wrapper" classes, like CursorWrapper, that make it relatively easy for you to add just a bit of functionality to an existing object. The wrapper delegates all behaviors to the wrapped object; you just override the specific behaviors you need. This works well in cases where there are many possible underlying implementations, so you could not robustly accomplish these ends by subclassing.

Android lacks such a wrapper for ListAdapter, though. There is a WrappedListAdapter entry in the SDK, but it is an interface, not an implementation.

So, CWAC offers an AdapterWrapper to fill this void.

By itself, it is not terribly interesting. However, other CWAC projects, like EndlessAdapter, take advantage of it.

This Android library project is available as a JAR or as an artifact for use with Gradle. To use that, add the following blocks to your build.gradle file:

repositories {
    maven {
        url "https://repo.commonsware.com.s3.amazonaws.com"
    }
}

dependencies {
    compile 'com.commonsware.cwac:adapter:1.0.1'
}

Or, if you cannot use SSL, use http://repo.commonsware.com for the repository URL.

Usage

Just extend AdapterWrapper and override whatever adapter-related methods you wish. By default, all adapter methods delegate to the wrapped adapter. Your code can get at the wrapped adapter by calling getWrappedAdapter().

Dependencies

None at present.

Version

This is version v1.0.1 of this module. And there was much rejoicing.

Demo

There is no demo project. Please refer to EndlessAdapter for an example of using this class.

License

The code in this project is licensed under the Apache Software License 2.0, per the terms of the included LICENSE file.

Questions

If you have questions regarding the use of this code, please post a question on StackOverflow tagged with commonsware and android. Be sure to indicate what CWAC module you are having issues with, and be sure to include source code and stack traces if you are encountering crashes.

If you have encountered what is clearly a bug, please post an issue. Be certain to include complete steps for reproducing the issue.

Do not ask for help via Twitter.

Release Notes

  • v1.0.1: added Gradle build files and published AAR
  • v1.0.0: made this the official 1.0 release
  • v0.4.0: converted to Android library project

Who Made This?

CommonsWare

cwac-adapter's People

Contributors

commonsguy avatar davidbrai 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.