package Ġcom . stream _ suite . link . fragment . message Ċ Ċ import Ġandroid . graphics . Rect Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . view . View Tree Observer Ċ import Ġandroid . widget . Frame Layout Ċ import Ġxyz . k linker . android . drag _ dismiss . util . StatusBar Helper Ċ import Ġcom . stream _ suite . link . activity . Messenger Activity Ċ import Ġjava . lang . IllegalStateException Ċ Ċ class ĠEdge To Edge Keyboard Work around ( private Ġval Ġactivity : ĠMess enger Activity ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġcontent Container Ġ= Ġactivity . findViewById < ViewGroup >( android . R . id . content ) ĊĠĠĠ Ġprivate Ġval Ġroot View Ġ= Ġcontent Container . getChild At ( 0 ) ĊĠĠĠ Ġprivate Ġval Ġroot View Layout Ġ= Ġroot View . layout Params Ġas ĠFrame Layout . LayoutParams ĊĠĠĠ Ġprivate Ġvar Ġview Tree Observer Ġ= Ġroot View . view Tree Observer ĊĠĠĠ Ġprivate Ġval Ġlistener Ġ= ĠView Tree Observer . On Global Layout Listener Ġ{ Ġpossibly Resize Child Of Content () Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġcontent Area Of Window Bounds Ġ= ĠRect () ĊĠĠĠ Ġprivate Ġvar Ġusable Height Previous Ġ= Ġ 0 ĊĊĠĠĠ Ġfun Ġadd Listener () Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Tree Observer . add On Global Layout Listener ( listener ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalStateException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġobserver Ġisn 't Ġalive , Ġget Ġit Ġagain ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Tree Observer Ġ= Ġroot View . view Tree Observer ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Tree Observer . add On Global Layout Listener ( listener ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġremove Listener () Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Tree Observer . remove On Global Layout Listener ( listener ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalStateException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġobserver Ġisn 't Ġalive , Ġget Ġit Ġagain ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Tree Observer Ġ= Ġroot View . view Tree Observer ĊĠĠĠĠĠĠĠĠĠĠĠ Ġview Tree Observer . remove On Global Layout Listener ( listener ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġpossibly Resize Child Of Content () Ġ{ ĊĠĠĠĠĠĠĠ Ġcontent Container . getWindow Visible Display Frame ( content Area Of Window Bounds ) ĊĠĠĠĠĠĠĠ Ġval Ġstatus bar Size Ġ= ĠStatus Bar Helper . getStatus Bar Height ( activity ) ĊĠĠĠĠĠĠĠ Ġval Ġusable Height Now Ġ= Ġcontent Area Of Window Bounds . height () Ġ+ Ġstatus bar Size Ġ+ Ġactivity . in set Controller . bottom In setValue ĊĠĠĠĠĠĠĠ Ġif Ġ( usable Height Now Ġ!= Ġusable Height Previous ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġroot View Layout . height Ġ= Ġusable Height Now ĊĠĠĠĠĠĠĠĠĠĠĠ Ġroot View . layout ( content Area Of Window Bounds . left , Ġcontent Area Of Window Bounds . top , Ġcontent Area Of Window Bounds . right , Ġcontent Area Of Window Bounds . bottom ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġroot View . request Layout () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġusable Height Previous Ġ= Ġusable Height Now ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ } Ċ