/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 2 0 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . android . tools . idea . wizard . template . impl . activities . primary Detail Flow . src . app _ package Ċ Ċ import Ġcom . android . tools . idea . wizard . template . Language Ċ import Ġcom . android . tools . idea . wizard . template . get Material Component Name Ċ import Ġcom . android . tools . idea . wizard . template . escape Kotlin Identifier Ċ import Ġcom . android . tools . idea . wizard . template . impl . activities . common . import View Binding Class Ċ import Ġcom . android . tools . idea . wizard . template . impl . activities . common . layout To View Binding Class Ċ Ċ fun Ġcontent List Detail Host Activity Kt ( ĊĠ ĠpackageName : ĠString , ĊĠ Ġcollection : ĠString , ĊĠ Ġactivity Layout : ĠString , ĊĠ Ġnav Host Fragment Id : ĠString , ĊĠ Ġuse Android X : ĠBoolean , ĊĠ Ġis View Binding Supported : ĠBoolean Ċ ): ĠString Ġ{ ĊĠ Ġval Ġlayout Name Ġ= Ġ" activity _${ activity Layout }" ĊĠ Ġval Ġcontent View Block Ġ= Ġif Ġ( is View Binding Supported ) Ġ""" ĊĠĠĠĠ Ġval Ġbinding Ġ= Ġ${ layout To View Binding Class ( layout Name )}. inflate ( layout Inflater ) ĊĠĠĠĠ ĠsetContentView ( binding . root ) ĊĠ Ġ""" Ġelse Ġ" set ContentView ( R . layout .$ layout Name )" ĊĊĠ Ġreturn Ġ""" Ċ package Ġ${ escape Kotlin Identifier ( packageName )} ĊĊ Ċ import Ġandroid . os . Bundle Ċ import Ġ${ get Material Component Name (" android . support . v 7 . app . AppCompatActivity ", Ġuse Android X )} Ċ import Ġandroidx . navigation . find Nav Controller Ċ import Ġandroidx . navigation . fragment . Nav Host Fragment Ċ import Ġandroidx . navigation . ui . AppBar Configuration Ċ import Ġandroidx . navigation . ui . navigate Up Ċ import Ġandroidx . navigation . ui . setup ActionBar With Nav Controller Ċ ${ import View Binding Class ( is View Binding Supported , ĠpackageName , Ġlayout Name , ĠLanguage . Kotlin )} Ċ Ċ class Ġ${ collection } Detail Host Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġapp Bar Configuration : ĠApp Bar Configuration ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġ$ content View Block ĊĊĠĠĠĠĠĠĠ Ġval Ġnav Host Fragment Ġ= Ġsupport FragmentManager . find Fragment ById ( R . id .${ nav Host Fragment Id }) Ġas ĠNav Host Fragment ĊĠĠĠĠĠĠĠ Ġval Ġnav Controller Ġ= Ġnav Host Fragment . nav Controller ĊĠĠĠĠĠĠĠ Ġapp Bar Configuration Ġ= ĠApp Bar Configuration ( nav Controller . graph ) ĊĠĠĠĠĠĠĠ Ġsetup ActionBar With Nav Controller ( nav Controller , Ġapp Bar Configuration ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Support Navigate Up (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnav Controller Ġ= Ġfind Nav Controller ( R . id .${ nav Host Fragment Id }) ĊĠĠĠĠĠĠĠ Ġreturn Ġnav Controller . navigate Up ( app Bar Configuration ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ|| Ġsuper . on Support Navigate Up () ĊĠĠĠ Ġ} Ċ } ĊĠ Ġ""" Ċ } Ċ