Git Product home page Git Product logo

nineoldandroids's Introduction

DEPRECATED

NineOldAndroids is deprecated. No new development will be taking place. Existing versions will (of course) continue to function. New applications should use minSdkVersion="14" or higher which has access to the platform animation APIs.

Thanks for all your support!

Nine Old Androids

Android library for using the Honeycomb (Android 3.0) animation API on all versions of the platform back to 1.0!

Note: LayoutTransition is present and it is not be possible to implement prior to Android 3.0.

Usage

The API is exactly the same as the Honeycomb API, just change your imports to use com.nineoldandroids.XXX.

Take a look at a few demos taken from the platform ApiDemos in the sample/ folder. You can also try it out on the Play Store.

More information is available on nineoldandroids.com.

Including In Your Project

This library is presented as a .jar file which you can include in the libs/ folder of your application. You can download the latest version from the GitHub downloads page.

If you are a Maven user you can easily include the library by specifying it as a dependency:

<dependency>
  <groupId>com.nineoldandroids</groupId>
  <artifactId>library</artifactId>
  <version>2.4.0</version>
</dependency>

Developed By

License

Copyright 2012 Jake Wharton

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.

nineoldandroids's People

Contributors

fpillet avatar jakewharton avatar jfmichel avatar jpmcosta avatar simonvt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nineoldandroids's Issues

missing android.R..attrs

on pre 3.0 you will be missing certain android.r.attrs.* items..

May I suggest just copying that set of items from the full 4.0.3 attrs.xml

Of course you will have to change those imports to reflect..but seems workable..

android.R.attr.ordering,
android.R.attr.propertyName
android.R.attr.valueType,
android.R.attr.valueFrom
android.R.attr.valueTo

the attrs.xml items from 4.0.3 would be:

 <!-- ========================== -->
    <!-- AnimatorSet class attributes -->
    <!-- ========================== -->
    <eat-comment />

    <declare-styleable name="AnimatorSet">
        <!-- Name of the property being animated. -->
        <attr name="ordering">
            <!-- child animations should be played together. -->
            <enum name="together" value="0" />
            <!-- child animations should be played sequentially, in the same order as the xml. -->
            <enum name="sequentially" value="1" />
        </attr>
    </declare-styleable>

 <!-- ========================== -->
    <!-- ObjectAnimator class attributes -->
    <!-- ========================== -->
    <eat-comment />

    <declare-styleable name="PropertyAnimator">
        <!-- Name of the property being animated. -->
        <attr name="propertyName" format="string"/>
    </declare-styleable>


<!-- ========================== -->
    <!-- ValueAnimator class attributes -->
    <!-- ========================== -->
    <eat-comment />

    <declare-styleable name="Animator">
        <!-- Defines the interpolator used to smooth the animation movement in time. -->
        <attr name="interpolator" />
        <!-- Amount of time (in milliseconds) for the animation to run. -->
        <attr name="duration" />
        <!-- Delay in milliseconds before the animation runs, once start time is reached. -->
        <attr name="startOffset"/>
        <!-- Defines how many times the animation should repeat. The default value is 0. -->
        <attr name="repeatCount"/>
        <!-- Defines the animation behavior when it reaches the end and the repeat count is
             greater than 0 or infinite. The default value is restart. -->
        <attr name="repeatMode"/>
        <!-- Value the animation starts from. -->
        <attr name="valueFrom" format="float|integer|color|dimension"/>
        <!-- Value the animation animates to. -->
        <attr name="valueTo" format="float|integer|color|dimension"/>
        <!-- The type of valueFrom and valueTo. -->
        <attr name="valueType">
            <!-- valueFrom and valueTo are floats. This is the default value is valueType is
                 unspecified. Note that if either valueFrom or valueTo represent colors
                 (beginning with "#"), then this attribute is ignored and the color values are
                 interpreted as integers. -->
            <enum name="floatType" value="0" />
            <!-- valueFrom and valueTo are integers. -->
            <enum name="intType"   value="1" />
        </attr>
    </declare-styleable>

