Code Monkey home page Code Monkey logo

kenburnsview's Introduction

KenBurnsView

Android library that provides an extension to ImageView that creates an immersive experience by animating its drawable using the Ken Burns Effect.

Example Image

Overview

KenBurnsView provides the following advantages:

  • Control: you can change the duration and the interpolator of transitions and pause/resume them. You can also listen to events like onTransitionStart() and onTransitionEnd();
  • Highly extensible: you can define how the rectangles to be zoomed and panned will be generated;
  • Libs friendly: since KenBurnsView is a direct extension of ImageView, it seamlessly works out of the box with your favorite image loader library;
  • Easy to use: you can start using it right away. All you need to do is to drop the JAR file into your project and replace ImageView elements in your XML layout files by com.flaviofaria.kenburnsview.KenBurnsView ones.

Latest version: 1.0.7

Gradle integration

If you're using Gradle, you can declare this library as a dependency:

dependencies {
    compile 'com.flaviofaria:kenburnsview:1.0.7'
}

Basic usage

For a working implementation, see the sample/ folder.

The simplest way to use KenBurnsView is by dropping the library JAR file into your project adding a view to an XML layout file:

<com.flaviofaria.kenburnsview.KenBurnsView
    android:id="@+id/image"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/your_drawable" />

Advanced usage

  1. You can set a listener to your view:
KenBurnsView kbv = (KenBurnsView) findViewById(R.id.image);
kbv.setTransitionListener(new TransitionListener() {
    @Override
    public void onTransitionStart(Transition transition) {

    }
    @Override
    public void onTransitionEnd(Transition transition) {

    }
});
  1. You can pause the animation by calling kbv.pause() and resume it by calling kbv.resume();

  2. You can change the duration and the interpolator of transitions:

RandomTransitionGenerator generator = new RandomTransitionGenerator(duration, interpolator);
kbv.setTransitionGenerator(generator);
  1. If you're willing to have even more control over transitions, you can implement your own TransitionGenerator.

Questions

You can ask any question on Stack Overflow using the android-kenburnsview tag.

License

Apache Version 2.0

kenburnsview's People

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

kenburnsview's Issues

Crash ( java.lang.NullPointerException at android.view.View.getHardwareLayer )

Device: Samsung Galaxy SII ( GT-I9100 with Android 4.0.3 )

08-24 12:40:36.433    1558-1558/com.x.bla E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NullPointerException
            at android.view.View.getHardwareLayer(View.java:10318)
            at android.view.ViewGroup.drawChild(ViewGroup.java:2863)
            at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
            at android.view.View.getDisplayList(View.java:10555)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
            at android.view.View.getDisplayList(View.java:10520)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
            at android.view.View.getDisplayList(View.java:10520)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
            at android.view.View.getDisplayList(View.java:10520)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
            at android.view.View.getDisplayList(View.java:10520)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
            at android.view.View.getDisplayList(View.java:10520)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
            at android.view.View.getDisplayList(View.java:10520)
            at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:840)
            at android.view.ViewRootImpl.draw(ViewRootImpl.java:2049)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1773)
            at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2585)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4507)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)

NPE when loading image from url using Image Loader

I got this error when loading image from a url to the KenBurnsView:

