1

I am trying to figure out how to handle this UI feature where I want to make a ViewPager just appear over everything, scroll through the page items, and then when you press back it goes away. Normally I would just use a full screen dialog for this, but I want to apply a combination fade animation (fade in on appear and fade out on disappear) as well as a scale animation (scale up from nothing to fullscreen on appear and scale down from fullscreen to nothing on disappear).

Dialogs seem to be a lot less animation friendly based on the Dialog and Animation interfaces compared to Views. Then again, I don't know how to make a View just sit on top of everything since that's normally what Dialogs are for. Seems hard to tell which is the lesser evil, but I could potentially benefit more from having a full screen View over everything else. What would I need to do?

Edit: A point brought up by @sound-conception I should make clear, that sadly due to the application context for this feature, making this a separate activity is not an option right now.

grg-n-sox
  • 717
  • 2
  • 5
  • 25
  • 1
    Why not use bringToFront()? – SuperFrog Oct 30 '15 at 23:02
  • @UdiIdan I somehow missed that method in the View API, although the notes on it worry me about backwards compatibility with KitKat (I want to try to keep backwards compatibility to API level 15) and I'll have to do some experimentation with how it affects layouts in my app. – grg-n-sox Nov 01 '15 at 00:15
  • 1
    You can see my answer here for backward compatibility: http://stackoverflow.com/a/33136985/500105 – SuperFrog Nov 01 '15 at 10:38

1 Answers1

1

You state in your question that the ViewPager will be a full screen view. In that case you could implement the ViewPager as a seperate Activity and use Activity Transitions.
Check out this Google I/O developer video on Activity Transitions.
There's also lots of info on the Developer Website

Sound Conception
  • 5,263
  • 5
  • 30
  • 47
  • While an absolutely sound answer, normally, but due to near real time feature specifics I can't put up here that makes things difficult, chances are I wouldn't get the time to refactor this out into its own activity for several months. I'd much rather get this working soon and refactor during a upcoming off-season when I have bandwidth to make this right and pay back the technical debt. Upvote anyways for having what should normally be the correct answer. I'll make a question edit to reflect this as not being an option at the moment for me. – grg-n-sox Nov 01 '15 at 00:07