-
Notifications
You must be signed in to change notification settings - Fork 176
/
MotionLayout.java
4792 lines (4426 loc) · 171 KB
/
MotionLayout.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2018 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.
*/
package androidx.constraintlayout.motion.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.DashPathEffect;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
import android.view.Display;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.constraintlayout.core.motion.utils.KeyCache;
import androidx.constraintlayout.core.widgets.ConstraintAnchor;
import androidx.constraintlayout.core.widgets.ConstraintWidget;
import androidx.constraintlayout.core.widgets.ConstraintWidgetContainer;
import androidx.constraintlayout.core.widgets.Flow;
import androidx.constraintlayout.core.widgets.Helper;
import androidx.constraintlayout.motion.utils.StopLogic;
import androidx.constraintlayout.motion.utils.ViewState;
import androidx.constraintlayout.widget.Barrier;
import androidx.constraintlayout.widget.ConstraintHelper;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Constraints;
import androidx.constraintlayout.widget.R;
import androidx.core.view.NestedScrollingParent3;
import androidx.core.view.ViewCompat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static androidx.constraintlayout.motion.widget.MotionScene.Transition.TRANSITION_FLAG_FIRST_DRAW;
import static androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID;
import static androidx.constraintlayout.widget.ConstraintSet.UNSET;
/**
* A subclass of ConstraintLayout that supports animating between various states <b>Added in 2.0</b>
* <p>
* A {@code MotionLayout} is a subclass of {@link ConstraintLayout}
* which supports transitions between between various states ({@link ConstraintSet})
* defined in {@link MotionScene}s.
* <p>
* <b>Note:</b> {@code MotionLayout} is available as a support library that you can use
* on Android systems starting with API level 14 (ICS).
* </p>
* <p>
* {@code MotionLayout} links to and requires a {@link MotionScene} file.
* The file contains one top level tag "MotionScene"
* <h2>LayoutDescription</h2>
* <table summary="LayoutDescription">
* <tr>
* <th>Tags</th><th>Description</th>
* </tr>
* <tr>
* <td>{@code <StateSet> }</td>
* <td>Describes states supported by the system (optional)</td>
* </tr>
* <tr>
* <td>{@code <ConstraintSet> }</td>
* <td>Describes a constraint set</td>
* </tr>
* <tr>
* <td>{@code <Transition> }</td>
* <td>Describes a transition between two states or ConstraintSets</td>
* </tr>
* <tr>
* <td>{@code <ViewTransition> }</td>
* <td>Describes a transition of a View within a states or ConstraintSets</td>
* </tr>
* </table>
*
* <h2>Transition</h2>
* <table summary="Transition attributes & tags">
* <tr>
* <th>Attributes</th><th>Description</th>
* </tr>
* <tr>
* <td>android:id</td>
* <td>The id of the Transition</td>
* </tr>
* <tr>
* <td>constraintSetStart</td>
* <td>ConstraintSet to be used as the start constraints or a layout file to get the constraint from</td>
* </tr>
* <tr>
* <td>constraintSetEnd</td>
* <td>ConstraintSet to be used as the end constraints or a layout file to get the constraint from</td>
* </tr>
* <tr>
* <td>motionInterpolator</td>
* <td>The ability to set an overall interpolation (easeInOut, linear, etc.)</td>
* </tr>
* <tr>
* <td>duration</td>
* <td>Length of time to take to perform the transition</td>
* </tr>
* <tr>
* <td>staggered</td>
* <td>Overrides the Manhattan distance from the top most view in the list of views.
* <ul>
* <li>For any view of stagger value {@code S(Vi)}</li>
* <li>With the transition stagger value of {@code TS} (from 0.0 - 1.0)</li>
* <li>The duration of the animation is {@code duration}</li>
* <li>The views animation duration {@code DS = duration * (1 -TS)}</li>
* <li>Call the stagger fraction {@code SFi = (S(Vi) - S(V0)) / (S(Vn) - S(V0))}</li>
* <li>The view starts animating at: {@code (duration-DS) * SFi}</li>
* </ul>
* </td>
* </tr>
* <tr>
* <td>pathMotionArc</td>
* <td>The path will move in arc (quarter ellipses)
* key words {startVertical | startHorizontal | flip | none }</td>
* </tr>
* <tr>
* <td>autoTransition</td>
* <td>automatically transition from one state to another.
* key words {none, jumpToStart, jumpToEnd, animateToStart, animateToEnd}</td>
* </tr>
* </tr>
* <tr>
* <td>transitionFlags</td>
* <td>flags that adjust the behaviour of Transitions. supports {none, beginOnFirstDraw}
* begin on first draw forces the transition's clock to start when it is first displayed not when the begin is called</td>
* </tr>
* </tr>
* <tr>
* <td>layoutDuringTransition</td>
* <td>Configures MotionLayout on how to react to requestLayout calls during transitions. Allowed values are {ignoreRequest, honorRequest}</td>
* </tr>
* <tr>
* <td>{@code <OnSwipe> }</td>
* <td>Adds support for touch handling (optional)</td>
* </tr>
* <tr>
* <td>{@code <OnClick> }</td>
* <td>Adds support for triggering transition (optional)</td>
* </tr>
* <tr>
* <td>{@code <KeyFrameSet> }</td>
* <td>Describes a set of Key object which modify the animation between constraint sets.</td>
* </tr>
* </table>
*
* <ul>
* <li>A transition is typically defined by specifying its start and end ConstraintSets.
* You also have the possibility to not specify them, in which case such transition will become a Default transition.
* That Default transition will be applied between any state change that isn't explicitly covered by a transition.</li>
* <li>The starting state of the MotionLayout is defined to be the constraintSetStart of the first
* transition.</li>
* <li>If no transition is specified (or only a default Transition) the MotionLayout tag must contain
* a app:currentState to define the starting state of the MotionLayout</li>
* </ul>
*
* <h2>ViewTransition</h2>
* <table summary="Transition attributes & tags">
* <tr>
* <th>Attributes</th><th>Description</th>
* </tr>
* <tr>
* <td>android:id</td>
* <td>The id of the ViewTransition</td>
* </tr>
* <tr>
* <td>viewTransitionMode</td>
* <td>currentState, allStates, noState transition affect the state of the view in the current constraintSet or all ConstraintSets or non
* if noState the ViewTransitions are run asynchronous</td>
* </tr>
* <tr>
* <td>onStateTransition</td>
* <td>actionDown or actionUp run transition if on touch down or up if view matches motionTarget</td>
* </tr>
* <tr>
* <td>motionInterpolator</td>
* <td>The ability to set an overall interpolation
* key words {easeInOut, linear, etc.}</td>
* </tr>
* <tr>
* <td>duration</td>
* <td>Length of time to take to perform the {@code ViewTransition}</td>
* </tr>
* <tr>
* <td>pathMotionArc</td>
* <td>The path will move in arc (quarter ellipses)
* key words {startVertical | startHorizontal | flip | none }</td>
* </tr>
* <tr>
* <td>motionTarget</td>
* <td>Apply ViewTransition matching this string or id.</td>
* </tr>
* </tr>
* <tr>
* <td>setsTag</td>
* <td>set this tag at end of transition</td>
* </tr>
* </tr>
* <tr>
* <td>clearsTag</td>
* <td>clears this tag at end of transition</td>
* </tr>
* <tr>
* <td>ifTagSet</td>
* <td>run transition if this tag is set on view</td>
* </tr>
* <tr>
* <td>ifTagNotSet</td>
* <td>run transition if this tag is not set on view/td>
* </tr>
* <tr>
* <td>{@code <OnSwipe> }</td>
* <td>Adds support for touch handling (optional)</td>
* </tr>
* <tr>
* <td>{@code <OnClick> }</td>
* <td>Adds support for triggering transition (optional)</td>
* </tr>
* <tr>
* <td>{@code <KeyFrameSet> }</td>
* <td>Describes a set of Key object which modify the animation between constraint sets.</td>
* </tr>
* </table>
*
* <ul>
* <li>A Transition is typically defined by specifying its start and end ConstraintSets.
* You also have the possibility to not specify them, in which case such transition will become a Default transition.
* That Default transition will be applied between any state change that isn't explicitly covered by a transition.</li>
* <li>The starting state of the MotionLayout is defined to be the constraintSetStart of the first
* transition.</li>
* <li>If no transition is specified (or only a default Transition) the MotionLayout tag must contain
* a app:currentState to define the starting state of the MotionLayout</li>
* </ul>
*
*
* <p>
* <h2>OnSwipe (optional)</h2>
* <table summary="OnSwipe attributes">
* <tr>
* <th>Attributes</th><th>Description</th>
* </tr>
* <tr>
* <td>touchAnchorId</td>
* <td>Have the drag act as if it is moving the "touchAnchorSide" of this object</td>
* </tr>
* <tr>
* <td>touchRegionId</td>
* <td>Limits the region that the touch can be start in to the bounds of this view (even if the view is invisible)</td>
* </tr>
* <tr>
* <td>touchAnchorSide</td>
* <td>The side of the object to move with {top|left|right|bottom}</td>
* </tr>
* <tr>
* <td>maxVelocity</td>
* <td>limit the maximum velocity (in progress/sec) of the animation will on touch up. Default 4</td>
* </tr>
* <tr>
* <td>dragDirection</td>
* <td>which side to swipe from {dragUp|dragDown|dragLeft|dragRight}</td>
* </tr>
* <tr>
* <td>maxAcceleration</td>
* <td>how quickly the animation will accelerate (progress/sec/sec) and decelerate on touch up. Default 1.2</td>
* </tr>
* <tr>
* <td>dragScale</td>
* <td>scale factor to adjust the swipe by. (e.g. 0.5 would require you to move 2x as much)</td>
* </tr>
* <td>dragThreshold</td>
* <td>How much to drag before swipe gesture runs. Important for mult-direction swipe. Default is 10. 1 is very sensitive.</td>
* </tr>
* <tr>
* <td>moveWhenScrollAtTop</td>
* <td>If the swipe is scrolling and View (such as RecyclerView or NestedScrollView)
* do scroll and transition happen at the same time</td>
* </tr>
* <tr>
* <td>onTouchUp</td>
* <td>Support for various swipe modes autoComplete,autoCompleteToStart,autoCompleteToEnd,stop,decelerate,decelerateAndComplete</td>
* </tr>
* </table>
*
* <p>
* <h2>OnClick (optional)</h2>
* <table summary="OnClick attributes">
* <tr>
* <th>Attributes</th><th>Description</th>
* </tr>
* <tr>
* <td>motionTarget</td>
* <td>What view triggers Transition.</td>
* </tr>
* <tr>
* <td>clickAction</td>
* <td>Direction for buttons to move the animation.
* Or (|) combination of: toggle, transitionToEnd, transitionToStart, jumpToEnd, jumpToStart</td>
* </tr>
* </table>
*
* <p>
* <h2>StateSet</h2>
* <table summary="StateSet tags & attributes">
* <tr>
* <td>defaultState</td>
* <td>The constraint set or layout to use</td>
* </tr>
* <tr>
* <td>{@code <State> }</td>
* <td>The side of the object to move</td>
* </tr>
* </table>
*
* <p>
* <h2>State</h2>
* <table summary="State attributes">
* <tr>
* <td>android:id</td>
* <td>Id of the State</td>
* </tr>
* <tr>
* <td>constraints</td>
* <td>Id of the ConstraintSet or the Layout file</td>
* </tr>
* <tr>
* <td>{@code <Variant> }</td>
* <td>a different constraintSet/layout to choose if the with or height matches</td>
* </tr>
* </table>
*
* <h2>Variant</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>region_widthLessThan</td>
* <td>Match if width less than</td>
* </tr>
* <tr>
* <td>region_widthMoreThan</td>
* <td>Match if width more than</td>
* </tr>
* <tr>
* <td>region_heightLessThan</td>
* <td>Match if height less than</td>
* </tr>
* <tr>
* <td>region_heightMoreThan</td>
* <td>Match if height more than</td>
* </tr>
* <tr>
* <td>constraints</td>
* <td>Id of the ConstraintSet or layout</td>
* </tr>
* </table>
*
* <p>
* <h2>ConstraintSet</h2>
* <table summary="StateSet tags & attributes">
* <tr>
* <td>android:id</td>
* <td>The id of the ConstraintSet</td>
* </tr>
* <tr>
* <td>deriveConstraintsFrom</td>
* <td>The id of another constraintSet which defines the constraints not define in this set.
* If not specified the layout defines the undefined constraints.</td>
* </tr>
* <tr>
* <td>{@code <Constraint> }</td>
* <td>A ConstraintLayout Constraints + other attributes associated with a view</td>
* </tr>
* </table>
*
* <p>
* <h2>Constraint</h2>
* <p> Constraint supports two forms: <p>1: All of ConstraintLayout + the ones listed below +
* {@code <CustomAttribute> }.</p>
* <p>Or</p><p>
* 2: Combination of tags: {@code <Layout> <PropertySet> <Transform> <Motion> <CustomAttribute> }.
* The advantage of using these is that if not present the attributes are taken from the base
* layout file. This saves from replicating all the layout tags if only a Motion tag is needed.
* If <Layout> is used then all layout attributes in the base are ignored. </p>
* </p>
* <table summary="Constraint attributes">
* <tr>
* <td>android:id</td>
* <td>Id of the View</td>
* </tr>
* <tr>
* <td>[ConstraintLayout attributes]</td>
* <td>Any attribute that is part of ConstraintLayout layout is allowed</td>
* </tr>
* <tr>
* <td>[Standard View attributes]</td>
* <td>A collection of view attributes supported by the system (see below)</td>
* </tr>
* <tr>
* <td>transitionEasing</td>
* <td>define an easing curve to be used when animating from this point (e.g. {@code curve(1.0,0,0,1.0)})
* or key words {standard | accelerate | decelerate | linear}</td>
* </tr>
* <tr>
* <td>pathMotionArc</td>
* <td>the path will move in arc (quarter ellipses)
* or key words {startVertical | startHorizontal | none }</td>
* </tr>
* <tr>
* <td>transitionPathRotate</td>
* <td>(float) rotate object relative to path taken</td>
* </tr>
* <tr>
* <td>drawPath</td>
* <td>draw the path the layout will animate animate</td>
* </tr>
* <tr>
* <td>progress</td>
* <td>call method setProgress(float) on this view
* (used to talk to nested ConstraintLayouts etc.)</td>
* </tr>
* <tr>
* <td>{@code <CustomAttribute> }</td>
* <td>call a set"name" method via reflection</td>
* </tr>
* <tr>
* <td>{@code <Layout> }</td>
* <td>Attributes for the ConstraintLayout e.g. layout_constraintTop_toTopOf</td>
* </tr>
* <tr>
* <td>{@code <PropertySet> }</td>
* <td>currently only visibility, alpha, motionProgress,layout_constraintTag.</td>
* </tr>
* <tr>
* <td>{@code <Transform> }</td>
* <td>All the view transform API such as android:rotation.</td>
* </tr>
* <tr>
* <td>{@code <Motion> }</td>
* <td>Motion Layout control commands such as transitionEasing and pathMotionArc</td>
* </tr>
* </table>
*
* <p>
* <p>
* <h2>Layout</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>[ConstraintLayout attributes]</td>
* <td>see {@see androidx.constraintlayout.widget.ConstraintLayout ConstraintLayout} for attributes</td>
* </tr>
* </table>
*
* <h2>PropertySet</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>visibility</td>
* <td>set the Visibility of the view. One of Visible, invisible or gone</td>
* </tr>
* <tr>
* <td>alpha</td>
* <td>setAlpha value</td>
* </tr>
* <tr>
* <td>motionProgress</td>
* <td>using reflection call setProgress</td>
* </tr>
* <tr>
* <td>layout_constraintTag</td>
* <td>a tagging string to identify the type of object</td>
* </tr>
* </table>
*
*
* <h2>Transform</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>android:elevation</td>
* <td>base z depth of the view.</td>
* </tr>
* <tr>
* <td>android:rotation</td>
* <td>rotation of the view, in degrees.</td>
* </tr>
* <tr>
* <td>android:rotationX</td>
* <td>rotation of the view around the x axis, in degrees.</td>
* </tr>
* <tr>
* <td>android:rotationY</td>
* <td>rotation of the view around the y axis, in degrees.</td>
* </tr>
* <tr>
* <td>android:scaleX</td>
* <td>scale of the view in the x direction</td>
* </tr>
* <tr>
* <td>android:scaleY</td>
* <td>scale of the view in the y direction.</td>
* </tr>
* <tr>
* <td>android:translationX</td>
* <td>translation in x of the view. This value is added post-layout to the left
* property of the view, which is set by its layout.</td>
* </tr>
* <tr>
* <td>android:translationY</td>
* <td>translation in y of the view. This value is added post-layout to th e top
* property of the view, which is set by its layout</td>
* </tr>
* <tr>
* <td>android:translationZ</td>
* <td>translation in z of the view. This value is added to its elevation.</td>
* </tr>
* </table>
*
*
* <h2>Motion</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>transitionEasing</td>
* <td>Defines an acceleration curve.</td>
* </tr>
* <tr>
* <td>pathMotionArc</td>
* <td>Says the object should move in a quarter ellipse unless the motion is vertical or horizontal</td>
* </tr>
* <tr>
* <td>motionPathRotate</td>
* <td>set the rotation to the path of the object + this angle.</td>
* </tr>
* <tr>
* <td>drawPath</td>
* <td>Debugging utility to draw the motion of the path</td>
* </tr>
* </table>
*
*
* <h2>CustomAttribute</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>attributeName</td>
* <td>The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...)</td>
* </tr>
* <tr>
* <td>customColorValue</td>
* <td>The value is a color looking setMyAttr(int )</td>
* </tr>
* <tr>
* <td>customIntegerValue</td>
* <td>The value is an integer looking setMyAttr(int )</td>
* </tr>
* <tr>
* <td>customFloatValue</td>
* <td>The value is a float looking setMyAttr(float )</td>
* </tr>
* <tr>
* <td>customStringValue</td>
* <td>The value is a String looking setMyAttr(String )</td>
* </tr>
* <tr>
* <td>customDimension</td>
* <td>The value is a dimension looking setMyAttr(float )</td>
* </tr>
* <tr>
* <td>customBoolean</td>
* <td>The value is true or false looking setMyAttr(boolean )</td>
* </tr>
* </table>
*
* <p>
* <p>
* <h2>KeyFrameSet</h2>
* <p> This is the container for a collection of Key objects (such as KeyPosition) which provide
* information about how the views should move </p>
* <table summary="StateSet tags & attributes">
* <tr>
* <td>{@code <KeyPosition>}</td>
* <td>Controls the layout position during animation</td>
* </tr>
* <tr>
* <td>{@code <KeyAttribute>}</td>
* <td>Controls the post layout properties during animation</td>
* </tr>
* <tr>
* <td>{@code <KeyCycle>}</td>
* <td>Controls oscillations with respect to position of post layout properties during animation</td>
* </tr>
* <tr>
* <td>{@code <KeyTimeCycle>}</td>
* <td>Controls oscillations with respect to time of post layout properties during animation</td>
* </tr>
* <tr>
* <td>{@code <KeyTrigger>}</td>
* <td>trigger callbacks into code at fixed point during the animation</td>
* </tr>
* </table>
*
* <p>
* <h2>KeyPosition</h2>
* <table summary="KeyPosition attributes">
* <tr>
* <td>motionTarget</td>
* <td>Id of the View or a regular expression to match layout_ConstraintTag</td>
* </tr>
* <tr>
* <td>framePosition</td>
* <td>The point along the interpolation 0 = start 100 = end</td>
* </tr
* <tr>
* <td>transitionEasing</td>
* <td>define an easing curve to be used when animating from this point (e.g. curve(1.0,0,0, 1.0))
* or key words {standard | accelerate | decelerate | linear }
* </td>
* </tr>
* <tr>
* <td>pathMotionArc</td>
* <td>The path will move in arc (quarter ellipses)
* key words {startVertical | startHorizontal | flip | none }</td>
* </tr>
* <tr>
* <td>keyPositionType</td>
* <td>how this keyframe's deviation for linear path is calculated {deltaRelative | pathRelative|parentRelative}</td>
* </tr>
* <tr>
* <td>percentX</td>
* <td>(float) percent distance from start to end along X axis (deltaRelative) or along the path in pathRelative</td>
* </tr>
* <tr>
* <td>percentY</td>
* <td>(float) Percent distance from start to end along Y axis (deltaRelative) or perpendicular to path in pathRelative</td>
* </tr>
* <tr>
* <td>percentWidth</td>
* <td>(float) Percent of change in the width. Note if the width does not change this has no effect.This overrides sizePercent.</td>
* </tr>
* <tr>
* <td>percentHeight</td>
* <td>(float) Percent of change in the width. Note if the width does not change this has no effect.This overrides sizePercent.</td>
* </tr>
* <tr>
* <td>curveFit</td>
* <td>path is traced</td>
* </tr>
* <tr>
* <td>drawPath</td>
* <td>Draw the path of the objects layout takes useful for debugging</td>
* </tr>
* <tr>
* <td>sizePercent</td>
* <td>If the view changes size this controls how growth of the size.
* (for fixed size objects use KeyAttributes scaleX/X)</td>
* </tr>
* <tr>
* <td>curveFit</td>
* <td>selects a path based on straight lines or a path based on a monotonic spline {linear|spline}</td>
* </tr>
* </table>
*
* <p>
* <p>
* <h2>KeyAttribute</h2>
* <table summary="KeyAttribute attributes">
* <tr>
* <td>motionTarget</td>
* <td>Id of the View or a regular expression to match layout_ConstraintTag</td>
* </tr>
* <tr>
* <td>framePosition</td>
* <td>The point along the interpolation 0 = start 100 = end</td>
* </tr>
* <tr>
* <td>curveFit</td>
* <td>selects a path based on straight lines or a path based on a monotonic spline {linear|spline}</td>
* </tr>
* <tr>
* <td>transitionEasing</td>
* <td>Define an easing curve to be used when animating from this point (e.g. curve(1.0,0,0, 1.0))
* or key words {standard | accelerate | decelerate | linear }
* </td>
* </tr>
* <tr>
* <td>transitionPathRotate</td>
* <td>(float) rotate object relative to path taken</td>
* </tr>
* <tr>
* <td>drawPath</td>
* <td>draw the path the layout will animate animate</td>
* </tr>
* <tr>
* <td>motionProgress</td>
* <td>call method setProgress(float) on this view
* (used to talk to nested ConstraintLayouts etc.)</td>
* </tr>
* <tr>
* <td>[standard view attributes](except visibility)</td>
* <td>A collection of post layout view attributes see below </td>
* </tr>
* <tr>
* <p>
* <tr>
* <td>{@code <CustomAttribute> }</td>
* <td>call a set"name" method via reflection</td>
* </tr>
* </table>
*
* <h2>CustomAttribute</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>attributeName</td>
* <td>The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...)</td>
* </tr>
* <tr>
* <td>customColorValue</td>
* <td>The value is a color looking setMyAttr(int )</td>
* </tr>
* <tr>
* <td>customIntegerValue</td>
* <td>The value is an integer looking setMyAttr(int )</td>
* </tr>
* <tr>
* <td>customFloatValue</td>
* <td>The value is a float looking setMyAttr(float )</td>
* </tr>
* <tr>
* <td>customStringValue</td>
* <td>The value is a String looking setMyAttr(String )</td>
* </tr>
* <tr>
* <td>customDimension</td>
* <td>The value is a dimension looking setMyAttr(float )</td>
* </tr>
* <tr>
* <td>customBoolean</td>
* <td>The value is true or false looking setMyAttr(boolean )</td>
* </tr>
* </table>
*
* </p>
* <p>
* <h2>KeyCycle</h2>
* <table summary="Constraint attributes">
* <tr>
* <td>motionTarget</td>
* <td>Id of the View or a regular expression to match layout_ConstraintTag</td>
* </tr>
* <tr>
* <td>framePosition</td>
* <td>The point along the interpolation 0 = start 100 = end</td>
* </tr>
* <tr>
* <td>[Standard View attributes]</td>
* <td>A collection of view attributes supported by the system (see below)</td>
* </tr>
* <tr>
* <td>waveShape</td>
* <td>The shape of the wave to generate {sin|square|triangle|sawtooth|reverseSawtooth|cos|bounce}</td>
* </tr>
* <tr>
* <td>wavePeriod</td>
* <td>The number of cycles to loop near this region</td>
* </tr>
* <tr>
* <td>waveOffset</td>
* <td>offset value added to the attribute</td>
* </tr>
* <tr>
* <td>transitionPathRotate</td>
* <td>Cycles applied to rotation relative to the path the view is travelling</td>
* </tr>
* <tr>
* <td>progress</td>
* <td>call method setProgress(float) on this view
* (used to talk to nested ConstraintLayouts etc.)</td>
* </tr>
* <tr>
* <td>{@code <CustomAttribute> }</td>
* <td>call a set"name" method via reflection (limited to floats)</td>
* </tr>
* </table>
*
* <h2>CustomAttribute</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>attributeName</td>
* <td>The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...)</td>
* </tr>
* <tr>
* <tr>
* <td>customFloatValue</td>
* <td>The value is a float looking setMyAttr(float )</td>
* </tr>
* <tr>
* </table>
*
* <h2>KeyTimeCycle</h2>
* <table summary="Constraint attributes">
* <tr>
* <td>motionTarget</td>
* <td>Id of the View or a regular expression to match layout_ConstraintTag</td>
* </tr>
* <tr>
* <td>framePosition</td>
* <td>The point along the interpolation 0 = start 100 = end</td>
* </tr>
* <tr>
* <td>[Standard View attributes]</td>
* <td>A collection of view attributes supported by the system (see below)</td>
* </tr>
* <tr>
* <td>waveShape</td>
* <td>The shape of the wave to generate {sin|square|triangle|sawtooth|reverseSawtooth|cos|bounce}</td>
* </tr>
* <tr>
* <td>wavePeriod</td>
* <td>The number of cycles per second</td>
* </tr>
* <tr>
* <td>waveOffset</td>
* <td>offset value added to the attribute</td>
* </tr>
* <tr>
* <td>transitionPathRotate</td>
* <td>Cycles applied to rotation relative to the path the view is travelling</td>
* </tr>
* <tr>
* <td>progress</td>
* <td>call method setProgress(float) on this view
* (used to talk to nested ConstraintLayouts etc.)</td>
* </tr>
* <tr>
* <td>{@code <CustomAttribute> }</td>
* <td>call a set"name" method via reflection (limited to floats)</td>
* </tr>
* </table>
*
* <h2>CustomAttribute</h2>
* <table summary="Variant attributes" >
* <tr>
* <td>attributeName</td>
* <td>The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...)</td>
* </tr>
* <tr>
* <tr>
* <td>customFloatValue</td>
* <td>The value is a float looking setMyAttr(float )</td>
* </tr>
* <tr>
* </table>
*
* <h2>KeyTrigger</h2>
* <table summary="KeyTrigger attributes">
* <tr>
* <td>motionTarget</td>
* <td>Id of the View or a regular expression to match layout_ConstraintTag</td>
* </tr>
* <tr>
* <td>framePosition</td>
* <td>The point along the interpolation 0 = start 100 = end</td>
* </tr
* <tr>
* <td>onCross</td>
* <td>(method name) on crossing this position call this methods on the t arget
* </td>
* </tr>
* <tr>
* <td>onPositiveCross</td>
* <td>(method name) on forward crossing of the framePosition call this methods on the target</td>
* </tr>
* <tr>
* <td>onNegativeCross/td>
* <td>(method name) backward crossing of the framePosition call this methods on the target</td>
* </tr>
* <tr>
* <td>viewTransitionOnCross</td>
* <td>(ViewTransition Id) start a NoState view transition on crossing or hitting t arget
* </td>
* </tr>
* <tr>
* <td>viewTransitionOnPositiveCross</td>
* <td>(ViewTransition Id) start a NoState view transition forward crossing of the framePosition or entering target</td>
* </tr>
* <tr>
* <td>viewTransitionOnNegativeCross/td>
* <td>(ViewTransition Id) start a NoState view transition backward crossing of the framePosition or leaving target</td>
* </tr>
* <tr>
* <td>triggerSlack</td>
* <td>(float) do not call trigger again if the framePosition has not moved this fraction away from the trigger point</td>
* </tr>
* <tr>
* <td>triggerId</td>
* <td>(id) call the TransitionListener with this trigger id</td>
* </tr>
* <tr>
* <td>motion_postLayoutCollision</td>
* <td>Define motion pre or post layout. Post layout is more expensive but captures KeyAttributes or KeyCycle motions.</td>
* </tr>
* <tr>
* <td>motion_triggerOnCollision</td>
* <td>(id) Trigger if the motionTarget collides with the other motionTarget</td>
* </tr>
* </table>
*
* </p>
* <p>
* <h2>Standard attributes</h2>
* <table summary="Constraint attributes">
* <tr>
* <td>android:visibility</td>
* <td>Android view attribute that</td>
* </tr>
* <tr>
* <td>android:alpha</td>
* <td>Android view attribute that</td>
* </tr>
* <tr>
* <td>android:elevation</td>
* <td>base z depth of the view.</td>
* </tr>
* <tr>
* <td>android:rotation</td>
* <td>rotation of the view, in degrees.</td>
* </tr>
* <tr>
* <td>android:rotationX</td>
* <td>rotation of the view around the x axis, in degrees.</td>
* </tr>
* <tr>
* <td>android:rotationY</td>
* <td>rotation of the view around the y axis, in degrees.</td>
* </tr>
* <tr>
* <td>android:scaleX</td>
* <td>scale of the view in the x direction.</td>
* </tr>
* <tr>
* <td>android:scaleY</td>
* <td>scale of the view in the y direction.</td>
* </tr>
* <tr>
* <td>android:translationX</td>
* <td>translation in x of the view.</td>
* </tr>
* <tr>
* <td>android:translationY</td>
* <td>translation in y of the view.</td>
* </tr>
* <tr>
* <td>android:translationZ</td>
* <td>translation in z of the view.</td>
* </tr>
* <p>
* </table>
*
* </p>
*/
public class MotionLayout extends ConstraintLayout implements
NestedScrollingParent3 {
public static final int TOUCH_UP_COMPLETE = 0;
public static final int TOUCH_UP_COMPLETE_TO_START = 1;
public static final int TOUCH_UP_COMPLETE_TO_END = 2;
public static final int TOUCH_UP_STOP = 3;
public static final int TOUCH_UP_DECELERATE = 4;
public static final int TOUCH_UP_DECELERATE_AND_COMPLETE = 5;