public class AndroidHarness extends android.app.Activity implements TouchListener, android.content.DialogInterface.OnClickListener, SystemListener
AndroidHarness
wraps a jme application object and runs it on
AndroidModifier and Type | Field and Description |
---|---|
protected LegacyApplication |
app
The jme3 application object
|
protected java.lang.String |
appClass
The application class to start
|
protected java.lang.String |
audioRendererType
Sets the type of Audio Renderer to be used.
|
protected OGLESContext |
ctx |
protected int |
eglAlphaBits
Sets the desired number of Alpha bits for the surfaceview.
|
protected int |
eglBitsPerPixel
Sets the desired RGB size for the surfaceview.
|
protected int |
eglDepthBits
The number of depth bits specifies the precision of the depth buffer.
|
protected int |
eglSamples
Sets the number of samples to use for multisampling.
Leave 0 (default) to disable multisampling. Set to 2 or 4 to enable multisampling. |
protected int |
eglStencilBits
Set the number of stencil bits.
|
protected java.lang.String |
exitDialogMessage
Message of the exit dialog, default is "Use your home key to bring this
app into the background or exit to terminate it."
|
protected java.lang.String |
exitDialogTitle
Title of the exit dialog, default is "Do you want to exit?"
|
protected boolean |
finishOnAppStop
if true finish this activity when the jme app is stopped
|
protected android.widget.FrameLayout |
frameLayout |
protected int |
frameRate
Set the desired frame rate.
|
protected boolean |
handleExitHook
set to false if you don't want the harness to handle the exit hook
|
protected boolean |
isGLThreadPaused |
protected boolean |
joystickEventsEnabled
If true Android Sensors are used as simulated Joysticks.
|
protected boolean |
keyEventsEnabled
If true KeyEvents are generated from TouchEvents
|
protected static java.util.logging.Logger |
logger |
protected boolean |
mouseEventsEnabled
If true MouseEvents are generated from TouchEvents
|
protected boolean |
mouseEventsInvertX
Flip X axis
|
protected boolean |
mouseEventsInvertY
Flip Y axis
|
protected boolean |
screenFullScreen
Set the screen window mode.
|
protected boolean |
screenShowTitle
if screenShowTitle is true while screenFullScreen is false, then the
title bar is also displayed under the notification bar
|
protected android.widget.ImageView |
splashImageView |
protected int |
splashPicID
Splash Screen picture Resource ID.
|
protected android.opengl.GLSurfaceView |
view |
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, CROSS_PROFILE_APPS_SERVICE, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, EUICC_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, IPSEC_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_RANGING_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
Constructor and Description |
---|
AndroidHarness() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Callback to indicate that the context has been destroyed (either
by the user or requested by the application itself).
|
void |
gainFocus()
Called when the application gained focus.
|
Application |
getJmeApplication() |
void |
handleError(java.lang.String errorMsg,
java.lang.Throwable t)
Called when an error has occurred.
|
void |
initialize()
Callback to indicate the application to initialize.
|
protected void |
initializeLogHandler()
Removes the standard Android log handler due to an issue with not logging
entries lower than INFO level and adds a handler that produces
JME formatted log messages.
|
void |
layoutDisplay() |
void |
loseFocus()
Called when the application lost focus.
|
void |
onClick(android.content.DialogInterface dialog,
int whichButton)
Called by the android alert dialog, terminate the activity and OpenGL
rendering
|
void |
onCreate(android.os.Bundle savedInstanceState) |
protected void |
onDestroy() |
protected void |
onPause() |
protected void |
onRestart() |
protected void |
onResume() |
java.lang.Object |
onRetainNonConfigurationInstance() |
protected void |
onStart() |
protected void |
onStop() |
void |
onTouch(java.lang.String name,
TouchEvent evt,
float tpf)
Gets called by the InputManager on all touch/drag/scale events
|
void |
removeSplashScreen() |
void |
requestClose(boolean esc)
Called when the user requests to close the application.
|
void |
rescale(float x,
float y)
Called to notify the application that the scale has changed.
|
void |
reshape(int width,
int height)
Called to notify the application that the resolution has changed.
|
void |
update()
Callback to update the application state, and render the scene
to the back buffer.
|
addContentView, attachBaseContext, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, enterPictureInPictureMode, enterPictureInPictureMode, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMaxNumPictureInPictureActions, getMediaController, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isActivityTransitionRunning, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onActivityResult, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackPressed, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onLowMemory, onMenuItemSelected, onMenuOpened, onMultiWindowModeChanged, onMultiWindowModeChanged, onNavigateUp, onNavigateUpFromChild, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPictureInPictureModeChanged, onPictureInPictureModeChanged, onPostCreate, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onPreparePanel, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onRequestPermissionsResult, onRestoreInstanceState, onRestoreInstanceState, onSaveInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onStateNotSaved, onTitleChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, postponeEnterTransition, recreate, registerForContextMenu, releaseInstance, removeDialog, reportFullyDrawn, requestDragAndDropPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, requireViewById, runOnUiThread, setActionBar, setContentTransitionManager, setContentView, setContentView, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setShowWhenLocked, setTaskDescription, setTheme, setTitle, setTitle, setTitleColor, setTurnScreenOn, setVisible, setVolumeControlStream, setVrModeEnabled, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
applyOverrideConfiguration, getAssets, getResources, getTheme
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
protected static final java.util.logging.Logger logger
protected java.lang.String appClass
protected LegacyApplication app
protected int eglBitsPerPixel
protected int eglAlphaBits
protected int eglDepthBits
protected int eglSamples
protected int eglStencilBits
protected int frameRate
protected java.lang.String audioRendererType
Android MediaPlayer / SoundPool can be used on all
supported Android platform versions (2.2+)
OpenAL Soft uses an OpenSL backend and is only supported on Android
versions 2.3+.
Only use ANDROID_ static strings found in AppSettings
protected boolean joystickEventsEnabled
protected boolean keyEventsEnabled
protected boolean mouseEventsEnabled
protected boolean mouseEventsInvertX
protected boolean mouseEventsInvertY
protected boolean finishOnAppStop
protected boolean handleExitHook
protected java.lang.String exitDialogTitle
protected java.lang.String exitDialogMessage
protected boolean screenFullScreen
protected boolean screenShowTitle
protected int splashPicID
protected OGLESContext ctx
protected android.opengl.GLSurfaceView view
protected boolean isGLThreadPaused
protected android.widget.ImageView splashImageView
protected android.widget.FrameLayout frameLayout
public java.lang.Object onRetainNonConfigurationInstance()
onRetainNonConfigurationInstance
in class android.app.Activity
public void onCreate(android.os.Bundle savedInstanceState)
onCreate
in class android.app.Activity
protected void onRestart()
onRestart
in class android.app.Activity
protected void onStart()
onStart
in class android.app.Activity
protected void onResume()
onResume
in class android.app.Activity
protected void onPause()
onPause
in class android.app.Activity
protected void onStop()
onStop
in class android.app.Activity
protected void onDestroy()
onDestroy
in class android.app.Activity
public Application getJmeApplication()
public void handleError(java.lang.String errorMsg, java.lang.Throwable t)
handleError
in interface SystemListener
errorMsg
- The error message, if any, or null.t
- Throwable object, or null.public void onClick(android.content.DialogInterface dialog, int whichButton)
onClick
in interface android.content.DialogInterface.OnClickListener
dialog
- ignoredwhichButton
- the button indexpublic void onTouch(java.lang.String name, TouchEvent evt, float tpf)
onTouch
in interface TouchListener
name
- the name of the eventevt
- the touch eventtpf
- how much time has passed since the last framepublic void layoutDisplay()
public void removeSplashScreen()
protected void initializeLogHandler()
public void initialize()
SystemListener
initialize
in interface SystemListener
public void reshape(int width, int height)
SystemListener
reshape
in interface SystemListener
width
- the new width of the display (in pixels, ≥0)height
- the new height of the display (in pixels, ≥0)public void rescale(float x, float y)
SystemListener
rescale
in interface SystemListener
x
- the new horizontal scale of the displayy
- the new vertical scale of the displaypublic void update()
SystemListener
update
in interface SystemListener
public void requestClose(boolean esc)
SystemListener
requestClose
in interface SystemListener
esc
- If true, the user pressed ESC to close the application.public void destroy()
SystemListener
destroy
in interface SystemListener
public void gainFocus()
SystemListener
gainFocus
in interface SystemListener
public void loseFocus()
SystemListener
loseFocus
in interface SystemListener