package Ġcom . he ys al adin . k arm ag roup modern Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . graphics . Bitmap Ċ import Ġandroid . graphics . drawable . Bitmap Drawable Ċ import Ġandroid . graphics . drawable . Drawable Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . widget . ImageView Ċ import Ġandroid . widget . TextView ĊĊ Ċ object ĠConverter Ġ{ ĊĊĠĠĠ Ġfun Ġconvert Layout To Image ( mContext : ĠContext , Ġcount : ĠInt , Ġdrawable Id : ĠInt ): ĠDrawable Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġinflater Ġ= ĠLayoutInflater . from ( mContext ) ĊĠĠĠĠĠĠĠ Ġval Ġview Ġ= Ġinflater . inflate ( R . layout . badge _ icon _ layout , Ġnull ) ĊĠĠĠĠĠĠĠ Ġ( view . findViewById ( R . id . icon _ badge ) Ġas ĠImageView ). setImage Resource ( drawable Id ) Ċ // ĠĠĠĠĠĠĠ Ġval Ġcounter Text Panel Ġ= Ġview . findViewById ( R . id . counter Value Panel ) ĊĠĠĠĠĠĠĠ Ġif Ġ( count Ġ== Ġ 0 ) Ġ{ Ċ Ċ // ĠĠĠĠĠĠĠĠĠĠĠ Ġcounter Text Panel . setVisibility ( View . GONE ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval ĠtextView Ġ= Ġview . findViewById ( R . id . count ) Ġas ĠTextView ĊĠĠĠĠĠĠĠĠĠĠĠ ĠtextView . text Ġ= Ġ"" Ġ+ Ġcount ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġview . measure ( View . Measure Spec . make Measure Spec ( 0 , ĠView . Measure Spec . UNSPECIFIED ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠView . Measure Spec . make Measure Spec ( 0 , ĠView . Measure Spec . UNSPECIFIED )) ĊĠĠĠĠĠĠĠ Ġview . layout ( 0 , Ġ 0 , Ġview . get Measured Width (), Ġview . get Measured Height ()) ĊĊĠĠĠĠĠĠĠ Ġview . set Drawing Cache Enabled ( true ) ĊĠĠĠĠĠĠĠ Ġview . set Drawing Cache Quality ( View . DRAW ING _ CACHE _ QUAL ITY _ HIGH ) ĊĠĠĠĠĠĠĠ Ġval Ġbitmap Ġ= ĠBitmap . create Bitmap ( view . get Drawing Cache ()) ĊĠĠĠĠĠĠĠ Ġview . set Drawing Cache Enabled ( false ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠBitmap Drawable ( mContext . resources , Ġbitmap ) ĊĠĠĠ Ġ} Ċ } Ċ