06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ java.lang.NullPointerException
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.flaviofaria.kenburnsview.MathUtils.getRectRatio(MathUtils.java:44)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.flaviofaria.kenburnsview.RandomTransitionGenerator.generateRandomRect(RandomTransitionGenerator.java:93)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.flaviofaria.kenburnsview.RandomTransitionGenerator.generateNextTransition(RandomTransitionGenerator.java:64)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.flaviofaria.kenburnsview.KenBurnsView.startNewTransition(KenBurnsView.java:207)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.flaviofaria.kenburnsview.KenBurnsView.handleImageChange(KenBurnsView.java:280)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.flaviofaria.kenburnsview.KenBurnsView.setImageDrawable(KenBurnsView.java:140)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.nostra13.universalimageloader.core.imageaware.ImageViewAware.setImageDrawable(ImageViewAware.java:171)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:252)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:357)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:335)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.kedai.baucar.fragment.HomeFragment$2.onResponse(HomeFragment.java:513)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.kedai.baucar.fragment.HomeFragment$2.onResponse(HomeFragment.java:450)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.kedai.baucar.utils.GsonRequest.deliverResponse(GsonRequest.java:106)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.kedai.baucar.fragment.HomeFragment$1.deliverResponse(HomeFragment.java:425)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.kedai.baucar.fragment.HomeFragment$1.deliverResponse(HomeFragment.java:420)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:733)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:95)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at android.os.Looper.loop(Looper.java:136)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5001)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
06-20 16:05:57.485    7442-7442/com.kedai.baucar W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
06-20 16:05:57.495    7442-7442/com.kedai.baucar W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)

How do I load image from url and put it inside KenBurnsView? Also, I saw a fix here #6 and my drawable is initially empty, so would that be a problem too for this error?

Issue when testing with Espresso

When testing a view which has a KenBurnsView with espresso, it will throw the exception below.

androidx.test.espresso.PerformException: Error performing 'single click - At Coordinates: 238, 638 and precision: 16, 16' on view 'with text: is "Product_05"'. 

Caused by: androidx.test.espresso.AppNotIdleException: Looped for 7184 iterations over 60 SECONDS. The following Idle Conditions failed .

Test case remains looping over and over without either passing or failing.

After setting the KenBurnsView to invisible, test case will be passed.

Issue is KenBurnsView is reloading the page infinitely

How to make image blur?

Hello sir, I am using this library and it is working nice. Now i want to make image blur by using this library. Is there any solution for this?
Thank you.

haveSameAspectRatio

I had a weird crash when I rotated my tablet several times with the view enabled. I have pinpointed it to the MathUtils.haveSameAspectRatio() function, and the truncation...

If my previous destRect had a ratio of 0.637 and my new viewPort has a rect ratio of 0.625
The function will say that the viewPortRatio has not changed. (even if we can tell right now that the difference between the two is more than 0.01)

If the random rect generator, provided with a viewport with a 0.625 ratio then returns a rect with a ratio of 0.624999, this will raise the IncompatibleRatioException in the Transition constructor.

I believe the truncating is not that good of an idea when you are comparing the aspect ratios. Imho, it should at least be one decimal further than the comparison itself.

Starts outside the imageboundries

Sometimes the transitioning starts outside of the image boundries, not in the center, this results in white borders being showed. Is there is any way to fix this or is this a known bug and is there a bugfix for it in the works?

Landscape mode

Everything works greate when I'm in portrait mode.

But when I put my device in landscape, the picture doesn't fit the screen (it's far smaller) and the animation is weird.

Suggestion: freeze / unfreeze view

