Skip to content

Commit 6dc5bc2

Browse files
committed
Updating formatting of motion doc.
PiperOrigin-RevId: 295996355
1 parent 7e6dfce commit 6dc5bc2

File tree

1 file changed

+22
-79
lines changed

1 file changed

+22
-79
lines changed

docs/theming/Motion.md

Lines changed: 22 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ Android structures including Fragments, Activities and Views.
6464

6565
### Container transform examples
6666

67-
<details>
68-
<summary><b>Transition between Fragments</b></summary>
69-
<br>
67+
#### Transition between Fragments
68+
7069
In Fragment A and Fragment B's layouts, identify the start and end Views (as described in the [container transform overview](#material-container-transform)) which will be shared. Add a matching `transitionName` to each of these Views.
7170

7271
```xml
@@ -143,11 +142,8 @@ fun onCreate(savedInstanceState: Bundle?) {
143142
exitTransition = Hold()
144143
}
145144
```
146-
</details>
147145

148-
<details>
149-
<summary><b>Transition between Activities</b></summary>
150-
<br>
146+
#### Transition between Activities
151147

152148
In Activity A’s layout, identify the start View to be used as the “shared element” as described in the [container transform overview](#material-container-transform). Give the start view a `transitionName`.
153149

@@ -220,11 +216,7 @@ val options = ActivityOptions.makeSceneTransitionAnimation(
220216
startActivity(intent, options.toBundle());
221217
```
222218

223-
</details>
224-
225-
<details>
226-
<summary><b>Transition between Views</b></summary>
227-
<br>
219+
#### Transition between Views
228220

229221
In the Activity or Fragment where you are transitioning between two views, trigger a `MaterialContainerTransform` by manually setting the transition’s start and end `View`s.
230222

@@ -250,27 +242,20 @@ bottomToolbar.visibility = View.VISIBLE
250242
```
251243

252244
This will perform a container transform from the start view transitioning to the end view. To return, set up the same transform, switching the start and end Views and undoing any property changes (setting the FAB back to `View.VISIBLE` and the `bottomToolbar` back to `View.GONE`) done by the first transform.
253-
</details>
254245

255246
### Customization
256247

257248
While the out-of-the-box container transform should work in most cases, you can manually set the following properties on `MaterialContainerTransform` to customize the look and feel of the animation:
258249

259-
<details>
260-
<summary><b>Container transform</b> attributes</summary>
261-
<!-- Todo: Update this table with links to source where listing defaults is too lengthy (thresholds) -->
250+
#### Container transform attributes<
262251

263-
<br>
252+
<!-- Todo: Update this table with links to source where listing defaults is too lengthy (thresholds) -->
264253

265254
&nbsp; | Attribute | Related method(s) | Default value
266255
-------------- | ------------------------ | --------------------------------- | -------------
267256
**Shape** | `transitionShapeAppearance` | `getStartShapeAppearanceModel`<br/>`setStartShapeAppearanceModel`<br/>`getEndShapeAppearanceModel`<br/>`setEndShapeAppearanceModel` | `null`
268257

269-
</details>
270-
271-
<details>
272-
<summary><b>Container transform</b> properties</summary>
273-
<br>
258+
#### Container transform properties
274259

275260
&nbsp; | Related method(s) | Default value
276261
-------------- | --------------------------------- | -------------
@@ -294,7 +279,6 @@ has a different default value depending on whether or not the transition is
294279
entering or returning._
295280

296281
_When you manually set any of the above properties, the value set will be used when the transition is both entering and returning (including when an enter transition is being re-used due to no return being set). If you need to manually set properties which differ depending on whether or not the transition is entering or returning, create two `MaterialContainerTransforms` and set both the `sharedElementEnterTransition` and `sharedElementReturnTransition`._
297-
</details>
298282

299283
<br><br>
300284

@@ -325,7 +309,7 @@ be changing in visibility or to be added or removed to trigger its animation.
325309
direction. Below are the directions in which a `MaterialSharedAxis` will move
326310
for both the forward and backward directions along each axis.
327311

328-
<summary><b>Shared axis</b> direction</summary>
312+
#### Shared axis direction
329313

330314
Axis | Forward | Backward
331315
----- | ----------------- | ------------------
@@ -338,9 +322,7 @@ Android structures including Fragments, Activities and Views.
338322

339323
### Shared axis examples
340324

341-
<details>
342-
<summary><b>Transition between Fragments</b></summary>
343-
<br>
325+
#### Transition between Fragments
344326

345327
In the following example, we’re creating a shared axis Z transition between
346328
FragmentA and FragmentB. Moving from FragmentA to FragmentB should be a
@@ -404,11 +386,8 @@ and Fragment B. Changing the axis to `MaterialSharedAxis.X` or
404386
respective axis. Alternatively, try replacing `MaterialSharedAxis` with a
405387
`MaterialFadeThrough` for a transition between destinations or layouts that are
406388
_not_ spatially related.
407-
</details>
408389

409-
<details>
410-
<summary><b>Transition between Activities</b></summary>
411-
<br>
390+
#### Transition between Activities
412391

413392
Enable Activity transitions by either setting
414393
`android:windowActivityTransitions` to true in your theme or enabling them on an
@@ -507,11 +486,7 @@ like your normally would.
507486
startActivity(Intent(this, ActivityB::class.java));
508487
```
509488

510-
</details>
511-
512-
<details>
513-
<summary><b>Transition between Views</b></summary>
514-
<br>
489+
#### Transition between Views
515490

516491
In your Activity or Fragment’s layout, identify the two views which will be
517492
“swapped”. The outgoing View should be added to the layout and visible. The
@@ -535,7 +510,6 @@ This will transition between your outgoing and incoming Views with a shared axis
535510
transition. To reverse the animation, set up a new shared axis in the opposite
536511
direction and set your outgoing View back to `View.VISIBLE` and your incoming
537512
View back to `View.GONE`.
538-
</details>
539513

540514
### Customization
541515

@@ -545,10 +519,7 @@ any `MaterialTransitionSet`, the secondary transition can either be modified or
545519
replaced using `MaterialTransitionSet.getSecondaryTransition` and
546520
`MaterialTransitionSet.setSecondaryTransition`.
547521

548-
<details>
549-
<summary><b>Shared axis</b> composition</summary>
550-
551-
<br>
522+
#### Shared axis composition
552523

553524
| &nbsp; | Primary transition | Secondary transition |
554525
| ---------------------- | -------------------------- | -------------------- |
@@ -557,14 +528,12 @@ replaced using `MaterialTransitionSet.getSecondaryTransition` and
557528
: : `SlideDistance`<br>**Z** - : :
558529
: : `Scale` : :
559530

560-
</details>
561531

562532
This allows the tweaking of shared axis to create “variants” as mentioned in the
563533
Material Motion spec. <!-- Todo: Add Link to spec article -->
564534

565-
<details>
566-
<summary><b>Shared axis</b> fade variant</summary>
567-
<br>
535+
#### Shared axis fade variant
536+
568537
The following is a `MaterialSharedAxis` Z transition between Activities which fades
569538
Activity B in and over Activity A while leaving Activity A’s alpha unchanged can
570539
be accomplished by removing the secondary `FadeThrough` transition from Activity
@@ -591,7 +560,6 @@ override fun onCreate(savedInstanceState: Bundle?) {
591560
}
592561
```
593562

594-
</details>
595563

596564
<br><br>
597565

@@ -620,9 +588,7 @@ structures including Fragments, Activities and Views.
620588

621589
### Fade through examples
622590

623-
<details>
624-
<summary><b>Transition between Fragments</b></summary>
625-
<br>
591+
#### Transition between Fragments
626592

627593
In Fragment A, configure an exit `MaterialFadeThrough` transition and in
628594
Fragment B configure an enter `MaterialFadeThrough` transition. Both of these
@@ -664,11 +630,7 @@ supportFragmentManager
664630
.commit();
665631
```
666632

667-
</details>
668-
669-
<details>
670-
<summary><b>Transition between Activities</b></summary>
671-
<br>
633+
#### Transition between Activities
672634

673635
Enable Activity transitions by either setting
674636
`android:windowActivityTransitions` to true in your theme or enabling them on an
@@ -765,11 +727,7 @@ your normally would.
765727
startActivity(Intent(this, ActivityB::class.java));
766728
```
767729

768-
</details>
769-
770-
<details>
771-
<summary><b>Transition between Views</b></summary>
772-
<br>
730+
#### Transition between Views
773731

774732
In your Activity or Fragment’s layout, identify the two Views which will be
775733
“swapped”. The outgoing View should be added to the layout and visible. The
@@ -792,7 +750,6 @@ This will transition between your outgoing and incoming Views with a fade
792750
through transition. To reverse the animation, follow the same steps, setting
793751
your outgoing View back to `View.VISIBLE` and your incoming View back to
794752
`View.GONE`.
795-
</details>
796753

797754
### Customization
798755

@@ -802,23 +759,18 @@ any `MaterialTransitionSet`, the secondary transition can either be modified or
802759
replaced using `MaterialTransitionSet.getSecondaryTransition` and
803760
`MaterialTransitionSet.setSecondaryTransition`.
804761

805-
<details>
806-
<summary><b>Fade through</b> composition</summary>
807-
808-
<br>
762+
#### Fade through composition
809763

810764
&nbsp; | Primary transition | Secondary transition
811765
----------------------- | ------------------ | --------------------
812766
**MaterialFadeThrough** | `FadeThrough` | `Scale`
813767

814-
</details>
815768

816769
This allows the tweaking of fade through to create “variants” as mentioned in
817770
the Material Motion design spec. <!-- Todo: Add Link to spec article -->
818771

819-
<details>
820-
<summary><b>Fade through</b> slide variant</summary>
821-
<br>
772+
#### Fade through slide variant
773+
822774
The below will create a fade through between Fragments which fades
823775
Fragment A out (without a scale) and fades Fragment B in with a _slide_ instead
824776
of a scale.
@@ -848,8 +800,6 @@ override fun onCreate(savedInstanceState: Bundle?) {
848800
}
849801
```
850802

851-
</details>
852-
853803
<br><br>
854804

855805
## Fade
@@ -875,9 +825,7 @@ visibility or to be added or removed to trigger its animation.
875825

876826
### Fade examples
877827

878-
<details>
879-
<summary><b>Transition a View</b></summary>
880-
<br>
828+
#### Transition a View
881829

882830
In your Activity or Fragment, toggle the visibility of your target View, in this
883831
case a Floating Action Button, using a `MaterialFade` to animate the change.
@@ -909,7 +857,6 @@ hideButton.setOnClickListener {
909857
}
910858
```
911859

912-
</details>
913860

914861
### Customization
915862

@@ -919,16 +866,12 @@ any `MaterialTransitionSet`, the secondary transition can either be modified or
919866
replaced using `MaterialTransitionSet.getSecondaryTransition` and
920867
`MaterialTransitionSet.setSecondaryTransition`.
921868

922-
<details>
923-
<summary><b>Fade</b> composition</summary>
924-
925-
<br>
869+
#### Fade composition
926870

927871
&nbsp; | Primary transition | Secondary transition
928872
---------------- | ------------------ | --------------------
929873
**MaterialFade** | `Fade` | `Scale`
930874

931-
</details>
932875

933876
This allows the tweaking of fade to create “variants” as mentioned in the
934877
Material Motion design spec. <!-- Todo: Add Link to spec article -->

0 commit comments

Comments
 (0)