flavioarfaria/KenBurnsView

IncompatibleRatioException being thrown with RandomTransitionGenerator

Closed this issue · 26 comments

Hi,

When using your lib, it's crashing at
com.flaviofaria.kenburnsview.Transition. (Transition.java:53)

I saw it's because of an exception you throw, but I'd like to know where it comes from exactly and maybe how to fix it.

It seems it's related to
windowTranslucentStatus and windowTranslucentNavigation set to true. (using nexus5)

Hi dommeq,

Thank you very much for your report. I'll try to reproduce it here on my Nexus 5. If you're willing to work on a solution for this issue, please use the dev branch.

Are you using any custom TransitionGenerator? If this is the case, please consider that all rects you generate must have the same aspect ratio.

Nope, I just have the xml type of integration ;)

Hi dommeq,

I just pushed a commit to the master branch that I believe it will fix it. I didn't release a new version of the lib because I'd like you to test it with the project you're working on.

You can build the library by running the following commands from the repo root:

./gradlew assembleDebug
./gradlew jar

The lib file will be library/build/bundles/release/classes.jar.

I would be pleased if you test it and give me some feedback.

Yep it looks like it's working ;)
Well done!

When will you make a new release with this fixed?

I'm very busy these days and I still didn't find any free time for that. I
believe I'll be able to release a new version on this weekend. Sorry for
making you wait. =/

On Thu, Apr 10, 2014 at 6:33 PM, Jonathan Andersson <
notifications@github.com> wrote:

When will you make a new release with this fixed?

Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-40145765
.

No worries man! :) It´s worth waiting for! I love the effect and the simplicity.
Tried building the master branch myself but ran in to some problems, so I thought i´d better wait for an release from you! :) But take your time! 👍

Version 1.0.1 released. Sorry for making you wait. =(

this is still a problem, I get it anytime I have the keyboard showing when trying to enter information in an EditText and the image tries to do a new transition

Hi tyczj,

What version of the library are you using? I understand that you have an
EditText and a KenBurnsView element in your layout and this problem happens
when the keyboard shows, right? Is the KenBurnsView being resized? What
have you set for windowSoftInputMode in your manifest file? Can please
provide further information so that I can reproduce it and fix it?

Thanks.

On Sun, Apr 27, 2014 at 1:48 PM, tyczj notifications@github.com wrote:

this is still a problem, I get it anytime I have the keyboard showing when
trying to enter information in an EditText and the image tries to do a new
transition


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-41501714
.

using newest version 1.0.1, I have the KBV as my background (fullscreen no actionbar) and I have a layout with textviews some edittext's overlayed ontop. I dont have anything set for me windowSoftInpotMode in my manifest. basically what I do to reproduce the problem is let the view load, tap in the edittext so the keyboard appears then let the current transition end in the KBV and it will crash when it tries to start the next transition.

If i dismiss the keyboard before the new transition starts it does not crash however

All right, you're probably having it resized. It seems to be a real problem, I'll investigate. Thank you for your report.

yeah I personally am not resizing it in my code but I think they keyboard inherently resizes the view when it appears

yep seeing the same problem on latest version, soft keyboard opened between the beginning and end of the transition will cause the next transition start to raise the exception since the view is implicitly resized. Let me know if you need more info. Thanks!

I also have this problem (version 1.0.1) . Here's the crash log:

05-15 17:37:33.294: E/AndroidRuntime(8703): FATAL EXCEPTION: main
05-15 17:37:33.294: E/AndroidRuntime(8703): com.flaviofaria.kenburnsview.IncompatibleRatioException: Can't perform Ken Burns effect on rects with distinct aspect ratios!
05-15 17:37:33.294: E/AndroidRuntime(8703): at com.flaviofaria.kenburnsview.Transition.(Transition.java:57)
05-15 17:37:33.294: E/AndroidRuntime(8703): at com.flaviofaria.kenburnsview.RandomTransitionGenerator.generateNextTransition(RandomTransitionGenerator.java:62)
05-15 17:37:33.294: E/AndroidRuntime(8703): at com.flaviofaria.kenburnsview.KenBurnsView.startNewTransition(KenBurnsView.java:171)
05-15 17:37:33.294: E/AndroidRuntime(8703): at com.flaviofaria.kenburnsview.KenBurnsView.onDraw(KenBurnsView.java:155)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.draw(View.java:13957)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12895)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12939)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2950)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12833)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12939)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2950)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12833)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12939)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2950)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12833)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12939)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2950)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12833)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12939)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2950)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12833)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.View.getDisplayList(View.java:12939)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1200)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2279)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2151)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1955)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1050)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4560)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.Choreographer.doFrame(Choreographer.java:532)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.os.Handler.handleCallback(Handler.java:725)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.os.Handler.dispatchMessage(Handler.java:92)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.os.Looper.loop(Looper.java:137)
05-15 17:37:33.294: E/AndroidRuntime(8703): at android.app.ActivityThread.main(ActivityThread.java:5171)
05-15 17:37:33.294: E/AndroidRuntime(8703): at java.lang.reflect.Method.invokeNative(Native Method)
05-15 17:37:33.294: E/AndroidRuntime(8703): at java.lang.reflect.Method.invoke(Method.java:511)
05-15 17:37:33.294: E/AndroidRuntime(8703): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
05-15 17:37:33.294: E/AndroidRuntime(8703): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
05-15 17:37:33.294: E/AndroidRuntime(8703): at dalvik.system.NativeStart.main(Native Method)

