From 5cf28a35d3cd19714a84a7e74b2ca04e855393bf Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Thu, 6 Aug 2015 14:58:10 -0500 Subject: [PATCH] add activity for android-specific initialization This is work towards #23. Unfortunately, due to javafxports/android [#73](https://bitbucket.org/javafxports/android/issues/73/hardware-button-key-events-report) and [#75](https://bitbucket.org/javafxports/android/issues/75/fxactivity-does-not-call), there is no way to control volume. However, this *should* work once #75 is fixed. --- app/src/android/AndroidManifest.xml | 8 +++-- .../gamefolk/roomfullofcats/CatsActivity.java | 31 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 app/src/android/java/org/gamefolk/roomfullofcats/CatsActivity.java diff --git a/app/src/android/AndroidManifest.xml b/app/src/android/AndroidManifest.xml index 1442e97..db51816 100644 --- a/app/src/android/AndroidManifest.xml +++ b/app/src/android/AndroidManifest.xml @@ -23,14 +23,18 @@ - + + + + diff --git a/app/src/android/java/org/gamefolk/roomfullofcats/CatsActivity.java b/app/src/android/java/org/gamefolk/roomfullofcats/CatsActivity.java new file mode 100644 index 0000000..8e5f19a --- /dev/null +++ b/app/src/android/java/org/gamefolk/roomfullofcats/CatsActivity.java @@ -0,0 +1,31 @@ +package org.gamefolk.roomfullofcats; + +import android.app.Activity; +import android.content.Intent; +import android.media.AudioManager; +import android.os.Bundle; + +import javafxports.android.FXActivity; + +import java.util.logging.Logger; + +/** + * Shim class that immediately passes control to FXActivity. + * + * We use this to perform any Android-specific initialization. + */ +public class CatsActivity extends Activity { + + private static final Logger Log = Logger.getLogger(RoomFullOfCatsApp.class.getName()); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // This should work, once javafxports/android #73 and #75 are fixed. + setVolumeControlStream(AudioManager.STREAM_MUSIC); + + Intent intent = new Intent(this, FXActivity.class); + startActivity(intent); + } +}