-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.view.View.OnCreateContextMenuListener,androidx.activity.result.ActivityResultCaller,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,com.badlogic.gdx.Application,com.badlogic.gdx.backends.android.AndroidApplicationBase
public class AndroidFragmentApplication extends Fragment implements AndroidApplicationBase
Implementation of the AndroidApplicationBase that is based on the Fragment class. This class is similar in use to the AndroidApplication class, which is based on an Activity.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceAndroidFragmentApplication.CallbacksCallbacks interface for letting the fragment interact with the Activitiy, parent fragment or target fragment.
-
Field Summary
Fields Modifier and Type Field Description protected AndroidInputinputpublic Handlerhandlerprotected final Array<Runnable>runnablesprotected final Array<Runnable>executedRunnablesprotected final SnapshotArray<LifecycleListener>lifecycleListenersprotected intlogLevelprotected ApplicationLoggerapplicationLogger
-
Method Summary
Modifier and Type Method Description AndroidInputgetInput()Returns the AndroidInput object associated with this AndroidApplicationBase HandlergetHandler()Returns the Handler object created by the application Array<Runnable>getRunnables()A set of usable runnables Array<Runnable>getExecutedRunnables()The currently executed runnables SnapshotArray<LifecycleListener>getLifecycleListeners()Returns the LifecycleListener array associated with this AndroidApplicationBase intgetLogLevel()voidsetLogLevel(int logLevel)ApplicationLoggergetApplicationLogger()voidsetApplicationLogger(ApplicationLogger applicationLogger)voidonAttach(Activity activity)voidonDetach()voiduseImmersiveMode(boolean use)Activates Android 4.4 KitKat's 'Immersive Mode' feature. ViewinitializeForView(ApplicationListener listener)This method has to be called in the onCreateView method. ViewinitializeForView(ApplicationListener listener, AndroidApplicationConfiguration config)This method has to be called in the onCreateView method. voidonPause()voidonResume()ApplicationListenergetApplicationListener()Application.ApplicationTypegetType()intgetVersion()longgetJavaHeap()longgetNativeHeap()PreferencesgetPreferences(String name)voidpostRunnable(Runnable runnable)voidonConfigurationChanged(Configuration config)voidexit()voiddebug(String tag, String message)voiddebug(String tag, String message, Throwable exception)voidlog(String tag, String message)voidlog(String tag, String message, Throwable exception)voiderror(String tag, String message)voiderror(String tag, String message, Throwable exception)voidaddLifecycleListener(LifecycleListener listener)voidremoveLifecycleListener(LifecycleListener listener)ContextgetContext()voidrunOnUiThread(Runnable runnable)Method signifies an intent of the caller to execute some action on the UI Thread. voidonActivityResult(int requestCode, int resultCode, Intent data)voidaddAndroidEventListener(AndroidEventListener listener)Adds an event listener for Android specific event such as onActivityResult(...). voidremoveAndroidEventListener(AndroidEventListener listener)Removes an event listener for Android specific event such as onActivityResult(...). WindowgetApplicationWindow()Returns the Window associated with the application AndroidAudiocreateAudio(Context context, AndroidApplicationConfiguration config)Returns the AndroidAudio to be used by the application AndroidInputcreateInput(Application activity, Context context, Object view, AndroidApplicationConfiguration config)Returns the AndroidInput to be used by the application WindowManagergetWindowManager()Returns the WindowManager associated with the application -
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hasOptionsMenu, hashCode, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, onViewCreated, onViewStateRestored, postponeEnterTransition, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu -
Methods inherited from class com.badlogic.gdx.backends.android.AndroidApplicationBase
startActivity, useImmersiveMode -
Methods inherited from class com.badlogic.gdx.Application
addLifecycleListener, debug, error, exit, getApplicationListener, getApplicationLogger, getAudio, getClipboard, getFiles, getGraphics, getInput, getJavaHeap, getLogLevel, getNativeHeap, getNet, getPreferences, getType, getVersion, log, postRunnable, removeLifecycleListener, setApplicationLogger, setLogLevel -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getInput
AndroidInput getInput()
Returns the AndroidInput object associated with this AndroidApplicationBase
-
getHandler
Handler getHandler()
Returns the Handler object created by the application
-
getRunnables
Array<Runnable> getRunnables()
A set of usable runnables
-
getExecutedRunnables
Array<Runnable> getExecutedRunnables()
The currently executed runnables
-
getLifecycleListeners
SnapshotArray<LifecycleListener> getLifecycleListeners()
Returns the LifecycleListener array associated with this AndroidApplicationBase
-
getLogLevel
int getLogLevel()
-
setLogLevel
void setLogLevel(int logLevel)
-
getApplicationLogger
ApplicationLogger getApplicationLogger()
-
setApplicationLogger
void setApplicationLogger(ApplicationLogger applicationLogger)
-
onDetach
void onDetach()
-
useImmersiveMode
void useImmersiveMode(boolean use)
Activates Android 4.4 KitKat's 'Immersive Mode' feature.
-
initializeForView
View initializeForView(ApplicationListener listener)
This method has to be called in the onCreateView method. It sets up allthe things necessary to get input, render via OpenGL and so on. Uses a default AndroidApplicationConfiguration.
Note: you have to return the returned view from the onCreateView!- Parameters:
listener- the ApplicationListener implementing the program logic
-
initializeForView
View initializeForView(ApplicationListener listener, AndroidApplicationConfiguration config)
This method has to be called in the onCreateView method. It sets up allthe things necessary to get input, render via OpenGL and so on. You can configure other aspects of the application with therest of the fields in the AndroidApplicationConfiguration instance.
Note: you have to return the returned view from onCreateView- Parameters:
listener- the ApplicationListener implementing the program logicconfig- the AndroidApplicationConfiguration, defining various settings of the application (use accelerometer,etc.).
-
onPause
void onPause()
-
onResume
void onResume()
-
getApplicationListener
ApplicationListener getApplicationListener()
-
getType
Application.ApplicationType getType()
-
getVersion
int getVersion()
-
getJavaHeap
long getJavaHeap()
-
getNativeHeap
long getNativeHeap()
-
getPreferences
Preferences getPreferences(String name)
-
postRunnable
void postRunnable(Runnable runnable)
-
onConfigurationChanged
void onConfigurationChanged(Configuration config)
-
exit
void exit()
-
addLifecycleListener
void addLifecycleListener(LifecycleListener listener)
-
removeLifecycleListener
void removeLifecycleListener(LifecycleListener listener)
-
getContext
Context getContext()
-
runOnUiThread
void runOnUiThread(Runnable runnable)
Method signifies an intent of the caller to execute some action on the UI Thread.
- Parameters:
runnable- The runnable to be executed
-
onActivityResult
void onActivityResult(int requestCode, int resultCode, Intent data)
-
addAndroidEventListener
void addAndroidEventListener(AndroidEventListener listener)
Adds an event listener for Android specific event such as onActivityResult(...).
-
removeAndroidEventListener
void removeAndroidEventListener(AndroidEventListener listener)
Removes an event listener for Android specific event such as onActivityResult(...).
-
getApplicationWindow
Window getApplicationWindow()
Returns the Window associated with the application
-
createAudio
AndroidAudio createAudio(Context context, AndroidApplicationConfiguration config)
Returns the AndroidAudio to be used by the application
-
createInput
AndroidInput createInput(Application activity, Context context, Object view, AndroidApplicationConfiguration config)
Returns the AndroidInput to be used by the application
-
getWindowManager
WindowManager getWindowManager()
Returns the WindowManager associated with the application
-
-
-
-