I am having some trouble understanding the difference between these two Window
flags and am not 100% certain when each needs to be used and why.
The docs for Window.FEATURE_ACTIVITY_TRANSITIONS
say:
Enables Activities to run Activity Transitions either through sending or receiving ActivityOptions bundle created with
makeSceneTransitionAnimation(Activity, Pair[])
ormakeSceneTransitionAnimation(Activity, View, String)
.
And the docs for Window.FEATURE_CONTENT_TRANSITIONS
say:
Flag for requesting that window content changes should be animated using a
TransitionManager
.The
TransitionManager
is set usingsetTransitionManager(TransitionManager)
. If none is set, a defaultTransitionManager
will be used.
The documentation states that the following Window
methods require the FEATURE_ACTIVITY_TRANSITIONS
flag to be enabled, but say nothing about whether or not the FEATURE_CONTENT_TRANSITIONS
needs to be enabled as well (note that according to the source code, FEATURE_ACTIVITY_TRANSITIONS
is true
and FEATURE_CONTENT_TRANSITIONS
is false
for material-themed applications by default):
get{Enter,Exit,Return,Reenter}Transition()
set{Enter,Exit,Return,Reenter}Transition()
getSharedElement{Enter,Exit,Return,Reenter}Transition()
setSharedElement{Enter,Exit,Return,Reenter}Transition()
getTransitionBackgroundFadeDuration()
setTransitionBackgroundFadeDuration()
In other words, it seems like based on this information FEATURE_ACTIVITY_TRANSITIONS
is the feature flag that applications will need to enable in order to use Lollipop's new Activity Transition APIs. What confuses me, however, is that this article from the Android Developers site states that enabling the FEATURE_CONTENT_TRANSITIONS
is required in order to implement custom activity transitions.
So here are my questions:
- What is the difference between these two flags? What is the difference between an "activity transition" and a "content transition" in this context?
- Why is
FEATURE_ACTIVITY_TRANSITIONS
enabled andFEATURE_CONTENT_TRANSITIONS
disabled by default? When is enabling theFEATURE_CONTENT_TRANSITIONS
flag actually required? - Would it ever make sense to sense to disable
FEATURE_ACTIVITY_TRANSITIONS
and enableFEATURE_CONTENT_TRANSITIONS
? Or doesFEATURE_CONTENT_TRANSITIONS
requireFEATURE_ACTIVITY_TRANSITIONS
to be enabled as well?
Thanks!
FEATURE_CONTENT_TRANSITIONS
is used when content inside a window changes. For instance, if you callsetContentView(...)
multiple times. Its also used when when you have shared components between activities, say a TextView. 2.FEATURE_CONTENT_TRANSITIONS
could be disabled because it isn't appropriate for every scenario. If you don;t have shared components (or if your ui isn't setup that way), it wouldn't do anything.FEATURE_ACTIVITY_TRANSITIONS
being enabled kind of makes sense: default transitions and all. – ShamrockFragmentTransaction
api. – ShamrockPhoneWindow.java
... but the difference between the two still is unclear for me. I still can't really tell whether the two flags are totally independent from each other or not. For example, would it ever make sense to enableFEATURE_CONTENT_TRANSITIONS
but disableFEATURE_ACTIVITY_TRANSITIONS
, or is this not allowed? – MccuskerWindow
documentation and the developer site article, so that is mostly the reason why I am asking for clarification here... – Mccusker