I stumbled upon some errors while I'm performing ObjectAnimator animations on kenburnsview, mainly, I was expanding/collapsing the view.
Each time the height field changed, the image view was stuttering, reloading the image or transition on it.
I always got IncompatibleRatioException: can't perform effect on rects with distinct aspect ratios.
I tried to resolve it by setting the image to null, then by setting the transition generator to null (but that didn't work so instead I set it to a new generator with method to return; immediately without calculations, but that also crashed for another reason, because the library needs values from that method).

Eventually I thought about suggesting a method which freezes the layout so that no calculations or redraws are done. This is helpful in advanced situations such as collapsing/expanding/animating the bounds of kenburnsview, even with height/width of zero.
Of course, an unfreeze method after animations are completed.

support for shared element transition?

I am using ken burns in a toolbar and i want shared element transition . so basically an imageview would be shared with the previous activity, in the current implementation you are restarting the animation in onsizechanged which doesnt give a nice effect.can you provide any support. my solution to restart the animation after the callback of shared element transition and then using the image view rect as src and then exapanding it to a rect required by kenbens to work and then start the animation

Set start animation time

Hi, I would like to set a time to start the animation after this is opened? Is this possible? Thank you

Ripple effect on Buttons placed over KenBurnsView doesn't work

I have the KenBurnsView and a button over it in a FrameLayout. Now, I am using a Ripple Effect on the button when clicked.

Previously before using KenBurnsView (I just had a simple ImageView) the ripple used to draw over the ImageView.

But now as I replaced the ImageView with this, the ripple draws below it. How can this be solved?

choppy/glitchy on image load

Great library thanks for sharing, I am having a slight issue though. When I load an image it seems to jump quickly between a few transitions before settling on one and going through it.

Kind of hard to explain so I can upload a video if needed, but basically my image will jump around to different scale sizes before finally picking one and smoothly doing the Ken Burns effect.

Changing current drawable

I am using your lib from yesterday, and I'm loving it! ;)

There's just one thing I can't get rid of:
When I start with one image, and it's already animating, then I call my image loading library to load another one from web, and the result of network call is a drawable with different size. Then KenBurnsView zooms out or in from the previous drawable rectangle to the new rectangle, to get max rectangle size to fill the viewport. The problem is that I don't want that zoom - I want to have my new drawable in imageView instantly panning left and right (beacuse that's how I set my transition generator), in its own drawable size, and foget about old rectangle. I just can't get rid of that initial zoom in my transistion generator.

use project in android studio

hello ,use the project in open android studio,android studio show info : Error:(59, 0) No such property: ossrhUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer,what it's mean,Hope to reply,thanks.

Slide Show

Can we add option to give an assets folder and show a slide show of the images?

Issue on Samsung galaxy S8

When we use to display an image of 1080x800 webp format image with Ken Burns effect... We are getting the below exception, so far it's has been seen in Galaxy S8 only.

Fatal Exception: java.lang.RuntimeException: Canvas: trying to draw too large(124367104bytes) bitmap.
at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:229)
at android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:97)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:529)
at android.widget.ImageView.onDraw(ImageView.java:1367)
at android.view.View.draw(View.java:20352)
at android.view.View.updateDisplayListIfDirty(View.java:19297)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.updateDisplayListIfDirty(View.java:19288)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.support.constraint.ConstraintLayout.dispatchDraw(ConstraintLayout.java:2023)
at android.view.View.updateDisplayListIfDirty(View.java:19288)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1426)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.updateDisplayListIfDirty(View.java:19288)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.updateDisplayListIfDirty(View.java:19288)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.updateDisplayListIfDirty(View.java:19288)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.updateDisplayListIfDirty(View.java:19288)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.updateDisplayListIfDirty(View.java:19288)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.draw(View.java:20355)
at com.android.internal.policy.DecorView.draw(DecorView.java:979)
at android.view.View.updateDisplayListIfDirty(View.java:19297)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:686)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:692)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:800)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3488)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3275)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2810)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1779)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7810)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

When window is resized IncompatibleRatioException is thrown.

Here is a temporary dirty fix but it takes a second to adjust:

RandomTransitionGenerator.java
try {
    mLastGenTrans = new Transition(srcRect, dstRect, mTransitionDuration,
        mTransitionInterpolator);
} catch (IncompatibleRatioException e) {
// Most likely the window was resized.
srcRect = generateRandomRect(drawableBounds, viewport);
mLastGenTrans = new Transition(srcRect, dstRect, mTransitionDuration,
        mTransitionInterpolator);
}

I'm having Problem in with KenBurnsView and viewpager.

My scenario is actually i'm using this kenBurnsView in collapsing toolbar and bellow collapsing toolbar i have viewpager and tablayout. I'm changing the image as

mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
                changeHeaderImage(position);
            }

the problem is when i touch the screen for swiping viewpager image moves arbitrarily until i stop touching it.

KenBurnsView disable backpress.

I just realise adding KenBurnsView at my activity will cause the phone physical back button stop working.

Override onBackPressed() no response as well.

IncompatibleRatioException when device rotates

Hi. I downloaded and started using your lib. I just created a new project in Eclipse with default Full Screen activity. Just changed the default textview to

