Skip to content

Instantly share code, notes, and snippets.

View DDihanov's full-sized avatar

Dimitar Dihanov DDihanov

View GitHub Profile
@DDihanov
DDihanov / UiExtension.kt
Last active May 26, 2020 10:10
Chain Animate ConstraintLayouts
import android.content.Context
import android.transition.AutoTransition
import android.transition.TransitionManager
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.transition.doOnEnd
//convenience method to animate several constraint layouts one after another
//important to only pass in the constraint layout LAYOUT FILE ids
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:startDestination="@id/base_flow"
android:id="@+id/main_nav_graph">
<include app:graph="@navigation/base_flow" />
<include app:graph="@navigation/home_flow" />
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:startDestination="@id/base_flow"
android:id="@+id/main_nav_graph">
<include app:graph="@navigation/base_flow" />
<include app:graph="@navigation/home_flow" />
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@id/base_flow" />
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/home_flow" />
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/dashboard_flow" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="home_flow" type="id" />
<item name="dashboard_flow" type="id" />
<item name="base_flow" type="id"/>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@id/dashboard_flow"
app:startDestination="@id/dashboardFragment">
<fragment
android:id="@+id/dashboardFragment"
android:name="bg.dihanov.dashboard.DashboardFragment" />
</navigation>
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@id/home_flow"
app:startDestination="@id/homeFragment">
<fragment
android:id="@+id/homeFragment"
android:name="bg.dihanov.home.HomeFragment">
<action
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:startDestination="@id/startFragment"
android:id="@id/base_flow">
<fragment android:id="@+id/startFragment" android:name="bg.dihanov.commonui.StartFragment" />
</navigation>