package Ġcom . pro labs . the story writer Ċ Ċ import Ġandroid . graphics . Type face Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . TextView Ċ import Ġandroidx . recyclerview . widget . RecyclerView Ċ Ċ class ĠFont Recycler Adapter ( var Ġfont List : ArrayList < String >, var Ġcontext : Editor Activity ): ĠRecyclerView . Adapter < Font Recycler Adapter . Font ViewHolder >() Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġbackground s = ĠarrayOf ( R . drawable . background , R . drawable . background 2 , R . drawable . background 3 , R . drawable . background 4 , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . background 5 , R . drawable . background 6 , R . drawable . background 7 ) ĊĊĠĠĠ Ġclass ĠFont ViewHolder ( var Ġv : ĠView ): RecyclerView . ViewHolder ( v ){ ĊĠĠĠĠĠĠĠ Ġvar ĠtextView : TextView = v . findViewById ( R . id . font Adapter Layout ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ViewHolder ( parent : ĠViewGroup , Ġview Type : ĠInt ): ĠFont ViewHolder Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġlayout Inflater = LayoutInflater . from ( parent . context ) ĊĠĠĠĠĠĠĠ Ġval Ġview = layout Inflater . inflate ( R . layout . font _ adapter _ layout , parent , false ) ĊĠĠĠĠĠĠĠ Ġreturn ĠFont ViewHolder ( view ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetItem Count (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġfont List . size ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Bind ViewHolder ( holder : ĠFont ViewHolder , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtype face = Type face . createFrom Asset ( context . assets ," fonts /"+ Ġfont List [ position ]) ĊĠĠĠĠĠĠĠ Ġvar Ġdisplay String = font List [ position ]. replace ('- ',' Ġ'). split ('. ')[ 0 ] ĊĠĠĠĠĠĠĠ Ġholder . textView . text = display String ĊĠĠĠĠĠĠĠ Ġholder . textView . type face = type face ĊĠĠĠĠĠĠĠ Ġholder . textView . setBackground Resource ( background s [ position % background s . size ]) ĊĠĠĠĠĠĠĠ Ġholder . textView . setOnClickListener { v -> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . used Font = font List [ position ] ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . font RecyclerView . visibility = View . GONE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . blur Background . visibility = View . GONE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . draw () ĊĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }