Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hopefully i understand what you are after here but, in my app (TEAM BatteryBar) i had a similar problem. ( no root minimal permissions )</p> <p>I couldn't detect a full screen on anything below API11 (and intermittent on some (Samsung mostly) devices above API11). So i made a custom listener for it by adding a second layout to the WindowManager with a different layout param then overrode the onLayout to check if the statusBar is still there or not by checking the window size. from there you can do what ever you need to to your main view.</p> <p>I was going to tidy it up but it worked so i didn't :P code is over a year old and is from when i first started coding for android so yeah. Food for thought tho. hope it helps.</p> <p><a href="https://github.com/pvyParts/Android-Helpers" rel="nofollow">here is the code in a repo at my github</a> with a copy paste straight out of my app on how i am using it. small snippet here</p> <pre><code>wm.addView(sizeLayout, params);// add your view // then add the next one Screendetect mDetector; mDetector = new Screendetect(this); mDetector.setOnFullScreenListener(new OnFullScreenListener() { @Override public void fsChanged(boolean FS_Bool) { // TODO rethink this to be better.... bit hacky... if (FS_Bool) { Log.d("battbardetect", "Statusbar hidden"); FS_vissible(); // do what ever you need to } else if (!FS_Bool) { Log.d("battbardetect", "Statusbar Vissible"); FS_hidden(); // do what ever you need to } } }); wm.addView(mDetector, params); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COI will try OnFullScreenListener, but basically your answer is just re-wording/doing the same thing I have already tried, and what I have documented does not work on all devices. It works on some, but not others (seemingly without explanation). On the non-working devices your method (and mine/deviants) do not seem to be detecting the overlay resize automatically, whether it's using OnFullScreenListener, OnGlobalLayoutListener, or overriding onSizeChanged on the overlay layout.
      singulars
    2. COI looked at your code and you are just overriding onLayout, which I've already tried without success on the non-working devices. In my example/question I override onSizeChanged and tried overriding just about every view method I could within an inflated overlay layout (pretty much just the same as you did).
      singulars
    3. COOk thanks for trying. I tried your code, pretty much word for word and same problem, onLayout is only called once when the view is first added (or on configuration change), and not again until the service (or view) is destroyed/removed and created/added again. And even if I repeatedly add and remove the view the vertical size never changes unless I add the layout in screen flag. So basically same problems, at least as tested on a Samsung GS2 API15. BTW onSystemUiVisibilityChange doesn't work either. I don't get any events from that: the GS2 device is ICS with physical navigation keys.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload