Wrapper of the ObjectAnimator that can be used similarly to ViewPropertyAnimator

Overview

ViewPropertyObjectAnimator

Android Arsenal License bintray maven-central

Wrapper of the ObjectAnimator that can be used similarly to ViewPropertyAnimator.

ViewPropertyObjectAnimator is as easy to use as ViewPropertyAnimator and (unlike ViewPropertyAnimator) lets you utilize all the awesome features that ObjectAnimator allows (e.g. it can be used inside AnimatorSet).

Additionally ViewPropertyObjectAnimator lets you animate View's dimensions, padding, margin and scroll.

ViewPropertyObjectAnimator can be also used to animate percent parameters from Percent AndroidX Library .

Usage

To obtain an ObjectAnimator object:

  1. Use the static animate(View view) method of the ViewPropertyObjectAnimator

  2. Call specific ViewPropertyObjectAnimator methods to setup an animation of desired properties (just like you would when using ViewPropertyAnimator)

  3. Call get() method, like so:

    ObjectAnimator animator = ViewPropertyObjectAnimator
            .animate(mView)
            .withLayer()
            .alpha(0f)
            .scaleX(0f)
            .scaleY(0f)
            .scrollY(100)
            .height(200)
            .topPaddingBy(10)
            .setDuration(300)
            .setInterpolator(new AnticipateInterpolator())
            .get();

Including In Your Project

Add in your build.gradle:

repositories {
    maven { url 'https://dl.bintray.com/blipinsk/maven/' }
}

dependencies {
    implementation "com.bartoszlipinski:viewpropertyobjectanimator:1.5.0"
}

Developed by

  • Bartosz Lipiński

License

