Home | History | Annotate | Download | only in android
      1 /*******************************************************************************
      2  * Copyright 2011 See AUTHORS file.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *   http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  ******************************************************************************/
     16 
     17 package com.badlogic.gdx.backends.android;
     18 
     19 import android.app.Activity;
     20 import android.content.Context;
     21 import android.content.Intent;
     22 import android.os.Handler;
     23 import android.view.Window;
     24 import android.view.WindowManager;
     25 
     26 import com.badlogic.gdx.Application;
     27 import com.badlogic.gdx.ApplicationListener;
     28 import com.badlogic.gdx.Audio;
     29 import com.badlogic.gdx.Input;
     30 import com.badlogic.gdx.LifecycleListener;
     31 import com.badlogic.gdx.utils.Array;
     32 import com.badlogic.gdx.utils.SnapshotArray;
     33 
     34 /** Interface that abstracts the Android application class usages, so that libGDX can be used with a fragment (or with any other
     35  * client code)
     36  *
     37  * @author Bartol Karuza (me (at) bartolkaruza.com)
     38  * @author davebaol */
     39 public interface AndroidApplicationBase extends Application {
     40 
     41 	static final int MINIMUM_SDK = 8;
     42 
     43 	/** The application or activity context
     44 	 *
     45 	 * @return the {@link Context} */
     46 	Context getContext ();
     47 
     48 	/** A set of usable runnables
     49 	 *
     50 	 * @return the {@link Runnable} array */
     51 	Array<Runnable> getRunnables ();
     52 
     53 	/** The currently executed runnables
     54 	 *
     55 	 * @return the {@link Runnable} array */
     56 	Array<Runnable> getExecutedRunnables ();
     57 
     58 	/** Method signifies an intent of the caller to execute some action on the UI Thread.
     59 	 *
     60 	 * @param runnable The runnable to be executed */
     61 	void runOnUiThread (Runnable runnable);
     62 
     63 	/** Method signifies an intent to start an activity, may be the default method of the {@link Activity} class
     64 	 *
     65 	 * @param intent The {@link Intent} for starting an activity */
     66 	void startActivity (Intent intent);
     67 
     68 	/** Returns the {@link AndroidInput} object associated with this {@link AndroidApplicationBase}
     69 	 *
     70 	 * @return the {@link AndroidInput} object */
     71 	@Override
     72 	AndroidInput getInput ();
     73 
     74 	/** Returns the {@link LifecycleListener} array associated with this {@link AndroidApplicationBase}
     75 	 *
     76 	 * @return the array of {@link LifecycleListener}'s */
     77 	SnapshotArray<LifecycleListener> getLifecycleListeners ();
     78 
     79 	/** Returns the Window associated with the application
     80 	 * @return The {@link Window} associated with the application */
     81 	Window getApplicationWindow ();
     82 
     83 	/** Returns the WindowManager associated with the application
     84 	 * @return The {@link WindowManager} associated with the application */
     85 	WindowManager getWindowManager ();
     86 
     87 	/** Activates Android 4.4 KitKat's 'Immersive Mode' feature.
     88 	 * @param b Whether or not to use immersive mode */
     89 	void useImmersiveMode (boolean b);
     90 
     91 	/** Returns the Handler object created by the application
     92 	 * @return The {@link Handler} object created by the application */
     93 	Handler getHandler ();
     94 }
     95