package Ġdev . k drag 0 n . android 1 2 ext . ui Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . MenuItem Ċ import Ġandroid . view . View Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġandroidx . navigation . ui . Navigation UI Ċ import Ġcom . google . android . material . transition . Material Shared Axis Ċ import Ġdev . k drag 0 n . android 1 2 ext . R Ċ Ċ open Ġclass ĠBase Fragment Ġ: ĠFragment () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġapply Transitions () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġapply Transitions View Created () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Options ItemSelected ( item : ĠMenuItem ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠNavigation UI . on Nav Destination Selected ( item , Ġfind Nav Controller ()) Ġ|| ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsuper . on Options ItemSelected ( item ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠFragment . apply Transitions () Ġ{ ĊĠĠĠ Ġ// ĠDefault Ġtransitions Ġsimilar Ġto ĠAndroid Ġ 1 0 + ĠActivity Ġtransitions ĊĠĠĠ Ġenter Transition Ġ= ĠMaterial Shared Axis ( Material Shared Axis . Z , Ġtrue ) ĊĠĠĠ Ġreturn Transition Ġ= ĠMaterial Shared Axis ( Material Shared Axis . Z , Ġfalse ) ĊĠĠĠ Ġexit Transition Ġ= ĠMaterial Shared Axis ( Material Shared Axis . Z , Ġtrue ) ĊĠĠĠ Ġre enter Transition Ġ= ĠMaterial Shared Axis ( Material Shared Axis . Z , Ġfalse ) Ċ } Ċ Ċ fun ĠFragment . apply Transitions View Created () Ġ{ ĊĠĠĠ Ġ// ĠWork around Ġfor ĠAndroid X Ġbug : Ġhttps :// github . com / material - components / material - components - android / issues / 1 9 8 4 ĊĠĠĠ Ġview ?. setBackground Resource ( R . drawable . solid _ background ) Ċ }