From 7f1fe5f520878b26ff103d74b5e6bb38186b0a98 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 10 Jun 2017 11:48:25 -0700 Subject: [PATCH] Fix NPE if the device doesn't support H.264 hardware decoding --- app/src/main/java/com/limelight/Game.java | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index e583487e..bf4efd49 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -171,6 +171,20 @@ public class Game extends Activity implements SurfaceHolder.Callback, streamView.setOnGenericMotionListener(this); streamView.setOnTouchListener(this); + inputCaptureProvider = InputCaptureManager.getInputCaptureProvider(this, this); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + // The view must be focusable for pointer capture to work. + streamView.setFocusable(true); + streamView.setDefaultFocusHighlightEnabled(false); + streamView.setOnCapturedPointerListener(new View.OnCapturedPointerListener() { + @Override + public boolean onCapturedPointer(View view, MotionEvent motionEvent) { + return handleMotionEvent(motionEvent); + } + }); + } + // Warn the user if they're on a metered connection checkDataConnection(); @@ -257,20 +271,6 @@ public class Game extends Activity implements SurfaceHolder.Callback, getWindow().setSustainedPerformanceMode(true); } - inputCaptureProvider = InputCaptureManager.getInputCaptureProvider(this, this); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - // The view must be focusable for pointer capture to work. - streamView.setFocusable(true); - streamView.setDefaultFocusHighlightEnabled(false); - streamView.setOnCapturedPointerListener(new View.OnCapturedPointerListener() { - @Override - public boolean onCapturedPointer(View view, MotionEvent motionEvent) { - return handleMotionEvent(motionEvent); - } - }); - } - if (prefConfig.onscreenController) { // create virtual onscreen controller virtualController = new VirtualController(conn,