That will fix it on 1.6 which I am or will be testing against

ObjectAnimator does not proxy View properties when created from PropertyValuesHolder

I noticed this when I switched my code from using multiple ObjectAnimators to using a single ObjectAnimator + multiple PropertyValuesHolders.

This code will work:

ObjectAnimator.ofFloat(myView, "alpha", 0f, 1f).start();

This code will not work:

PropertyValuesHolder pvh = PropertyValuesHolder.ofFloat("alpha", 0f, 1f);
ObjectAnimator.ofPropertyValuesHolder(myView, pvh).start();

The culprit is pretty obvious, you see this in LogCat:

E/PropertyValuesHolder(4615): Couldn't find setter/getter for property alpha with value type float

It seems to me that PVH should be able to proxy a View's properties just as well as a vanilla ObjectAnimator. Obviously it's an extra layer of indirection but if ObjectAnimator can do it, PropertyValuesHolder should be able to do so as well.

possible to 'unstick' animation?

I'm not entirely sure if this is a bug, a limitation, or user-error, so I'm posting here and hoping for some advice.

I'm attempting to set the layoutparams of an already-animated view in the onAnimationEnd method as suggested in many of the closed issues, but it seems that when I do this, the view itself (where its clickable) moves correctly but the animated version (where it shows up) is then offset by the same number of pixels. This is my first dive into legitimate animation, but it appears that the animated translation (x + 150) is kind of 'sticking' even after I update the layoutparams, rather than clearing itself as I was hoping. I dont see any methods or documentation for clearing it manually via code - is there a way to do that?

Also, if i take the opposite approach, and update the layout params first and then animate from -x to 0, it works correctly with the exception of a momentary blip between the layout applying and the animation starting (I'm assuming that the animator calls invalidate() on the first frame before applying transitions?). if there is a way to skip the 'fill before'-esque initial draw, that would work fine for me too.

I'm using nineoldandroids-2.4.0.jar and API 10. Any help would be appreciated.

setListener causes MemoryLeak

On JB & NineOldAndroids 2.4.0, when I do a setListener() on a ViewPropertyAnimator, the listener is always leaked (and my whole activity with it because it is an inner class).

Fyi, I tried modifying the lib and used a WeakReference for the listener. This fixed the leak issue, but now the listener is sometimes garbage collected before the animation finished.

code:
animate(tv).setDuration(0).x(deviceWidth).setListener(new AnimatorListener() {
@OverRide
public void onAnimationStart(Animator anim) {
}
@OverRide
public void onAnimationRepeat(Animator anim) {
}
@OverRide
public void onAnimationEnd(Animator anim) {
tv.setVisibility(View.VISIBLE);
ValueAnimator posAnim = ObjectAnimator.ofFloat(tv, "x", -width);
posAnim.setDuration(width * SCROLLING_FACTOR / deviceWidth);
posAnim.setInterpolator(new LinearInterpolator());
posAnim.setRepeatCount(ValueAnimator.INFINITE);
posAnim.start();
}
@OverRide
public void onAnimationCancel(Animator anim) {
}
});

nineoldandroids-sample-2.2.0.apk bug

Hi Jake. Apk crashes on my SE Ray Android 2.3.4.
Here is what logcat says:
java.lang.NumberFormatException: unable to parse '@16973911' as integer
at java.lang.Integer.parse(Integer.java:383)
at java.lang.Integer.parseInt(Integer.java:372)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122)
at android.content.res.TypedArray.getInt(TypedArray.java:254)
at com.nineoldandroids.animation.AnimatorInflater.createAnimatorFromXml(AnimatorInflater.java:152)
at com.nineoldandroids.animation.AnimatorInflater.createAnimatorFromXml(AnimatorInflater.java:121)
at com.nineoldandroids.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:100)

