File tree Expand file tree Collapse file tree 8 files changed +165
-0
lines changed
samples/containers/android/src/main
java/com/squareup/sample/container/panel
workflow-ui-android/src/main/java/com/squareup/workflow/ui/backstack Expand file tree Collapse file tree 8 files changed +165
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ import kotlin.math.min
39
39
object PanelContainer : ViewBinding<PanelContainerScreen<*, *>>
40
40
by ModalContainer .forContainerScreen(
41
41
R .id.panel_container,
42
+ // This theme defines custom enter and exit animation styles for panel windows.
43
+ dialogThemeResId = R .style.PanelDialog ,
42
44
modalDecorator = { panelBody ->
43
45
PanelBodyWrapper (panelBody.context)
44
46
.apply { addView(panelBody) }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2020 Square Inc.
4
+ ~
5
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
6
+ ~ you may not use this file except in compliance with the License.
7
+ ~ You may obtain a copy of the License at
8
+ ~
9
+ ~ http://www.apache.org/licenses/LICENSE-2.0
10
+ ~
11
+ ~ Unless required by applicable law or agreed to in writing, software
12
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
13
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ~ See the License for the specific language governing permissions and
15
+ ~ limitations under the License.
16
+ -->
17
+ <set xmlns : android =" http://schemas.android.com/apk/res/android"
18
+ android : interpolator =" @android:anim/decelerate_interpolator"
19
+ android : duration =" @android:integer/config_mediumAnimTime"
20
+ >
21
+
22
+ <scale
23
+ android : fromXScale =" 0.9"
24
+ android : toXScale =" 1"
25
+ android : fromYScale =" 0.9"
26
+ android : toYScale =" 1"
27
+ android : pivotX =" 50%p"
28
+ android : pivotY =" 50%p"
29
+ />
30
+
31
+ <alpha
32
+ android : fromAlpha =" 0"
33
+ android : toAlpha =" 1"
34
+ />
35
+
36
+ </set >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2020 Square Inc.
4
+ ~
5
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
6
+ ~ you may not use this file except in compliance with the License.
7
+ ~ You may obtain a copy of the License at
8
+ ~
9
+ ~ http://www.apache.org/licenses/LICENSE-2.0
10
+ ~
11
+ ~ Unless required by applicable law or agreed to in writing, software
12
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
13
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ~ See the License for the specific language governing permissions and
15
+ ~ limitations under the License.
16
+ -->
17
+ <set xmlns : android =" http://schemas.android.com/apk/res/android"
18
+ android : interpolator =" @android:anim/accelerate_interpolator"
19
+ android : duration =" @android:integer/config_mediumAnimTime"
20
+ >
21
+
22
+ <scale
23
+ android : fromXScale =" 1"
24
+ android : toXScale =" 0.9"
25
+ android : fromYScale =" 1"
26
+ android : toYScale =" 0.9"
27
+ android : pivotX =" 50%p"
28
+ android : pivotY =" 50%p"
29
+ />
30
+
31
+ <alpha
32
+ android : fromAlpha =" 1"
33
+ android : toAlpha =" 0"
34
+ />
35
+
36
+ </set >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2020 Square Inc.
4
+ ~
5
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
6
+ ~ you may not use this file except in compliance with the License.
7
+ ~ You may obtain a copy of the License at
8
+ ~
9
+ ~ http://www.apache.org/licenses/LICENSE-2.0
10
+ ~
11
+ ~ Unless required by applicable law or agreed to in writing, software
12
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
13
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ~ See the License for the specific language governing permissions and
15
+ ~ limitations under the License.
16
+ -->
17
+ <translate xmlns : android =" http://schemas.android.com/apk/res/android"
18
+ android : duration =" @android:integer/config_mediumAnimTime"
19
+ android : fromYDelta =" 100%p"
20
+ android : interpolator =" @android:anim/decelerate_interpolator"
21
+ android : toYDelta =" 0"
22
+ />
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2020 Square Inc.
4
+ ~
5
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
6
+ ~ you may not use this file except in compliance with the License.
7
+ ~ You may obtain a copy of the License at
8
+ ~
9
+ ~ http://www.apache.org/licenses/LICENSE-2.0
10
+ ~
11
+ ~ Unless required by applicable law or agreed to in writing, software
12
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
13
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ~ See the License for the specific language governing permissions and
15
+ ~ limitations under the License.
16
+ -->
17
+ <translate xmlns : android =" http://schemas.android.com/apk/res/android"
18
+ android : duration =" @android:integer/config_shortAnimTime"
19
+ android : fromYDelta =" 0"
20
+ android : interpolator =" @android:anim/accelerate_interpolator"
21
+ android : toYDelta =" 100%p"
22
+ />
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2019 Square Inc.
4
+ ~
5
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
6
+ ~ you may not use this file except in compliance with the License.
7
+ ~ You may obtain a copy of the License at
8
+ ~
9
+ ~ http://www.apache.org/licenses/LICENSE-2.0
10
+ ~
11
+ ~ Unless required by applicable law or agreed to in writing, software
12
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
13
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ~ See the License for the specific language governing permissions and
15
+ ~ limitations under the License.
16
+ -->
2
17
<resources >
3
18
<bool name =" is_tablet" >false</bool >
4
19
</resources >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <!--
3
+ ~ Copyright 2020 Square Inc.
4
+ ~
5
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
6
+ ~ you may not use this file except in compliance with the License.
7
+ ~ You may obtain a copy of the License at
8
+ ~
9
+ ~ http://www.apache.org/licenses/LICENSE-2.0
10
+ ~
11
+ ~ Unless required by applicable law or agreed to in writing, software
12
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
13
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ~ See the License for the specific language governing permissions and
15
+ ~ limitations under the License.
16
+ -->
17
+ <resources >
18
+
19
+ <style name =" PanelDialog" >
20
+ <item name =" android:windowAnimationStyle" >@style/PanelDialogAnimation</item >
21
+ <!-- For some reason this is required to get our windowEnterAnimation honored. -->
22
+ <item name =" android:windowIsFloating" >true</item >
23
+ </style >
24
+
25
+ <style name =" PanelDialogAnimation" >
26
+ <item name =" android:windowEnterAnimation" >@anim/panel_enter</item >
27
+ <item name =" android:windowExitAnimation" >@anim/panel_exit</item >
28
+ </style >
29
+
30
+ </resources >
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import android.view.Gravity
22
22
import android.view.View
23
23
import android.view.ViewGroup
24
24
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
25
+ import android.view.animation.AccelerateDecelerateInterpolator
25
26
import android.widget.FrameLayout
26
27
import androidx.transition.Scene
27
28
import androidx.transition.Slide
@@ -129,6 +130,7 @@ open class BackStackContainer @JvmOverloads constructor(
129
130
val transition = TransitionSet ()
130
131
.addTransition(Slide (outEdge).addTarget(oldTarget))
131
132
.addTransition(Slide (inEdge).addTarget(newTarget))
133
+ .setInterpolator(AccelerateDecelerateInterpolator ())
132
134
133
135
TransitionManager .go(Scene (this , newView), transition)
134
136
return
You can’t perform that action at this time.
0 commit comments