java - System Bars Flash then Disappear on Back in Immersive Sticky mode -
i've read on lot of questions immersive sticky mode on android, cannot find specific answer question.
i have read onbackpressed function not working under immersive sticky mode, app goes when imagebutton pressed.
i want remain in immersive sticky mode whole duration of app. there no problem when launch new activity, , without shared element transition. however, when go back, system bars appears slide out of view again. happens when stay on activity while.
this transition called _trickpage.class:
public void setborroringsonclicklistener(view view){ dbhelper.close(); intent intent = new intent(this, _dominoscene.class); startactivity(intent); }
and call finish() _trickpage.class _domino.class:
findviewbyid(r.id.picture).setonclicklistener(new view.onclicklistener(){ @override public void onclick(view v){ dbhelper.close(); finish(); } });
another transition use shared element transition. following inner class of buttonadapter, extends baseadapter, object in _submenu activity:
class myonclicklistener implements view.onclicklistener { private final int position; public myonclicklistener(int position){ this.position = position; } @override public void onclick(view v) { ... //link clicked button _trickpage button shared transition v.settransitionname("trick"); //make , start shared transition _trickpage activityoptions options = activityoptions.makescenetransitionanimation( (activity)mcontext, new pair<view, string>(v, "trick") ); intent intent = new intent(v.getcontext(), _trickpage.class); v.getcontext().startactivity(intent, options.tobundle()); } }
finally, _submenu _trickpage, call finishaftertransition():
picture.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { dbhelper.close(); hidemaincontent(); finishaftertransition(); } });
i set ui flags in oncreate() , onresume() methods of activities involved: _submenu, _trickpage, , _dominoscene. have following in each activity:
public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); //if (hasfocus) getwindow().getdecorview().setsystemuivisibility( view.system_ui_flag_layout_stable | view.system_ui_flag_layout_hide_navigation | view.system_ui_flag_layout_fullscreen | view.system_ui_flag_hide_navigation | view.system_ui_flag_fullscreen | view.system_ui_flag_immersive_sticky); if (hasfocus && playanimations) { //showmaincontent(); playanimations = false; } }
this first time asking question on stack overflow, please ask other parts of code if think there problem there. thanks!
call method on oncreate method every activity(right after setcontentview method). , on onwindowsfocuschanged
public void goimmersive() { getwindow().getdecorview().setsystemuivisibility( view.system_ui_flag_layout_stable | view.system_ui_flag_layout_hide_navigation | view.system_ui_flag_layout_fullscreen | view.system_ui_flag_hide_navigation | view.system_ui_flag_fullscreen | view.system_ui_flag_immersive_sticky); }
Comments
Post a Comment