ViewPropertyAnimator inconsistency between platforms

Hi Jake,

I've used ViewPropertyAnimator to simply move a button on the screen

ViewPropertyAnimator viewAnimator = animate(button);
viewAnimator.setDuration(1500);
viewAnimator.translationXBy(250);
viewAnimator.translationYBy(150);
viewAnimator.start();

on Android 3.x and above the button is tappable even after the animation has ended, while on Android 2.x it isn't.
I know that Android 2.x uses the old view animation system where the object actually doesn't move and you have to adjust its position in the callback. But can this be considered an inconsistency of the library? Should I write different code depending on the underlying animation system?

Thanks for your library! :)

Animate() is not applicable[...]

Hello,

I'm trying to use NineOldAndroids library to rewrite my animations but I can't animate my RelativeLayouts.

Code :
animate(otherContainer).setAlpha(Math.max(0f, Math.min(2f, 1f - 9f * Math.abs(diffX2) / v.getWidth()/2)));

And I got the error : "The method animate() in the type View is not applicable for the arguments (RelativeLayout)"

Any idea ?

Inflating translate and alpha from a <set>.

Hello everybody. I am working on a port as well and I tried to inflate:

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false" >
    <translate
        android:duration="@android:integer/config_mediumAnimTime"
        android:fromXDelta="50%p"
        android:toXDelta="0" />
    <alpha
        android:duration="@android:integer/config_mediumAnimTime"
        android:fromAlpha="0.0"
        android:toAlpha="1.0" />
</set>

I saw that the code launches a RuntimeException on the translate element. The case is not handled by AnimatorInflator. Would it make sense to add the branch for translate (and alpha) and build an AnimatorSet in the recursive function in order to solve? I am definitely interested and I will be able to contribute.

Thanks!

AnimatorInflater.loadAnimator incorrect evaulator with color values

AnimatorInflater.loadAnimator() does not appear to properly set the TypeEvaluator to ArgbEvaluator if valueFrom or valueTo is set to a color. This is due to the fact that ValueAnimator.setEvaulator() does nothing if no values have been set.

So if in AnimatorInflater.loadAnimator() these lines are uncommented as in the orignial framework code:

//TypeEvaluator evaluator = null;
//if (evaluator != null) {
//    anim.setEvaluator(evaluator);
//}

and

anim.setEvaluator(new ArgbEvaluator());

is changed to

evaluator = new ArgbEvaluator();

it should work properly.

Backport of android.transition package

I'm currently playing around with a backport of the android.transition package. To me, this seems like a perfect fit for inclusion into NineOldAndroids to give a more complete backward compatible animation library.

If it is indeed possible to backport the transition framework all the way back to Android 1.0 (and I've not looked into it enough to know if I can) then would you consider including these into NOA itself? Another option could be to create a new library which has a hard dependency on NOA to provide pre-honeycomb support.

Let me know what you think.

StackOverflowError on devices < 3.0

I get the same exception when running Path Animation, Toggles or ViewPropertyAnimator Demo on an Xperia Play (2.3) and Galaxy S (2.1) here.

E/AndroidRuntime( 4016): java.lang.StackOverflowError
E/AndroidRuntime( 4016): at java.util.WeakHashMap.poll(WeakHashMap.java:569)
E/AndroidRuntime( 4016): at java.util.WeakHashMap.get(WeakHashMap.java:473)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:33)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
E/AndroidRuntime( 4016): at com.nineoldandroids.view.animation.AnimatorProxy.wrap(AnimatorProxy.java:35)
< and so on>

Transition bug?

Hi Mr Wharton,
i'm trying to do a simple transitionY animation:
I have a RelativeLayout and i move it up and down just pressing a button.
The animation works great but i think that the response of the button stay in the original position.
It seems that the animation move only the graphics and the button touch area stay in the original position and not in the "new" position.

What's wrong?

