Skip to content

Instantly share code, notes, and snippets.

View rodrigomartind's full-sized avatar
🏠
Working from home

Rodrigo Dominguez rodrigomartind

🏠
Working from home
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
...
<Transition
app:constraintSetEnd="@+id/firstCard"
app:constraintSetStart="@id/start"
app:duration="1000">
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
...
</Transition>
<ConstraintSet android:id="@+id/start">
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
app:constraintSetEnd="@+id/leftCard"
app:constraintSetStart="@id/start"
app:duration="1000">
<OnSwipe
app:dragDirection="dragLeft"
<MotionScene ...>
<Transition
app:constraintSetEnd="@+id/leftCard"
app:constraintSetStart="@id/start"
app:duration="1000">
<OnSwipe
app:dragDirection="dragLeft"
app:onTouchUp="autoComplete"
app:touchRegionId="@id/cardCenter" />
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
android:id="@+id/startToLeftCard"
app:constraintSetEnd="@+id/leftCard"
app:constraintSetStart="@id/start"
app:duration="1000">
<OnSwipe
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
...
<ConstraintSet android:id="@+id/leftCard">
<Constraint android:id="@+id/cardCenter">
<Layout
android:layout_width="212dp"
android:layout_height="135dp"
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
...
<ConstraintSet android:id="@+id/start">
<Constraint android:id="@+id/cardCenter">
<Layout
android:layout_width="318dp"
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
app:constraintSetEnd="@+id/secondCard"
app:constraintSetStart="@id/start"
app:duration="1000">
...
</Transition>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:motionDebug="SHOW_PATH"
app:layoutDescription="@xml/activity_circular_cards_scene1"
tools:context=".circularcards.scenes.CircularCardsScene1Activity">
likeFloating.setOnClickListener {
motionLayout.transitionToState(R.id.like)
}
unlikeFloating.setOnClickListener {
motionLayout.transitionToState(R.id.unlike)
}