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">
...
<ConstraintSet android:id="@+id/detail">
<Constraint android:id="@id/cardOne">
<Layout
<?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/detail">
<Constraint android:id="@id/cardOne">
<Layout
...
/>
<?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/collapseCard"
app:constraintSetEnd="@+id/collapseCards"
app:constraintSetStart="@+id/start">
<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/collapseCards">
<Constraint android:id="@id/cardOne">
<Layout
<ConstraintSet android:id="@+id/collapseCards">
<Constraint android:id="@id/cardOne">
...
<Transform
android:rotationX="-35"
android:scaleX="0.5"
android:scaleY="0.5"
android:translationY="100dp" />
likeFloating.setOnClickListener {
motionLayout.transitionToState(R.id.like)
}
unlikeFloating.setOnClickListener {
motionLayout.transitionToState(R.id.unlike)
}
<?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">
<?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"?>
<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">
...
<ConstraintSet android:id="@+id/leftCard">
<Constraint android:id="@+id/cardCenter">
<Layout
android:layout_width="212dp"
android:layout_height="135dp"