Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Commit e72c633

Browse files
committed
Bump to beta8 and try out new saved instance state API.
1 parent 0bb97bc commit e72c633

9 files changed

Lines changed: 136 additions & 145 deletions

File tree

ConstraintLayoutExamples/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ buildscript {
3838
}
3939

4040
dependencies {
41-
classpath 'com.android.tools.build:gradle:4.0.0'
41+
classpath 'com.android.tools.build:gradle:4.0.1'
4242
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
4343

4444
// NOTE: Do not place your application dependencies here; they belong
-52.4 KB
Binary file not shown.

ConstraintLayoutExamples/motionlayoutintegrations/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android-extensions'
44

55
android {
66
compileSdkVersion 29
7-
buildToolsVersion "29.0.2"
7+
buildToolsVersion "29.0.3"
88

99
defaultConfig {
1010
applicationId "com.example.androidstudio.motionlayoutintegrations"
@@ -33,9 +33,9 @@ dependencies {
3333
implementation fileTree(dir: 'libs', include: ['*.jar'])
3434
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3535
implementation 'androidx.appcompat:appcompat:1.1.0'
36-
implementation 'androidx.core:core-ktx:1.3.0'
37-
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta6'
38-
implementation 'androidx.emoji:emoji-bundled:1.0.0'
36+
implementation 'androidx.core:core-ktx:1.3.1'
37+
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta8'
38+
implementation 'androidx.emoji:emoji-bundled:1.1.0'
3939
testImplementation 'junit:junit:4.13'
4040
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
4141
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Binary file not shown.

ConstraintLayoutExamples/gradle/wrapper/gradle-wrapper.properties renamed to ConstraintLayoutExamples/motionlayoutintegrations/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Thu May 07 15:39:00 PDT 2020
1+
#Tue Jun 09 14:03:26 PDT 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME

ConstraintLayoutExamples/gradlew renamed to ConstraintLayoutExamples/motionlayoutintegrations/gradlew

Lines changed: 42 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ConstraintLayoutExamples/gradlew.bat renamed to ConstraintLayoutExamples/motionlayoutintegrations/gradlew.bat

Lines changed: 84 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ConstraintLayoutExamples/motionlayoutintegrations/src/main/java/com/example/androidstudio/motionlayoutintegrations/Entrance.kt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import androidx.appcompat.app.AppCompatActivity
44
import android.os.Bundle
55
import com.example.androidstudio.motionlayoutintegrations.databinding.ActivityEntranceBinding
66

7-
private val SIS_MOTION_LAYOUT_START_STATE: String = "sis_motion_layout_start"
8-
private val SIS_MOTION_LAYOUT_END_STATE: String = "sis_motion_layout_end"
9-
private val SIS_MOTION_LAYOUT_PROGRESS = "sis_motion_layout_progress"
7+
private val SIS_MOTION_LAYOUT_STATE: String = "sis_motion_layout_start"
108

119
class Entrance : AppCompatActivity() {
1210

@@ -18,23 +16,12 @@ class Entrance : AppCompatActivity() {
1816
setContentView(binding.root)
1917

2018
savedInstanceState?.let {
21-
binding.motionLayout.setTransition(
22-
savedInstanceState.getInt(SIS_MOTION_LAYOUT_START_STATE),
23-
savedInstanceState.getInt(SIS_MOTION_LAYOUT_END_STATE)
24-
)
25-
26-
binding.motionLayout.progress = savedInstanceState.getFloat(SIS_MOTION_LAYOUT_PROGRESS)
19+
binding.motionLayout.transitionState = savedInstanceState.getBundle(SIS_MOTION_LAYOUT_STATE)
2720
}
28-
29-
// Kick off the first transition, or the restored transition
30-
binding.motionLayout.transitionToEnd()
3121
}
3222

3323
override fun onSaveInstanceState(outState: Bundle) {
3424
super.onSaveInstanceState(outState)
35-
36-
outState.putInt(SIS_MOTION_LAYOUT_START_STATE, binding.motionLayout.startState)
37-
outState.putInt(SIS_MOTION_LAYOUT_END_STATE, binding.motionLayout.endState)
38-
outState.putFloat(SIS_MOTION_LAYOUT_PROGRESS, binding.motionLayout.progress)
25+
outState.putBundle(SIS_MOTION_LAYOUT_STATE, binding.motionLayout.transitionState)
3926
}
4027
}

ConstraintLayoutExamples/motionlayoutintegrations/src/main/res/xml/activity_entrance_scene.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,11 @@
188188
android:translationX="-100dp"
189189
android:translationY="100dp" />
190190
</ConstraintSet>
191-
<!--
192-
This transition doesn't autoTransition as it will be started in Activity.onCreate manually
193-
-->
194191
<Transition
195192
motion:constraintSetStart="@+id/Welcome"
196193
motion:constraintSetEnd="@+id/empty"
197194
motion:motionInterpolator="linear"
195+
motion:autoTransition="animateToEnd"
198196
motion:duration="200" >
199197
</Transition>
200198
<Transition

0 commit comments

Comments
 (0)