<com.flaviofaria.kenburnsview.KenBurnsView
    android:id="@+id/fullscreen_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/your_drawable" />

..and didnt change anything else, not even TransitionGenerator.

Whenever I rotate the device (scenario Landscape to Potrait) first the image sticks to the top leaving the bottom part empty with a background color.

Images:

land
potrait

The same happens for Potrait to Landscape rotation, with image zoomed in too much in the landscape view.

Next, when the ongoing transition is completed. The app crashes with the following stacktrace http://pastebin.com/q5B2SvMj

RandomTransitionGenerator gets outside of image's content sometimes, or does too much zooming sometimes

I'm trying to have a POC project that has the following features:

  • fading action bar, using this library:
    https://github.com/flavienlaurent/NotBoringActionBar
  • imageView that change their sizes in parallel (top and bottom) , as you scroll.
  • the imageViews are actually KenBurnsView, and they switch between multiple images that might be from the Internet.
  • all in fragments and action-bar-navigation is supported.

here's the project:
https://drive.google.com/file/d/0B_nrUhQ0MIgwUGZ3cjJwZVpVbkU/

the problem is that even though everything works , the RandomTransitionGenerator sometimes go outside of the content of the image being shown, so empty area is shown too. Also, sometimes, the zoom factor gets really large.
of course, I had to change some stuff on both libraries in order for this to work, but most of the code remained intact.

Support user gestures

Sometimes users are interested in interrupting the animation, then pan left or right or zoom in and out the image with respective gestures.

Any plan to support these?

Allow configurable FPS

The default FPS of 60 apparently uses too much CPU on certain devices. Would be good to make this configurable. Thank you :)

UnlimitedDiscCache cannot be resolved to a type

I am getting following error on importing the project.

I used following librarys

  1. your main library for the effect
  2. actionbarsherlock
  3. imager loader library
    All things are imported well only UnlimitedDiscCache cannot be resolved to a type

How to solve this

Implied READ_PHONE_STATE permission

Hi,

Encountered an issue when trying to upload a new build of an app to Google Play Console:

New permissions added
Warning:

Users that have the APK with version code XX may need to accept the android.permission.READ_PHONE_STATE permission, which may result in them not upgrading to this version of the app.

Tip:

Ensure that the new permissions are necessary, and consider mentioning these permissions in the What's new in this release text.

Since this is a permission I did not explicitly add I investigated the AndroidManifest.xml of my app and Google was right.

The manifest merger report stated:

uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from /Users/jesper/Developer/_android/iap-core-android/app/src/main/AndroidManifest.xml:2:1-18:12 reason: com.flaviofaria.kenburnsview has a targetSdkVersion < 4

I'd imagine this is unintended and would love to have a fix for where the targetSdkVersion is
4 or higher.

Note for anyone else having this issue, there is a quickfix:
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>

OutOfMemoryError

Hi,

We are getting OutOfMemoryError very frequently while loading bitmap from KenBurnsView library. Here is the complete error logcat:

java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872)
at android.content.res.Resources.loadDrawable(Resources.java:3054)
at android.content.res.Resources.getDrawable(Resources.java:1613)
at android.widget.ImageView.resolveUri(ImageView.java:648)
at android.widget.ImageView.setImageResource(ImageView.java:377)
at com.flaviofaria.kenburnsview.KenBurnsView.setImageResource(KenBurnsView.java:125)

Can you tell me the root cause? It seems that bitmap is not getting recycled as soon as the Activity killed by OS. Somehow bitmap remains in memory.

Thanks,
Sanjay

Different animation

Hi @alaeri

is there any way to change animation on aniamtion complete and also change image with time duration?

Thanks (_)

Define zoom/pan start position

Hi,
the overview or this nice library says the following: "Highly extensible: you can define how the rectangles to be zoomed and panned will be generated"
and that's exactly what I want to do but I don't know exactly how.

