forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fragment transitions in new state manager
In aosp/1679887 we attempted to fix doing shared element transitions on ViewGroups with the transitionGroup="false" attribute set. That change caused a regression in enter and exit transitions, and could also cause errors if the entering fragment attempted to transition more views than the exiting fragment. This change makes it so that fragments no longer looks at all of the views in the hierarchy of sharedelement views. We depend on transition names to determine if a view is a shared element, and if a shared element is a viewgroup with transitionGroup="true", the entering/exiting transition should ignore that viewgroup and transition its unnamed children. RelNote: "Fixed regression in shared element transtions caused by aosp/1679887. Setting transitionGroup=\"true\" will now work correctly and shared elements will no longer throw `IndexOutOfBoundsException`s." Test: FragmentSharedElementTransitionTest Bug: 188679569 Bug: 188969304 Change-Id: I164845639cae1f64cf54e4e89b2a24d7eb649beb
- Loading branch information
Jeremy Woods
committed
Jun 9, 2021
1 parent
4370e11
commit 06769a5
Showing
4 changed files
with
183 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
Copyright 2021 The Android Open Source Project | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/sharedElementContainer" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
<FrameLayout android:id="@+id/containerBlueSquare" | ||
android:transitionName="blueSquare" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="#008"> | ||
<View android:id="@+id/greenSquare" | ||
android:transitionName="greenSquare" | ||
android:layout_width="100dp" | ||
android:layout_height="100dp" | ||
android:background="#080"/> | ||
<View android:id="@+id/redSquare" | ||
android:layout_width="100dp" | ||
android:layout_height="100dp" | ||
android:background="#800" | ||
android:layout_gravity="end"/> | ||
</FrameLayout> | ||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
Copyright 2021 The Android Open Source Project | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/sharedElementContainer" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
<FrameLayout android:id="@+id/containerBlueSquare" | ||
android:transitionGroup="true" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="#008"> | ||
<View android:id="@+id/greenSquare" | ||
android:transitionName="greenSquare" | ||
android:layout_width="100dp" | ||
android:layout_height="100dp" | ||
android:background="#080"/> | ||
<View android:id="@+id/redSquare" | ||
android:layout_width="100dp" | ||
android:layout_height="100dp" | ||
android:background="#800" | ||
android:layout_gravity="end"/> | ||
</FrameLayout> | ||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters