From fbdedb02342a1ddfd7fb3e002b6bad2dc67fe1e7 Mon Sep 17 00:00:00 2001 From: Ruben Date: Fri, 19 Aug 2016 17:07:14 +0100 Subject: [PATCH] Cleanup, of eg. the dummy_button --- .../emotionhero/GamingActivity.java | 26 +----------- app/src/main/res/layout/activity_gaming.xml | 40 +------------------ 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java b/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java index b29eaf2..6cbf75c 100644 --- a/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java +++ b/app/src/main/java/com/rubenvandeven/emotionhero/GamingActivity.java @@ -77,7 +77,7 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } }; - private View mControlsView; + private final Runnable mShowPart2Runnable = new Runnable() { @Override public void run() { @@ -86,7 +86,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL if (actionBar != null) { actionBar.show(); } - mControlsView.setVisibility(View.VISIBLE); } }; private boolean mVisible; @@ -96,20 +95,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL hide(); } }; - /** - * Touch listener to use for in-layout UI controls to delay hiding the - * system UI. This is to prevent the jarring behavior of controls going away - * while interacting with activity UI. - */ - private final View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() { - @Override - public boolean onTouch(View view, MotionEvent motionEvent) { - if (AUTO_HIDE) { - delayedHide(AUTO_HIDE_DELAY_MILLIS); - } - return false; - } - }; private CameraDetector detector; @@ -125,8 +110,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL Button restartButton; - TextView paramText; - public SoundPool sound; public HashMap soundIds = new HashMap<>(); @@ -140,11 +123,9 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL setContentView(R.layout.activity_gaming); mVisible = true; - mControlsView = findViewById(R.id.fullscreen_content_controls); mContentView = (TextView) findViewById(R.id.fullscreen_content); RelativeLayout videoLayout = (RelativeLayout) findViewById(R.id.video_layout); -// paramText = (TextView) findViewById(R.id.paramText); restartButton = (Button) findViewById(R.id.restartButton); restartButton.setOnClickListener(new View.OnClickListener() { @Override @@ -163,10 +144,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL } }); - // Upon interacting with UI controls, delay any scheduled hide() - // operations to prevent the jarring behavior of controls going away - // while interacting with the UI. - findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener); //We create a custom SurfaceView that resizes itself to match the aspect ratio of the incoming camera frames cameraPreview = new SurfaceView(this) { @@ -299,7 +276,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL if (actionBar != null) { actionBar.hide(); } - mControlsView.setVisibility(View.GONE); mVisible = false; // Schedule a runnable to remove the status and navigation bar after a delay diff --git a/app/src/main/res/layout/activity_gaming.xml b/app/src/main/res/layout/activity_gaming.xml index 15eb326..4c97447 100644 --- a/app/src/main/res/layout/activity_gaming.xml +++ b/app/src/main/res/layout/activity_gaming.xml @@ -3,6 +3,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/colorPrimary" + android:keepScreenOn="true" tools:context="com.rubenvandeven.emotionhero.GamingActivity"> - - - - - - - - - - - - - - - - - - - -