I would like to be able to tell the library to zoom or pan from a specified region (a RectF I presume) of my image.
I think I have to implements my own TransitionGenerator and write a custom generateNextTransition() mtehod but I don't know what to do inside.

Can you help me ?

Thanks.
Adrian

Can't perform Ken Burns effect on rects with distinct aspect ratios!

I have this random error, I only get it sometimes!

FATAL EXCEPTION: main
    Process: se.ja1984.twee, PID: 26470
    com.flaviofaria.kenburnsview.IncompatibleRatioException: Can't perform Ken Burns effect on rects with distinct aspect ratios!
            at com.flaviofaria.kenburnsview.Transition.<init>(Transition.java:53)
            at com.flaviofaria.kenburnsview.RandomTransitionGenerator.generateNextTransition(RandomTransitionGenerator.java:66)
            at com.flaviofaria.kenburnsview.KenBurnsView.startNewTransition(KenBurnsView.java:172)
            at com.flaviofaria.kenburnsview.KenBurnsView.onDraw(KenBurnsView.java:124)
            at android.view.View.draw(View.java:14465)
            at android.view.View.getDisplayList(View.java:13362)
            at android.view.View.getDisplayList(View.java:13404)
            at android.view.View.draw(View.java:14182)
            at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
            at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
            at android.view.View.getDisplayList(View.java:13357)
            at android.view.View.getDisplayList(View.java:13404)
            at android.view.View.draw(View.java:14182)
            at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
            at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
            at android.view.View.getDisplayList(View.java:13357)
            at android.view.View.getDisplayList(View.java:13404)
            at android.view.View.draw(View.java:14182)
            at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
            at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
            at android.view.View.getDisplayList(View.java:13357)
            at android.view.View.getDisplayList(View.java:13404)
            at android.view.View.draw(View.java:14182)
            at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
            at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
            at android.view.View.getDisplayList(View.java:13357)
            at android.view.View.getDisplayList(View.java:13404)
            at android.view.View.draw(View.java:14182)
            at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
            at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
            at android.view.View.getDisplayList(View.java:13357)
            at android.view.View.getDisplayList(View.java:13404)
            at android.view.View.draw(View.java:14182)
            at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
            at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
            at android.view.View.draw(View.java:14468)
            at android.widget.FrameLayout.draw(FrameLayout.java:472)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2326)
            at android.view.View.getDisplayList(View.java:13362)
            at android.view.View.getDisplayList(View.java:13404)
            at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1570)
            at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1449)
            at android.view.ViewRootImpl.draw(ViewRootImpl.java:2381)
            at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
            at android.view.Choreographer.doCallbacks(Choreographer.java:574)
            at android.view.Choreographer.doFrame(Choreographer.java:544)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
            at dalvik.system.NativeStart.main(Native Method)

I'm not really sure what to make of it! My images are 589 x 865px and as I said I only get it sometimes, so I´m not sure the exception is correct?

I´m following the example with two images and the ViewSwitcher btw.

Does not play well if KenBurnsView size is changing

I was playing with this but found when the KenBurnsView size is being animated (I'm actually animating the weight of other views which is causing the KenBurnsView to resize) it goes kind of crazy. It seems the drawing does not take into account the fact that the KenBurnsView size has changed between frames :-(

Getting Binary XML file line #0 error.

Unable to start activity as it giving RuntimeException plus
Error in inflating class com.flaviofaria.kenburnsview.KenBurnsView.
Error caused by android.view.InflateException.

Please resolve.

not correctly displaying scaleType

When I try to display an image with a scaleType="fitCenter" it doesn't do what it actually does like a normal ImageView.

Here is my code.

<com.flaviofaria.kenburnsview.KenBurnsView
    android:id="@+id/image"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:src="@drawable/ic_launcher"
    android:scaleType="fitCenter" />

<Button
    android:id="@+id/button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:onClick="cyclePhoto"
    android:text="Cycle photo" />

The output show's like this.

screenshot

instead of this

screenshot

Circle orientation

Provide a circle orientation for it else it will get dependent on Image loader libraries for transformation

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.