Copyright 2015 Bartosz Lipiński

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.
Comments
  • Any chance of mavenCentral update publish?

    Any chance of mavenCentral update publish?

    Hey hey,

    Using custom bintray repo is a bit unusual, and mavenCentral only has up to 1.4.5.

    Any chance of updating to 1.5.0 on mavenCentral too?

    Just curious, but technically bintray works well for me atm too 👍

    opened by Zhuinden 8
  • proguard-rules

    proguard-rules

    Hi, I am using https://github.com/arimorty/floatingsearchview which uses your library and seems to be lacking proguard rules for your library. I have already open an issue, but want to know if you have any pre-define proguard-rules when using your ViewPropertyObjectAnimator library?

    Thanks. Stacktrace: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/bartoszlipinski/viewpropertyobjectanimator/ViewPropertyObjectAnimator; at com.arlib.floatingsearchview.FloatingSearchView.transitionInLeftSection(FloatingSearchView.java:1406) at com.arlib.floatingsearchview.FloatingSearchView.setSearchFocusedInternal(FloatingSearchView.java:1319) at com.arlib.floatingsearchview.FloatingSearchView.access$1500(FloatingSearchView.java:87) at com.arlib.floatingsearchview.FloatingSearchView$7.onFocusChange(FloatingSearchView.java:609) at android.view.View.onFocusChanged(View.java:5723) at android.widget.TextView.onFocusChanged(TextView.java:8224) at android.view.View.handleFocusGainInternal(View.java:5478) at android.view.View.requestFocusNoSearch(View.java:8476) at android.view.View.requestFocus(View.java:8455) at android.view.View.requestFocus(View.java:8422) at android.view.View.requestFocus(View.java:8401) at android.view.View.onTouchEvent(View.java:10305) at android.widget.TextView.onTouchEvent(TextView.java:8300) at android.view.View.dispatchTouchEvent(View.java:9300) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2403) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737) at android.app.Activity.dispatchTouchEvent(Activity.java:2771) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2364) at android.view.View.dispatchPointerEvent(View.java:9520) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4238) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4104) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3795) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3852) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3703) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3669) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3677) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3650) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5932) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5906) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5867) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6035) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:323) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5422) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.bartoszlipinski.viewpropertyobjectanimator.ViewProp ertyObjectAnimator" on path: DexPathList[[zip file "/data/app/net.zedge.snakk-2/base.apk"],nativeLibraryDirectories=[/d ata/app/net.zedge.snakk-2/lib/arm64, /vendor/lib64, /system/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) ... 71 more Suppressed: java.lang.ClassNotFoundException: com.bartoszlipinski.viewpropertyobjectanimator.ViewPropertyObjectAnim ator at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 72 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available FlurryAgent W Error logged: uncaught Flurry session ended

    NotABug Fixed 
    opened by ernestkamara 6
  • AndroidX

    AndroidX

    Hey! I love this library and recommend it each time.

    However, I think it's still using Android Support Lib and therefore needs Jetifier.

    Do you think it's possible to AndroidX-ify it, or would that be tricky due to the separation of libraries like for example the animated properties for PercentLayout?

    opened by Zhuinden 4
  • Which license do you use?

    Which license do you use?

    This library works great and I want to include it in an app for the play store.

    I would like to give you credit for the library.

    Could you update the project with a license?

    opened by troy-lamerton 2
  • Duration is not working when changing height.

    Duration is not working when changing height.

    I'm trying to animate height changing and duration parameter is ignored. This is my code:

    val height = View.MeasureSpec.makeMeasureSpec(this.height, View.MeasureSpec.EXACTLY)
    ViewPropertyObjectAnimator.animate(this)
        .heightBy(0)
        .height(height)
        .setDuration(duration)
        .start()
    

    The point is when I set final height to 0, it works perfectly:

    val height = View.MeasureSpec.makeMeasureSpec(this.height, View.MeasureSpec.EXACTLY)
    ViewPropertyObjectAnimator.animate(this)
        .heightBy(height)
        .height(0)
        .setDuration(duration)
        .start()
    

    Any suggestion?

    opened by oscargrgm 2
  • Only run the withEndAction runnable if the animation isn't canceled

    Only run the withEndAction runnable if the animation isn't canceled

    To stay close with ViewPropertyAnimator's behavior, if the ObjectAnimator is canceled during that animation, the runnable defined on withEndAction should not run.

    Bug Fixed 
    opened by fabionuno 2
  • ViewPropertyObjectAnimator widthPercent and duration

    ViewPropertyObjectAnimator widthPercent and duration

    When animating a percent change for a PercentRelativeLayout the setDuration is ignored causing the animation to execute immediately. Even when added to a AnimatorSet with a duration the animation still executes immediately.

        val detailAnim = ViewPropertyObjectAnimator.animate(detail)
                .widthPercent(100F)
                .setDuration(3000).start()
    
    opened by matthewrice345 1
  • Only run the withEndAction runnable if the animation isn't canceled


    Only run the withEndAction runnable if the animation isn't canceled


    To stay close with ViewPropertyAnimator's behavior, if the ObjectAnimator is canceled during that animation, the runnable defined on withEndAction should not run.

    opened by fabionuno 0
  • app_name string resource can leak to consumers

    app_name string resource can leak to consumers

    https://github.com/blipinsk/ViewPropertyObjectAnimator/blob/2241006e88f6bab004a091b07b526a484a9bbf80/viewpropertyobjectanimator/src/main/res/values/strings.xml#L2

    I've just ended up with my app called ViewPropertyObjectAnimator, I'm pretty sure this string resource is not needed for the library to work 😅

    opened by Zhuinden 2
  • waitForParams feature

    waitForParams feature

    Add method waitForParams() (returning void!) that can be called instead of start().

    The ObjectAnimator has to be built (and started), when the View gets its LayoutParams. If LayoutParams are available at the moment of call (of the waitForParams method), the Animator should be built and started right away. If LayoutParams are not available, a proper OnAttachStateChangeListener should be added for the animated View.

    Enhancement 
    opened by blipinsk 0
Releases(1.5.0)
Owner
Bartek Lipinski
android engineer @reddit | former android tech lead @thefabulous | recovering feature creep💉| amateur air-drummer 🥁
Bartek Lipinski
Android L Ripple effect wrapper for Views

