istereo2
view src/android/MainActivity.java @ 24:9d53a4938ce8
port to android mostly complete, ads not done, and needs some polishing
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 04 Oct 2015 08:15:24 +0300 |
parents | |
children | a9f2d30f7e8e |
line source
1 package com.mutantstargoat.stereotunnel;
3 import android.os.Bundle;
4 import android.app.NativeActivity;
5 import android.view.*;
6 import android.view.WindowManager.LayoutParams;
7 //import android.util.Log;
9 public class MainActivity extends NativeActivity
10 {
11 //public static String tag = "stereotunnel";
13 @Override
14 protected void onCreate(Bundle saved_inst)
15 {
16 super.onCreate(saved_inst);
18 // go fullscreen
19 int winflags = LayoutParams.FLAG_FULLSCREEN |
20 LayoutParams.FLAG_LAYOUT_NO_LIMITS | LayoutParams.FLAG_LAYOUT_IN_SCREEN;
21 Window win = getWindow();
22 win.setFlags(winflags, winflags);
23 }
25 @Override
26 public void onWindowFocusChanged(boolean focus)
27 {
28 super.onWindowFocusChanged(focus);
29 if(focus) {
30 set_fullscreen();
31 }
32 }
34 protected void onResume()
35 {
36 super.onResume();
37 set_fullscreen();
38 }
40 public void set_fullscreen()
41 {
42 int uiflags = View.SYSTEM_UI_FLAG_FULLSCREEN |
43 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
44 View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
45 View.SYSTEM_UI_FLAG_LOW_PROFILE;
47 if(android.os.Build.VERSION.SDK_INT >= 19) {
48 uiflags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
49 View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
50 View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
51 }
53 View decor = getWindow().getDecorView();
54 decor.setSystemUiVisibility(uiflags);
55 }
56 }