How to handle views on top of the FlipView? - android

I'm using this library that allows flipping between views like the "FlipBoard" app.
It works quite well.
The problem is that I need to put a few views on top of it, so I've put it inside a FrameLayout, and the rest of the views after it.
It looks ok, but it has a problem:
When flipping, the views that are on top of it change their transparency (and even become hidden) till the flip is over.
How can I handle this problem?
EDIT: I've found this library which doesn't have this problem, but it has a weird color transition while flipping that I wish to avoid.
EDIT: I've found out that this is a known issue (#49) . Would love to know if anyone else has an idea of how to overcome this.

I don't know how to fix this library, but it seems this library works fine :
https://github.com/emilsjolander/android-FlipView
Not sure though how customizable it is compared to the one i've tested.

Related

How to make a waterfall toolbar in Android?

I was exploring this app named ThemeDIY when I saw this beautiful waterfall toolbar. If you look well, you'll see that shadow doesn't get animated (like Google's), it appears as you pull. Just awesome.
Does anyone knows how to do that?
https://youtu.be/b3m1kkqUrx8
I made a library for it based on a scrollview's or recyclerview's scroll.
https://github.com/HugoCastelani/waterfall-toolbar

Recycler View custom scrolling effects

I want to make awesome scroll effect. I've found a couple of examples:
http://lab.hakim.se/scroll-effects/
but I have no idea how to such behaviour. I consider to make it on my own, but it will be good to have a library which I can use. Just need some starting point. Any ideas?
I've used this library a few times and seemed good but seems to be in need of an update since some of the delete animations have problems. But the scrolling animations should still be good:
https://github.com/wasabeef/recyclerview-animators

android lollipop ViewGroup child hierarchy changes?

I have an app that has a minSdk of 15 and I'm working out all the bugs that came with the lollipop upgrade. Our software is very complex and it dynamically creates views using custom ViewGroups and then an array of elements that are explicitly sized and placed inside the group. I'm running into an issue where for example I'll have a ViewGroup and the first child object is a Button...this button is sized to fill the view (not clickable). The second child is a FrameLayout containing a single view. This single view is a video object. In all prior versions of Android this works just fine. The FrameLayout is layered over the button (that is acting as a background) and the video is inside the framelayout. You can interact with the video without any issues.
Something changed in lollipop - suddenly, even though the button is showing up as the 0 index element, it is laying OVER the rest of the children...so I cannot get to the video underneath. If I remove that button element, the video renders and plays just fine...I have no issues interacting with it.
I ran the app in UI Automator Viewer just to make sure I was really setting up the UI as I expected (keep in mind the entire view is dynamically rendered at runtime using image/video assets and xml config files).
I'm not able to share code since this is proprietary software, but I am working on a little test project to see if I can manually recreate the issue with static objects. Once I get that up and running I'll be sure to update this ticket. For now, here is a screenshot of the hierarchy:
https://goo.gl/photos/a8on9CJDnN66XYnV6
Notice the highlighted object, this is the custom ViewGroup, the children below it are what I am describing above.
Does anyone know of a change in Lollipop that would effect the ordering of things? I found earlier that if you have a disabled object but don't have a disabled state drawable assigned to that object it would become invisible, previous versions just used one of the other state drawables..okay that makes sense and it was very easy to fix, but this object is not invisible...so it must be something different.
Any direction would be greatly appreciated.
~A
UPDATE -- FIXED
With the help of #alanv and #BladeCoder I figured out this functionality was due to the new elevation feature of Material design. I was able to fix my particular issue by first checking what version of android the device was using, and if lollipop, I just add this new property to the button:
android:stateListAnimator="#null"
This prevents my explicit child hierarchy from being overridden by the OS.
Lollipop introduced elevation as a way to position the elements on the Z axis and cast shadows between them depending on their difference of elevation.
Enabled buttons have a default elevation of 2dp (and it increases when you press them). So, your button has a higher elevation than the FrameLayout (0dp by default) so it will be drawn on top of it.
Disabled buttons have an elevation of 0dp. That's why disabling the button solved your issue.
Using buttons as backgrounds looks like a bad idea (why not setting a custom Drawable background on your FrameLayout instead?) but if you really need that, you can disable the button like you did and, just to be sure, enforce its elevation to 0dp. Another workaround is to increase the elevation of the FrameLayout but then it may cast a big shadow under Lollipop if it has a background, and maybe that's not what you want.
Okay, UPDATE! I figured out how to fix the issue, although I'm still not sure (even after pouring over the diffs between several classes in grepcode) what changed in lollipop that is causing a change in how this works.
If the button is enabled...and you are placing it using something equivalent to AbsoluteLayout (We have our own ViewGroup we created called Explicit layout, but it does pretty much the same thing as AbsoluteLayout), it will always be on top of anything else in the stack that isn't also a button of some sort (at least that's what I'm finding...I didn't test through every possible widget).
Setting the button that is acting purely as a background image to enabled=false solves this issue. I know, it doesn't make sense that we use Buttons as background images, but our code uses it for dynamic element creation so there are many possible states and uses for each element.
Anyway, not sure if anyone else would even run into this issue, but just in case you do...here it is.
Thanks!

How to move objects across layouts using Drag and Drop

I can move objects in their parent layout but I could not find how to move them to another layout. Does anyone know it?
Edit: This tutorial shows how to do. fupeg.blogspot.com/2011/03/honeycomb-drag-and-drop-basics.html
This is a buit-in functionnality coming with Android honeycomb, see this specific article.
If you want to do that on earlier versions, try that tutorial.

Animating Picture Transitions

I'm starting out with Android development, and I'm kind of stuck. Basically, I have a layout with dynamically added ImageViews, and I want to have the ImageViews change their image every once in a while. However, I'd like to add some sort of transition or changing animation, like a flip or a flash.
I don't really know where to even start to look for an answer to this question. Any help is greatly appreciated.
The android framework has this totally covered:
http://developer.android.com/guide/topics/graphics/view-animation.html
Basically, you are looking to define "tween" animations between your drawables (imageviews). After you define your animations you can even define a set of drawables to show one after the other using frame-animation.
Check out the following for all the gory details:
http://developer.android.com/guide/topics/resources/animation-resource.html

Categories

Resources