From 8802e05f27f200d5ba12fc6493f96c05d4da654f Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 10 Nov 2013 17:12:34 -0500 Subject: [PATCH] Change target SDK to KitKat. Use immersive mode for streaming on KitKat devices. --- AndroidManifest.xml | 2 +- project.properties | 2 +- src/com/limelight/Game.java | 26 +++++++++++++++++--- src/com/limelight/nvstream/NvConnection.java | 7 +++--- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 48f6b400..389e2352 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -6,7 +6,7 @@ + android:targetSdkVersion="19" /> diff --git a/project.properties b/project.properties index ce39f2d0..4ab12569 100644 --- a/project.properties +++ b/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-18 +target=android-19 diff --git a/src/com/limelight/Game.java b/src/com/limelight/Game.java index c43d63ba..b2a497c1 100644 --- a/src/com/limelight/Game.java +++ b/src/com/limelight/Game.java @@ -47,9 +47,6 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi // We don't want a title bar requestWindowFeature(Window.FEATURE_NO_TITLE); - // Make the UI "low profile" - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); - // Inflate the content setContentView(R.layout.activity_game); @@ -62,6 +59,29 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi conn = new NvConnection(Game.this.getIntent().getStringExtra("host"), Game.this, sv.getHolder().getSurface()); conn.start(); } + + public void hideSystemUi() { + runOnUiThread(new Runnable() { + @Override + public void run() { + // Use immersive mode on 4.4+ or standard low profile on previous builds + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { + Game.this.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); + } + else { + Game.this.getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_LOW_PROFILE); + } + } + }); + } @Override public void onPause() { diff --git a/src/com/limelight/nvstream/NvConnection.java b/src/com/limelight/nvstream/NvConnection.java index cf204d97..6bfe4db1 100644 --- a/src/com/limelight/nvstream/NvConnection.java +++ b/src/com/limelight/nvstream/NvConnection.java @@ -12,15 +12,15 @@ import java.util.concurrent.TimeUnit; import org.xmlpull.v1.XmlPullParserException; -import android.app.Activity; import android.view.Surface; import android.widget.Toast; +import com.limelight.Game; import com.limelight.nvstream.input.NvController; public class NvConnection { private String host; - private Activity activity; + private Game activity; private NvControl controlStream; private NvController inputStream; @@ -30,7 +30,7 @@ public class NvConnection { private ThreadPoolExecutor threadPool; - public NvConnection(String host, Activity activity, Surface video) + public NvConnection(String host, Game activity, Surface video) { this.host = host; this.activity = activity; @@ -107,6 +107,7 @@ public class NvConnection { beginControlStream(); controlStream.startJitterPackets(); startController(); + activity.hideSystemUi(); } catch (XmlPullParserException e) { e.printStackTrace(); displayToast(e.getMessage());