Cleanup, of eg. the dummy_button

This commit is contained in:
Ruben 2016-08-19 17:07:14 +01:00
parent 13cda51aff
commit fbdedb0234
2 changed files with 2 additions and 64 deletions

View file

@ -77,7 +77,7 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
} }
}; };
private View mControlsView;
private final Runnable mShowPart2Runnable = new Runnable() { private final Runnable mShowPart2Runnable = new Runnable() {
@Override @Override
public void run() { public void run() {
@ -86,7 +86,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
if (actionBar != null) { if (actionBar != null) {
actionBar.show(); actionBar.show();
} }
mControlsView.setVisibility(View.VISIBLE);
} }
}; };
private boolean mVisible; private boolean mVisible;
@ -96,20 +95,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
hide(); 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; private CameraDetector detector;
@ -125,8 +110,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
Button restartButton; Button restartButton;
TextView paramText;
public SoundPool sound; public SoundPool sound;
public HashMap<Integer, Integer> soundIds = new HashMap<>(); public HashMap<Integer, Integer> soundIds = new HashMap<>();
@ -140,11 +123,9 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
setContentView(R.layout.activity_gaming); setContentView(R.layout.activity_gaming);
mVisible = true; mVisible = true;
mControlsView = findViewById(R.id.fullscreen_content_controls);
mContentView = (TextView) findViewById(R.id.fullscreen_content); mContentView = (TextView) findViewById(R.id.fullscreen_content);
RelativeLayout videoLayout = (RelativeLayout) findViewById(R.id.video_layout); RelativeLayout videoLayout = (RelativeLayout) findViewById(R.id.video_layout);
// paramText = (TextView) findViewById(R.id.paramText);
restartButton = (Button) findViewById(R.id.restartButton); restartButton = (Button) findViewById(R.id.restartButton);
restartButton.setOnClickListener(new View.OnClickListener() { restartButton.setOnClickListener(new View.OnClickListener() {
@Override @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 //We create a custom SurfaceView that resizes itself to match the aspect ratio of the incoming camera frames
cameraPreview = new SurfaceView(this) { cameraPreview = new SurfaceView(this) {
@ -299,7 +276,6 @@ public class GamingActivity extends AppCompatActivity implements Detector.ImageL
if (actionBar != null) { if (actionBar != null) {
actionBar.hide(); actionBar.hide();
} }
mControlsView.setVisibility(View.GONE);
mVisible = false; mVisible = false;
// Schedule a runnable to remove the status and navigation bar after a delay // Schedule a runnable to remove the status and navigation bar after a delay

View file

@ -3,6 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:keepScreenOn="true"
tools:context="com.rubenvandeven.emotionhero.GamingActivity"> tools:context="com.rubenvandeven.emotionhero.GamingActivity">
<!-- The primary full-screen view. This can be replaced with whatever view <!-- The primary full-screen view. This can be replaced with whatever view
@ -27,51 +28,12 @@
android:textSize="50sp" android:textSize="50sp"
android:textStyle="bold" /> android:textStyle="bold" />
<!-- This FrameLayout insets its children based on system windows using
android:fitsSystemWindows. -->
<!--<view-->
<!--class="com.rubenvandeven.emotionhero.ScenarioView"-->
<!--android:layout_width="match_parent"-->
<!--android:id="@+id/scenarioView"-->
<!--android:layout_height="match_parent" />-->
<!--<TextView-->
<!--android:text="No face found"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:id="@+id/paramText"-->
<!--android:textColor="@android:color/white"-->
<!--android:layout_marginLeft="10dp"-->
<!--android:layout_marginTop="10dp"-->
<!--android:fontFamily="monospace" />-->
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/fullscreen_content_controls"
style="?metaButtonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal"
tools:ignore="UselessParent">
<Button
android:id="@+id/dummy_button"
style="?metaButtonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/dummy_button" />
</LinearLayout>
<Button <Button
android:text="@string/restart" android:text="@string/restart"
android:layout_width="wrap_content" android:layout_width="wrap_content"