Thank you very much!
Andrea

AnimatorInflater bug

In my app I have ObjectAnimator that I want to inflate from XML
Here is my XML:

 <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
                    android:valueTo="0.75"
                    android:valueFrom="1"
                    android:propertyName="scaleX"
                    android:duration="@android:integer/config_mediumAnimTime"/>

But after inflating it's mValue field is "scaleX: 0.0 0.0 "

ViewHelper.setScaleX/Y breaks touch and redraw on android 2.3

I'd like to use NineOldAndroid to scale complex views on android 2.3

Example
I have a view with one button. I scale down the view to to 0.5 both X/Y.
On older devices (2.3 or lower) the button cannot be clicked anymore (the hit area doesn't seem to follow the transformation), and layout falls into pieces.

Is there anything we can do?

Thank you,
Akos

Found bug in AnimatorSet's AnimatorListener

I have the following code :
AnimatorSet set = new AnimatorSet ( );
ObjectAnimator oax = ObjectAnimator.ofFloat ( layout, "scaleX", scalingSt, scalingEn );
ObjectAnimator oay = ObjectAnimator.ofFloat ( layout, "scaleY", scalingSt, scalingEn );
set.playTogether ( oax, oay );
set.setDuration ( 800 );
set.setStartDelay ( waitMilis );
set.start ( );
set.addListener ( listener );
For some reason the registered set's listener would not call OnAnimationStart. I guess the problem is that the set do not call it as OnAnimationEnd is being called properly. What I did to bypass the problem was to register listener to oax. Hope this would save somebody little time

Re-add `AnimationInflater`

The AnimationInflater was dropped from 1.0 due to ambiguity of how to properly determine the type of an attribute value without using TypedArray. It should be possible to read in the value as a string and then determine the type.

Maven Dependency

I am trying to include this in my project with Maven. My pom.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.roqbot</groupId>
    <artifactId>neo</artifactId>
    <version>0.0.1</version>
    <packaging>apk</packaging>
    <name>neo</name>

    <properties>
        <platform.version> 4.0.1.2
            </platform.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>com.actionbarsherlock</groupId>
          <artifactId>actionbarsherlock</artifactId>
          <version>4.2.0</version>
          <type>apklib</type>
        </dependency>
        <dependency>
          <groupId>com.viewpagerindicator</groupId>
          <artifactId>library</artifactId>
          <version>2.4.1</version>
          <type>apklib</type>
        </dependency>
        <dependency>
          <groupId>com.nineoldandroids</groupId>
          <artifactId>library</artifactId>
          <version>2.3.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.4.0</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>16</platform>
                    </sdk>
                                        <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

The library downloads fine to .m2, however it is not put into target/libs like I am assuming it should be. Is there something wrong with my pom?

Different behaviors between pre 3.0 and 3.0+ versions

Hi,

First of all thanks for sharing this compatibility library with the community. I am using NineOldAndroids, basically to solve this particular problem.

Before using NineOldAndroids, my application would crash on pre-honeycomb devices with a ClassNotFoundException (for ObjectAnimator) and after using it, it runs fine but... I still get the same problem that I had with the animation API (the position of the animated view is still bound to its previous location). I should mention, that I don't have this problem on post-honeycomb devices.

I don't really understand why, given that your compatibility library is an extraction of the entire new API as I understand.

What do you think?

Thanks!

Animation running very slow

Hi, i am developing the third level of my game for child education and using almost the same animations as i did in the first and the second level of the game but the animations are running very slow in third level to such an extent that i can count the steps of the animation.
The only difference between (first/second ) and third level is that the third level has increased number of images and that it has a countdown timer. Can anyone help me out in this issue?

Lint

Hi I know this is minor. but could you add: @SuppressLint("NewApi") to any of your classes that wrap the views?

If I get chance I'll do it and pull request it for you if thats easier?

Cheers,
Chris

animating "x" property

Can I animate "X" property using this library? All I got on pre-11 API is:
Couldn't find setter/getter for property X with value type float
Couldn't find no-arg method for property X: java.lang.NoSuchMethodException: getX

If no, could you tell me how to read "translationX" property of a view, if this is available after Android 3.0? How is library doing that?

onclick event on animated imageview

The onclick event on animated view is not working. i followed following way

animate(tv).setDuration(2000).rotationYBy(720).x(100).y(100);

    tv.setOnClickListener(this);

Alpha animation in pre-HC not working if view has background

A simple alpha animation ....

ViewPropertyAnimator.animate(view).alpha(0.0f); // does nothing pre-HC if view has background

... appears to do nothing on pre-HC (Gingerbread, specifically) if the view has a background. Specifically, a color background (ColorDrawable) -- I haven't tested other background drawables.

If I add a transformation such as a rotation ...

ViewPropertyAnimator.animate(view).alpha(0.0f).rotationBy(45f); // works fine

... then it all works fine. Also, if I remove the background from the view, it works fine even when only the alpha property is changed.

I've studied the code a bit, and it pretty much seems like the alpha animation is being done in the same way as the built-in, old-style AlphaAnimation. But the AlphaAnimation works fine, so I guess something is different.

On Gingerbread, view keeps receiving interaction even after applying View.GONE visibility

Hi, I ran into this issue: a view that receives a fade-out animation followed by a View.INVISIBLE or View.GONE status on the onEndAnimation listener, will still receive events on 2.3.3 (probably all pre-hc versions).
It looks like a bug on these versiosn, and a proposed solution is at http://stackoverflow.com/questions/4728908/android-view-with-view-gone-still-receives-ontouch-and-onclick , calling clearAnimation() , could this safely be handled in the library ? Or are there any side-effects of using this workaround ?

Thanks
nobre

ViewPropertyAnimator.start() (and some other methods) fails on Honeycomb

The cause is that such methods were added on API level 14 (4.0) so they don't exist on the original implementation in 3.1 and 3.2, hence causing the proxy to fail when such methods are called. I could try fixing it but preffered to open a bug report in order to get your opinion on the subject and what would your preffered solution be.

These methods are:
cancel()
getDuration()
getStartDelay()
setStartDelay()
start()

Looking at the code, I also noticed that a proxy for the native implementation of ViewPropertyAnimator is used for all API levels 11 and greater when said class was only added on API level 12. As I said, I can fix it and submit a pull request (and hopefully do it right, haven't worked with git before) but would like to hear your opinion on what the ideal solution would be. I didn't dig deep into the code yet but it doesn't seem possible to only proxy some methods and not others, so my suggestion would be to only use the native implementation on API level 14 and onwards.

Visibility setting ignored on an animated View

On PreHoneycomb devices, setting the visibility of an animated view to View.GONE or View.INVISIBLE doesn't have the desired effect. (i.e., the view is still visibile on the screen.)

Steps to reproduce:

  1. Start an infinite animation on a view.
  2. Stop the animation after some time and immediately set the visibility of the view to GONE/Invisible
  3. The view is still visibile on the screen.

Sample code follows:

package com.hrushikesh.uiprototypes;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.animation.ValueAnimator;

public class AnimationTest extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_animation_test);

        final ImageView view = (ImageView) findViewById(R.id.imageView1);

        final ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha",
                0.5f);
        animator.setRepeatCount(ValueAnimator.INFINITE);
        animator.setRepeatMode(ValueAnimator.REVERSE);
        animator.start();

        view.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                if (animator.isRunning()) {
                    animator.end();
                    view.setVisibility(View.INVISIBLE);
                } else {
                    view.setVisibility(View.VISIBLE);
                    animator.start();
                }
            }
        });
    }
}

inconsistent animation behavior

I am using this library to implement side navigation like facebook app.

It's really easy to setup. I have a framelayout with content view and menu view. The content view sits on top of the menu view.

on version 4.0:

I call following method to slide the contentview to the right. I can click on the menu item which is way I want it to behave.
ObjectAnimator.ofFloat(contentView, "translationX", theSlideX).start();

the same code on version 2.3.3, it's behaving differently. When content view slides out. I can see the menu view but when I click on the menu view, the content view is the one which receives the click event. how do i fix this?

setFillBefore and setFillAfter

those methods exists? because i cant find them and i need the layout to actually update and move the views not only the graphics.

Issues with all Samsung 2.3.6-2.3.7 & Objectanimator

When Using Objectanimators in xml and trying to load via AnimatorInflater.loadAnimator() NumberFormatException occurs (Stacktrace follows).

I tested this bug with an older Samsung GT-B5510 and received several videos from the Samsung testcenter. Obviously the crash is related to an attribute already reserved by Samsungs Android-Derivate, possibly "android.R.attr.valueType" in AnimatorInflater:60.

I will try to find a solution for this and fork the repo.
Stacktrace is with the samle app and "LoadAnimator", with a out-of-the-box Samsung GT-B5510.

01-01 20:42:06.968: E/AndroidRuntime(12807): FATAL EXCEPTION: main
01-01 20:42:06.968: E/AndroidRuntime(12807): java.lang.NumberFormatException
01-01 20:42:06.968: E/AndroidRuntime(12807): at org.apache.harmony.luni.util.FloatingPointParser.parseFltImpl(Native Method)
01-01 20:42:06.968: E/AndroidRuntime(12807): at org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.java:321)
01-01 20:42:06.968: E/AndroidRuntime(12807): at java.lang.Float.parseFloat(Float.java:323)
01-01 20:42:06.968: E/AndroidRuntime(12807): at android.content.res.TypedArray.getFloat(TypedArray.java:287)
01-01 20:42:06.968: E/AndroidRuntime(12807): at com.nineoldandroids.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:292)
01-01 20:42:06.968: E/AndroidRuntime(12807): at com.nineoldandroids.animation.AnimatorInflater.loadObjectAnimator(AnimatorInflater.java:201)
01-01 20:42:06.968: E/AndroidRuntime(12807): at com.nineoldandroids.animation.AnimatorInflater.createAnimatorFromXml(AnimatorInflater.java:149)
01-01 20:42:06.968: E/AndroidRuntime(12807): at com.nineoldandroids.animation.AnimatorInflater.createAnimatorFromXml(AnimatorInflater.java:124)
01-01 20:42:06.968: E/AndroidRuntime(12807): at com.nineoldandroids.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:102)
01-01 20:42:06.968: E/AndroidRuntime(12807): at com.jakewharton.nineoldandroids.sample.apidemos.AnimationLoading$MyAnimationView.createAnimation(AnimationLoading.java:88)

NoSuchMethodError

java.lang.NoSuchMethodError: android.view.View.setScrollY
at com.nineoldandroids.view.ViewHelper$Honeycomb.setScrollY(ViewHelper.java:257)
at com.nineoldandroids.view.ViewHelper.setScrollY(ViewHelper.java:127)

NEEDS_PROXY is set to false on post gingerbread devices and therefore view.setScrollY() is called, despite it being introduced in api 14

ArgbEvaluator can't evaluate alpha value properly.

First of all, thank you for NineOldAndroids.

I have been developing PaintAnimator.(https://github.com/EaseTheWorld/PaintAnimator)
and found that Android's ArgbEvaluator has a bug.
http://code.google.com/p/android/issues/detail?id=36158Y
(Its status is 'FutureRelease' so It will be released I guess.)

I think NineOldAndroids' user should take advantage sooner than the official release.

This is my patch in my repository.
(https://github.com/EaseTheWorld/PaintAnimator/blob/master/src/dev/easetheworld/animator/ArgbEvaluator2.java)

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.