/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 9 Ġ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 . common . scene . target Ċ Ċ import Ġcom . android . tools . idea . common . model . Nl Component Ċ import Ġcom . android . tools . idea . np w . model . New Android Module Model Ċ import Ġcom . android . tools . idea . np w . model . Project Sync Invoker Ċ import Ġcom . android . tools . idea . np w . model . Project Sync Invoker . Default Project Sync Invoker Ċ import Ġcom . android . tools . idea . np w . model . Render Template Model . Companion . from Facet Ċ import Ġcom . android . tools . idea . np w . project . getModule Templates Ċ import Ġcom . android . tools . idea . np w . project . get Package For Path Ċ import Ġcom . android . tools . idea . np w . template . Choose Custom Fragment Templates Step Ċ import Ġcom . android . tools . idea . ui . wizard . Studio Wizard Dialog Builder Ċ import Ġcom . android . tools . idea . ui builder . api . View Editor Ċ import Ġcom . android . tools . idea . ui builder . api . View Handler Ċ import Ġcom . android . tools . idea . ui builder . api . actions . Direct View Action Ċ import Ġcom . android . tools . idea . wizard . model . Model Wizard Ċ import Ġcom . android . tools . idea . wizard . model . Sk ipp able Wizard Step Ċ import Ġcom . android . tools . idea . wizard . template . impl . xml . recycler adapter . current RecyclerView Layout Ċ import Ġcom . android . tools . idea . wizard . template . impl . xml . recycler adapter . re cyclerView Adapter Fragment Template Ċ import Ġcom . android . tools . idea . wizard . template . impl . xml . recycler adapter . re cyclerView Adapter No Fragment Template Ċ import Ġcom . google . wire less . android . sdk . stats . Android Studio Event . Templates Usage . Template Component . Wizard Ui Context . GENER ATE _ REC Y CL ER Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġcom . intellij . openapi . vfs . Virtual File Ċ import Ġorg . jetbrains . android . facet . Android Facet Ċ Ċ class ĠRecyclerView Adapter Creator Action Ġ@ Jvm Over loads Ġconstructor ( ĊĠ Ġassistant Label : ĠString Ġ= Ġ" Generate ĠRe cycler ĠView ĠAdapter " Ċ ) Ġ: ĠDirect View Action ( null , Ġassistant Label ) Ġ{ ĊĊĠ Ġoverride Ġfun Ġperform ( editor : ĠView Editor , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġhandler : ĠView Handler , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcomponent : ĠN l Component , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġselected Children : ĠMutable List < Nl Component >, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmodifiers : ĠInt ) Ġ{ ĊĠĠĠ Ġshow Wizard WithOptions ( component , Ġ" Choose Ġthe Ġadapter Ġoption ", Ġ" Choose Ġthe Ġadapter Ġoption ") ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠTrying Ġto Ġshow Ġmultiple Ġoptions Ġat Ġthe Ġfirst Ġwizard . ĊĠĠ Ġ*/ ĊĠ Ġprivate Ġfun Ġshow Wizard WithOptions ( component : ĠN l Component , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcommand Name : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdialog Title : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġproject Sync Invoker : ĠProject Sync Invoker Ġ= ĠDefault Project Sync Invoker () ĊĠĠĠ Ġval Ġfacet Ġ= ĠAndroid Facet . getInstance ( component . model . module ) !! ĊĠĠĠ Ġval Ġproject Ġ= Ġfacet . module . project ĊĠĠĠ Ġval Ġtarget Directory Ġ= Ġget Target Directory ( component ) ĊĠĠĠ Ġval Ġmodule Templates Ġ= Ġfacet . getModule Templates ( target Directory ) ĊĠĠĠ Ġval Ġinitial Package Suggestion Ġ= Ġfacet . get Package For Path ( module Templates , Ġtarget Directory ) ĊĊĠĠĠ Ġassert ( module Templates . isNotEmpty ()) ĊĊĠĠĠ Ġval Ġrender Model Ġ= Ġfrom Facet ( ĊĠĠĠĠĠ Ġfacet , Ġinitial Package Suggestion , Ġmodule Templates [ 0 ], Ġcommand Name , ĊĠĠĠĠĠ Ġproject Sync Invoker , Ġtrue , ĠGENER ATE _ REC Y CL ER ) ĊĊĠĠĠ Ġ// ĠRemove Ġ". xml " Ġfrom Ġthe Ġname . ĊĠĠĠ Ġcurrent RecyclerView Layout Ġ= Ġcomponent . model . file . name ĊĠĠĠ Ġcurrent RecyclerView Layout Ġ= Ġcurrent RecyclerView Layout . substring ( 0 , Ġcurrent RecyclerView Layout . length Ġ- Ġ 4 ) ĊĊĠĠĠ Ġval Ġtemplate Ġ= ĠlistOf ( ĊĠĠĠĠĠ Ġre cyclerView Adapter No Fragment Template , ĊĠĠĠĠĠ Ġre cyclerView Adapter Fragment Template ) ĊĊĠĠĠ Ġval Ġchoose Type Step : ĠSk ipp able Wizard Step < *> Ġ= ĠChoose Custom Fragment Templates Step ( render Model , Ġtarget Directory , Ġtemplate ) ĊĊĠĠĠ Ġval Ġwizard Builder Ġ= ĠModel Wizard . Builder (). apply Ġ{ ĊĠĠĠĠĠ Ġadd Step ( choose Type Step ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠMust Ġbe Ġlaunched Ġfrom Ġdispatch Ġthread . ĊĠĠĠ ĠApplication Manager . getApplication (). invoke Later Ġ{ ĊĠĠĠĠĠ ĠStudio Wizard Dialog Builder ( wizard Builder . build (), Ġdialog Title ). set Project ( project ). build (). show () ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġget Target Directory ( component : ĠN l Component ): ĠVirtual File Ġ{ ĊĠĠĠ Ġval Ġtarget File Ġ= Ġcomponent . model . file ĊĠĠĠ Ġvar Ġtarget Directory Ġ= Ġtarget File . virtual File ĊĠĠĠ Ġif Ġ(! target File . isDirectory ) Ġ{ ĊĠĠĠĠĠ Ġtarget Directory Ġ= Ġtarget File . parent ?. virtual File Ġ?: Ġtarget File . virtual File ĊĠĠĠĠĠ Ġassert ( target Directory Ġ!= Ġnull ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġtarget Directory ĊĠ Ġ} Ċ } ĊĊ