-
- All Implemented Interfaces:
-
android.view.View.OnGenericMotionListener,android.view.View.OnKeyListener,android.view.View.OnTouchListener,com.badlogic.gdx.Input,com.badlogic.gdx.backends.android.AndroidInput,com.badlogic.gdx.backends.android.keyboardheight.KeyboardHeightObserver
public class DefaultAndroidInput extends AbstractInput implements AndroidInput, KeyboardHeightObserver
An implementation of the Input interface for Android.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intNUM_TOUCHESArray<int>deltaXArray<int>deltaYArray<float>pressurepublic booleanaccelerometerAvailablepublic booleangyroscopeAvailablebooleankeyboardAvailableprivate floatazimuthprivate floatpitchprivate floatrollprotected final Input.OrientationnativeOrientation
-
Constructor Summary
Constructors Constructor Description DefaultAndroidInput(Application activity, Context context, Object view, AndroidApplicationConfiguration config)
-
Method Summary
Modifier and Type Method Description intgetDeltaX(int pointer)intgetDeltaY(int pointer)floatgetPressure(int pointer)voidsetKeyboardAvailable(boolean available)Shows/Hides soft screen keyboard floatgetAzimuth()floatgetPitch()floatgetRoll()Input.OrientationgetNativeOrientation()floatgetAccelerometerX()floatgetAccelerometerY()floatgetAccelerometerZ()floatgetGyroscopeX()floatgetGyroscopeY()floatgetGyroscopeZ()voidgetTextInput(Input.TextInputListener listener, String title, String text, String hint)voidgetTextInput(Input.TextInputListener listener, String title, String text, String hint, Input.OnscreenKeyboardType keyboardType)static intgetAndroidInputType(Input.OnscreenKeyboardType type, boolean defaultDisableAutocorrection)intgetMaxPointers()intgetX()intgetY()intgetX(int pointer)intgetY(int pointer)booleanisTouched(int pointer)booleanisTouched()voidsetInputProcessor(InputProcessor processor)voidprocessEvents()Process all events (touch, key) that have been registered by the listeners so that event processing is synchronous. booleanonTouch(View view, MotionEvent event)booleanonKey(View v, int keyCode, KeyEvent e)voidsetOnscreenKeyboardVisible(boolean visible)voidsetOnscreenKeyboardVisible(boolean visible, Input.OnscreenKeyboardType type)voidonKeyboardHeightChanged(int height, int leftInset, int rightInset, int orientation)Called when the keyboard height has changed, 0 means keyboard is closed, >= 1 means keyboard is opened. voidopenTextInputField(NativeInputConfiguration configuration)voidcloseTextInputField(boolean sendReturn)voidsetKeyboardHeightObserver(Input.KeyboardHeightObserver observer)voidvibrate(int milliseconds)voidvibrate(int milliseconds, boolean fallback)voidvibrate(int milliseconds, int amplitude, boolean fallback)voidvibrate(Input.VibrationType vibrationType)booleanjustTouched()booleanisButtonPressed(int button)booleanisButtonJustPressed(int button)voidgetRotationMatrix(Array<float> matrix)Returns the rotation matrix describing the devices rotation as perSensorManager#getRotationMatrix(float[], float[], float[], float[]). InputProcessorgetInputProcessor()booleanisPeripheralAvailable(Input.Peripheral peripheral)intgetFreePointerIndex()intlookUpPointerIndex(int pointerId)intgetRotation()voidsetCursorCatched(boolean catched)booleanisCursorCatched()voidsetCursorPosition(int x, int y)longgetCurrentEventTime()voidaddKeyListener(View.OnKeyListener listener)Add a custom OnKeyListener booleanonGenericMotion(View view, MotionEvent event)voidaddGenericMotionListener(View.OnGenericMotionListener listener)Add a custom OnGenericMotionListener voidonPause()Called when the AndroidApplication is about to pause voidonResume()Called when the AndroidApplication is about to resume voidonDreamingStarted()Called when an AndroidDaydream is about to start voidonDreamingStopped()Called when an AndroidDaydream is about to stop voidsetCatchKey(int keycode, boolean catchKey)-
Methods inherited from class com.badlogic.gdx.AbstractInput
isCatchKey, isKeyJustPressed, isKeyPressed, setCatchKey -
Methods inherited from class com.badlogic.gdx.Input
closeTextInputField, getAccelerometerX, getAccelerometerY, getAccelerometerZ, getAzimuth, getCurrentEventTime, getDeltaX, getDeltaY, getGyroscopeX, getGyroscopeY, getGyroscopeZ, getInputProcessor, getMaxPointers, getNativeOrientation, getPitch, getPressure, getRoll, getRotation, getRotationMatrix, getTextInput, getX, getY, isButtonJustPressed, isButtonPressed, isCursorCatched, isPeripheralAvailable, isTouched, justTouched, openTextInputField, setCursorCatched, setCursorPosition, setInputProcessor, setKeyboardHeightObserver, setOnscreenKeyboardVisible, vibrate -
Methods inherited from class android.view.View.OnTouchListener
onTouch -
Methods inherited from class android.view.View.OnKeyListener
onKey -
Methods inherited from class android.view.View.OnGenericMotionListener
onGenericMotion -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
DefaultAndroidInput
DefaultAndroidInput(Application activity, Context context, Object view, AndroidApplicationConfiguration config)
-
-
Method Detail
-
getDeltaX
int getDeltaX(int pointer)
-
getDeltaY
int getDeltaY(int pointer)
-
getPressure
float getPressure(int pointer)
-
setKeyboardAvailable
void setKeyboardAvailable(boolean available)
Shows/Hides soft screen keyboard
-
getAzimuth
float getAzimuth()
-
getPitch
float getPitch()
-
getRoll
float getRoll()
-
getNativeOrientation
Input.Orientation getNativeOrientation()
-
getAccelerometerX
float getAccelerometerX()
-
getAccelerometerY
float getAccelerometerY()
-
getAccelerometerZ
float getAccelerometerZ()
-
getGyroscopeX
float getGyroscopeX()
-
getGyroscopeY
float getGyroscopeY()
-
getGyroscopeZ
float getGyroscopeZ()
-
getTextInput
void getTextInput(Input.TextInputListener listener, String title, String text, String hint)
-
getTextInput
void getTextInput(Input.TextInputListener listener, String title, String text, String hint, Input.OnscreenKeyboardType keyboardType)
-
getAndroidInputType
static int getAndroidInputType(Input.OnscreenKeyboardType type, boolean defaultDisableAutocorrection)
-
getMaxPointers
int getMaxPointers()
-
getX
int getX()
-
getY
int getY()
-
getX
int getX(int pointer)
-
getY
int getY(int pointer)
-
isTouched
boolean isTouched(int pointer)
-
isTouched
boolean isTouched()
-
setInputProcessor
void setInputProcessor(InputProcessor processor)
-
processEvents
void processEvents()
Process all events (touch, key) that have been registered by the listeners so that event processing is synchronous.
-
onTouch
boolean onTouch(View view, MotionEvent event)
-
setOnscreenKeyboardVisible
void setOnscreenKeyboardVisible(boolean visible)
-
setOnscreenKeyboardVisible
void setOnscreenKeyboardVisible(boolean visible, Input.OnscreenKeyboardType type)
-
onKeyboardHeightChanged
void onKeyboardHeightChanged(int height, int leftInset, int rightInset, int orientation)
Called when the keyboard height has changed, 0 means keyboard is closed, >= 1 means keyboard is opened.
- Parameters:
height- The height of the keyboard in pixelsorientation- The orientation either: Configuration.ORIENTATION_PORTRAIT or Configuration.
-
openTextInputField
void openTextInputField(NativeInputConfiguration configuration)
-
closeTextInputField
void closeTextInputField(boolean sendReturn)
-
setKeyboardHeightObserver
void setKeyboardHeightObserver(Input.KeyboardHeightObserver observer)
-
vibrate
void vibrate(int milliseconds)
-
vibrate
void vibrate(int milliseconds, boolean fallback)
-
vibrate
void vibrate(int milliseconds, int amplitude, boolean fallback)
-
vibrate
void vibrate(Input.VibrationType vibrationType)
-
justTouched
boolean justTouched()
-
isButtonPressed
boolean isButtonPressed(int button)
-
isButtonJustPressed
boolean isButtonJustPressed(int button)
-
getRotationMatrix
void getRotationMatrix(Array<float> matrix)
Returns the rotation matrix describing the devices rotation as perSensorManager#getRotationMatrix(float[], float[], float[], float[]). Does not manipulate the matrixif the platform does not have an accelerometer and compass, or a rotation vector sensor.
-
getInputProcessor
InputProcessor getInputProcessor()
-
isPeripheralAvailable
boolean isPeripheralAvailable(Input.Peripheral peripheral)
-
getFreePointerIndex
int getFreePointerIndex()
-
lookUpPointerIndex
int lookUpPointerIndex(int pointerId)
-
getRotation
int getRotation()
-
setCursorCatched
void setCursorCatched(boolean catched)
-
isCursorCatched
boolean isCursorCatched()
-
setCursorPosition
void setCursorPosition(int x, int y)
-
getCurrentEventTime
long getCurrentEventTime()
-
addKeyListener
void addKeyListener(View.OnKeyListener listener)
Add a custom OnKeyListener
-
onGenericMotion
boolean onGenericMotion(View view, MotionEvent event)
-
addGenericMotionListener
void addGenericMotionListener(View.OnGenericMotionListener listener)
Add a custom OnGenericMotionListener
-
onPause
void onPause()
Called when the AndroidApplication is about to pause
-
onResume
void onResume()
Called when the AndroidApplication is about to resume
-
onDreamingStarted
void onDreamingStarted()
Called when an AndroidDaydream is about to start
-
onDreamingStopped
void onDreamingStopped()
Called when an AndroidDaydream is about to stop
-
setCatchKey
void setCatchKey(int keycode, boolean catchKey)
-
-
-
-