Code Monkey home page Code Monkey logo

ava-project's Introduction

AdapterViewAnimator Backport

A port of AdapterViewAnimator and AdapterViewFlipper to < 11 Android. Some random notes:

  • The source code has been taken from IceCream Sandwich at the following link.
  • To keep things simple and avoid digging too much in Android's source, the RemoteViewsAdapter.RemoteAdapterConnectionCallback subclassing has been removed. Even if AdapterViewFlipper is annotated with RemoteView, it seems not to work inside App widgets. For this reason, the internal register/unregister of the BroadcastReceiver has been commented out. The class is fully functional in normal layouts, see ava-sample.
  • StackView is way more complex to port because it makes use of much more API 11 goodies like the internal Transformation Matrix. It will be ported with the help of the Android community at a later stage (hopefully).
  • AdapterViewAnimator (superclass) makes use of package private and private fields/methods of ArrayAdapter (subclass). For this reason reflection is necessary.
  • The sample module follows this Android tutorial and includes some minimal testing (using Robolectric 2.2).
  • It is left to the developer to either branch with the classic if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) ....
  • Animation package provided by NineOldAndroids.

The library is in the apklib format but given the limited number of resources added by this project, and to avoid this, a jar package will be provided. If you use the jar file, don't forget to manually merge the included attrs.xml.

The provided AdapterViewAnimator and AdapterViewFlipper both use their own custom attributes. The correct way to use them in a layout if the package is imported as apklib is (see ava-sample):

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:abp="http://schemas.android.com/apk/apk/res-auto"
    ...>
    
    <com.andrearichiardi.android.avabackport.widget.AdapterViewFlipper
        android:id="@+id/flipper"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:gravity="center"
        abp:flipInterval="500"
        abp:autoStart="true"
        abp:loopViews="true"
        abp:animateFirstView="true"
        abp:inAnimation="@drawable/slide_in_right"
        abp:outAnimation="@drawable/slide_out_left"/>

</RelativeLayout>

To include AdapterViewAnimator backport to your project add to your Maven pom.xml:

<dependency>
    <groupId>com.andrearichiardi.android</groupId>
    <artifactId>ava-backport</artifactId>
    <version>${ava-backport.version}</version>
    <type>apklib</type>
</dependency>

License

Copyright 2014 Andrea Richiardi

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.
Developed and maintained By Andrea Richiardi

ava-project's People

Contributors

arichiardi avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ecstasy2

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.