This repository was archived by the owner on Nov 21, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
motionlayout/src/main/java/com/google/androidstudio/motionlayoutexample Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,24 +26,25 @@ import android.widget.ImageView
2626
2727@RequiresApi(Build .VERSION_CODES .LOLLIPOP ) // for View#clipToOutline
2828class DemoActivity : AppCompatActivity () {
29- private lateinit var motionLayout : MotionLayout
29+ private lateinit var container : View
3030
3131 override fun onCreate (savedInstanceState : Bundle ? ) {
3232 super .onCreate(savedInstanceState)
3333 val layout = intent.getIntExtra(" layout_file_id" , R .layout.motion_01_basic)
3434 setContentView(layout)
35- motionLayout = findViewById(R .id.motionLayout)
35+ container = findViewById(R .id.motionLayout)
3636
3737 if (layout == R .layout.motion_11_coordinatorlayout) {
3838 val icon = findViewById<ImageView >(R .id.icon)
3939 icon?.clipToOutline = true
4040 }
4141
4242 val doShowPaths = intent.getBooleanExtra(" showPaths" , false )
43- motionLayout .setShowPaths(doShowPaths)
43+ (container as ? MotionLayout )? .setShowPaths(doShowPaths)
4444 }
4545
4646 fun changeState (v : View ? ) {
47+ val motionLayout = container as ? MotionLayout ? : return
4748 if (motionLayout.progress > 0.5f ) {
4849 motionLayout.transitionToStart()
4950 } else {
You can’t perform that action at this time.
0 commit comments