use kitkats new SYSTEM_UI_FLAG_IMMERSIVE on navbar hide (thx Simeon Mac)
This commit is contained in:
parent
3e00645f4a
commit
04d521f71c
@ -71,7 +71,15 @@ public class IITC_WebView extends WebView {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isInFullscreen() && (getFullscreenStatus() & (FS_NAVBAR)) != 0) {
|
||||
setSystemUiVisibility(SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
int systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
// in immersive mode the user can interact with the app while the navbar is hidden
|
||||
// this mode is available since KitKat
|
||||
// you can leave this mode by swiping down from the top of the screen. this does only work
|
||||
// when the app is in total-fullscreen mode
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && (mFullscreenStatus & FS_SYSBAR) != 0) {
|
||||
systemUiVisibility |= SYSTEM_UI_FLAG_IMMERSIVE;
|
||||
}
|
||||
setSystemUiVisibility(systemUiVisibility);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -185,20 +193,22 @@ public class IITC_WebView extends WebView {
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
getHandler().removeCallbacks(mNavHider);
|
||||
getHandler().postDelayed(mNavHider, 2000);
|
||||
getHandler().postDelayed(mNavHider, 3000);
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemUiVisibility(int visibility) {
|
||||
getHandler().postDelayed(mNavHider, 2000);
|
||||
if ((visibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
|
||||
getHandler().postDelayed(mNavHider, 3000);
|
||||
}
|
||||
super.setSystemUiVisibility(visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
if (hasWindowFocus) {
|
||||
getHandler().postDelayed(mNavHider, 2000);
|
||||
getHandler().postDelayed(mNavHider, 3000);
|
||||
} else {
|
||||
getHandler().removeCallbacks(mNavHider);
|
||||
}
|
||||
@ -220,7 +230,7 @@ public class IITC_WebView extends WebView {
|
||||
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||
}
|
||||
if ((mFullscreenStatus & FS_NAVBAR) != 0) {
|
||||
setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
getHandler().post(mNavHider);
|
||||
}
|
||||
if ((mFullscreenStatus & FS_STATUSBAR) != 0) {
|
||||
loadUrl("javascript: $('#updatestatus').hide();");
|
||||
|
@ -39,7 +39,7 @@ public class IntentListView extends ListView {
|
||||
|
||||
private class IntentAdapter extends ArrayAdapter<ResolveInfo> {
|
||||
|
||||
// actually the mdpi pixel size is 48, but this ugly...so scale icons down for listView
|
||||
// actually the mdpi pixel size is 48, but this looks ugly...so scale icons down for listView
|
||||
private static final int MDPI_PX = 36;
|
||||
|
||||
private IntentAdapter() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user