Material Ripple Layout Ripple effect wrapper for Android Views Including in your project compile 'com.balysv:material-ripple:1.0.2' Check for latest v

Balys Valentukevicius 2.3k Dec 29, 2022
Repository for android animations Rx wrapper

RxAnimations RxAnimations is a library with the main goal to make android animations more solid and cohesive. Download compile 'oxim.digital:rxanim:

Mihael Francekovic 479 Dec 30, 2022
Android GraphView is used to display data in graph structures.

GraphView Android GraphView is used to display data in graph structures. Overview The library is designed to support different graph layouts and curre

null 991 Dec 30, 2022
Splash screen demo that used with ‘Splash Screen‘ API on Android 12.

Splash Screen Feature Splash screen demo that used with Splash Screen API on Android 12. ?? Screenshot Default splash screen Splash screen with animat

Ellison Chan 60 Nov 16, 2022
You can easily access the top of the screen in Android. Like a iPhone 6 & 6 Plus.

Reachability on Android Easy access on top. Like a iPhone 6 & 6 Plus. demo apk Usage Add dependencies compile 'com.github.sakebook:Reachability:0.2.0@

sakebook 258 Nov 12, 2022
💪 Rich Android Path. 🤡 Draw as you want. 🎉 Animate much as you can.

?? Rich Android Path. ?? Draw as you want. ?? Animate much as you can. Download sample app: Features Full Animation Control on Paths and VectorDrawabl

Ahmed Tarek 2.3k Dec 20, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. ?? EasyFlipView Built with ❤︎ by Wajahat Karim and

Wajahat Karim 1.3k Dec 14, 2022
The lib can make the ActivityOptions animations use in Android api3.1+

ActivityOptionsICS 本项目停止维护 =========== f you are thinking on customizing the animation of Activity transition then probably you would look for Activit

Kale 591 Nov 18, 2022
An android project presenting some transitions you can use between activities

ActivityTransition An android project presenting some transitions you can use between activities #Integration Add the anim folder to your Android proj

null 260 Nov 29, 2022
It's a cool animation which can use in splash or somewhere else.

What's Particle ? It's a cool animation which can use in splash or anywhere else. Demo Article 手摸手教你用Canvas实现简单粒子动画 Attributes name format description

巴掌 1.4k Dec 12, 2022
POC of how you can animate LazyColumn insertions/deletions/moving

Animated LazyColumn/LazyRow POC of how you can animate LazyColumn/LazyRow insertions/deletions/moving Note, this is not production ready or a library,

Roudi Korkis Kanaan 33 Dec 24, 2022
Kotlin wrapper for React Test Renderer, which can be used to unit test React components in a Kotlin/JS project.

Kotlin API for React Test Renderer Kotlin wrapper for React Test Renderer, which can be used to unit test React components in a Kotlin/JS project. How

Xavier Cho 7 Jun 8, 2022
Wynncraft API Wrapper - Simple wrapper to get Wynncraft Stats of a player or a guild and more in Java

WynncraftAPIWrapper Simple wrapper to get Wynncraft Stats of a player or a guild

byBackfish 3 Sep 27, 2022
A wave view of android,can be used as progress bar.

WaveView ![Gitter](https://badges.gitter.im/Join Chat.svg) A wave view of android,can be used as progress bar. Screenshot APK demo.apk What can be use

Kai Wang 1.3k Dec 28, 2022
A togglelayout that can be used in setting interface

ToggleExpandLayout A togglelayout that can be used in setting interface. Originally designed by dribbble. And the author said that's why he designed t

Rongchan Liu 893 Dec 6, 2022
An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

Scrolling Image View An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

Q42 1.8k Dec 27, 2022
Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.

Material Icon Library A library containing over 2000 material vector icons that can be easily used as Drawable, a standalone View or inside menu resou

null 2.3k Dec 16, 2022