It's quite a rare bug.

Hi!

I still have this problem with the latest version (1.0.3). When typing something in the keyboard the app crashes. Any fix?

For now, I believe the best way to work around it is by using android:windowSoftInputMode="adjustPan".

Okay, thank you! Great work btw!

2014-07-07 19:44 GMT+02:00 Flávio Faria notifications@github.com:

For now, I believe the best way to work around it is by using
android:windowSoftInputMode="adjustPan".


Reply to this email directly or view it on GitHub
#2 (comment)
.

Related to #14 .

I'm closing this issue because the newer one provides a better description of the problem.

RandomTransitionGenerator generator = new RandomTransitionGenerator();
kbv.setTransitionGenerator(generator);

// com.flaviofaria.kenburnsview.IncompatibleRatioException: Can't perform Ken Burns effect on rects with distinct aspect ratios!

Same error, no rotate device, no resize.

Could you provide further information, please? When does it happen? What
are the dimensions of your image? It'll be nice if you could reproduce it
with the sample app somehow.

On Fri, Sep 26, 2014 at 12:24 AM, solo notifications@github.com wrote:

RandomTransitionGenerator generator = new RandomTransitionGenerator();kbv.setTransitionGenerator(generator);
// com.flaviofaria.kenburnsview.IncompatibleRatioException: Can't perform Ken Burns effect on rects with distinct aspect ratios!

Same error, no rotate device, no resize.


Reply to this email directly or view it on GitHub
#2 (comment)
.

welcome_1_720
picture: 213 KB, 1041 x 1230, xhdpi
device: nexus 4 768 * 1280

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <com.flaviofaria.kenburnsview.KenBurnsView
        android:id="@+id/cover"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/welcome_1_720" />
</FrameLayout>
// Activity onCreate

RandomTransitionGenerator generator = new RandomTransitionGenerator();
coverView.setTransitionGenerator(generator);
coverView.setImageResource(R.drawable.welcome_1_720);

Issue: Not show picture, and 5secs later throw exception

I'll try to reproduce it, thanks.

On Fri, Sep 26, 2014 at 12:36 AM, solo notifications@github.com wrote:

[image: welcome_1_720]
https://cloud.githubusercontent.com/assets/590893/4415537/6d528c24-452d-11e4-9f67-f53154b2d982.jpg
picture: 213 KB, 1041 x 1230

<com.flaviofaria.kenburnsview.KenBurnsView
    android:id="@+id/cover"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop"
    android:src="@drawable/welcome_1_720" /></FrameLayout>

// Activity onCreate
RandomTransitionGenerator generator = new RandomTransitionGenerator();coverView.setTransitionGenerator(generator);coverView.setImageResource(R.drawable.welcome_1_720);

Issue: Not show picture, and 5secs later throw exception


Reply to this email directly or view it on GitHub
#2 (comment)
.

Hi Andrew,

The version 1.0.4 includes this fix and is already available on Maven
Central. I just didn't have time to update the changelog on GitHub. ; )

On Mon, Sep 29, 2014 at 4:24 PM, Andrew Ma notifications@github.com wrote:

Is this going to be released in a 1.0.4?


Reply to this email directly or view it on GitHub
#2 (comment)
.