mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
update libs for LibGDX 1.13.5
update gdx-controllers
This commit is contained in:
@@ -55,8 +55,7 @@ public class AndroidApplication extends Activity implements AndroidApplicationBa
|
||||
protected boolean firstResume = true;
|
||||
protected final Array<Runnable> runnables = new Array<Runnable>();
|
||||
protected final Array<Runnable> executedRunnables = new Array<Runnable>();
|
||||
protected final SnapshotArray<LifecycleListener> lifecycleListeners = new SnapshotArray<LifecycleListener>(
|
||||
LifecycleListener.class);
|
||||
protected final SnapshotArray<LifecycleListener> lifecycleListeners = new SnapshotArray<>(LifecycleListener[]::new);
|
||||
private final Array<AndroidEventListener> androidEventListeners = new Array<AndroidEventListener>();
|
||||
protected int logLevel = LOG_INFO;
|
||||
protected ApplicationLogger applicationLogger;
|
||||
@@ -295,8 +294,8 @@ public class AndroidApplication extends Activity implements AndroidApplicationBa
|
||||
|
||||
@Override
|
||||
protected void onDestroy () {
|
||||
super.onDestroy();
|
||||
keyboardHeightProvider.close();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.badlogic.gdx.backends.android;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@@ -63,6 +64,7 @@ import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/** An implementation of the {@link Input} interface for Android.
|
||||
@@ -114,9 +116,9 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
|
||||
public static final int NUM_TOUCHES = 20;
|
||||
|
||||
ArrayList<OnKeyListener> keyListeners = new ArrayList();
|
||||
ArrayList<KeyEvent> keyEvents = new ArrayList();
|
||||
ArrayList<TouchEvent> touchEvents = new ArrayList();
|
||||
ArrayList<OnKeyListener> keyListeners = new ArrayList<>();
|
||||
ArrayList<KeyEvent> keyEvents = new ArrayList<>();
|
||||
ArrayList<TouchEvent> touchEvents = new ArrayList<>();
|
||||
int[] touchX = new int[NUM_TOUCHES];
|
||||
int[] touchY = new int[NUM_TOUCHES];
|
||||
int[] deltaX = new int[NUM_TOUCHES];
|
||||
@@ -126,17 +128,16 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
int[] realId = new int[NUM_TOUCHES];
|
||||
float[] pressure = new float[NUM_TOUCHES];
|
||||
final boolean hasMultitouch;
|
||||
private boolean[] justPressedButtons = new boolean[NUM_TOUCHES];
|
||||
private final boolean[] justPressedButtons = new boolean[NUM_TOUCHES];
|
||||
private SensorManager manager;
|
||||
public boolean accelerometerAvailable = false;
|
||||
protected final float[] accelerometerValues = new float[3];
|
||||
public boolean gyroscopeAvailable = false;
|
||||
protected final float[] gyroscopeValues = new float[3];
|
||||
private Handler handle;
|
||||
private final Handler handle;
|
||||
final Application app;
|
||||
final Context context;
|
||||
protected final AndroidTouchHandler touchHandler;
|
||||
private int sleepTime = 0;
|
||||
protected final AndroidHaptics haptics;
|
||||
private boolean compassAvailable = false;
|
||||
private boolean rotationVectorAvailable = false;
|
||||
@@ -158,12 +159,12 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
private SensorEventListener compassListener;
|
||||
private SensorEventListener rotationVectorListener;
|
||||
|
||||
private final ArrayList<OnGenericMotionListener> genericMotionListeners = new ArrayList();
|
||||
private final ArrayList<OnGenericMotionListener> genericMotionListeners = new ArrayList<>();
|
||||
private final AndroidMouseHandler mouseHandler;
|
||||
|
||||
public DefaultAndroidInput (Application activity, Context context, Object view, AndroidApplicationConfiguration config) {
|
||||
// we hook into View, for LWPs we call onTouch below directly from
|
||||
// within the AndroidLivewallpaperEngine#onTouchEvent() method.
|
||||
// within the AndroidWallpaperEngine#onTouchEvent() method.
|
||||
if (view instanceof View) {
|
||||
View v = (View)view;
|
||||
v.setOnKeyListener(this);
|
||||
@@ -181,7 +182,6 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
handle = new Handler();
|
||||
this.app = activity;
|
||||
this.context = context;
|
||||
this.sleepTime = config.touchSleepTime;
|
||||
touchHandler = new AndroidTouchHandler();
|
||||
hasMultitouch = touchHandler.supportsMultitouch(context);
|
||||
|
||||
@@ -403,15 +403,11 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
synchronized (this) {
|
||||
if (justTouched) {
|
||||
justTouched = false;
|
||||
for (int i = 0; i < justPressedButtons.length; i++) {
|
||||
justPressedButtons[i] = false;
|
||||
}
|
||||
Arrays.fill(justPressedButtons, false);
|
||||
}
|
||||
if (keyJustPressed) {
|
||||
keyJustPressed = false;
|
||||
for (int i = 0; i < justPressedKeys.length; i++) {
|
||||
justPressedKeys[i] = false;
|
||||
}
|
||||
Arrays.fill(justPressedKeys, false);
|
||||
}
|
||||
|
||||
if (processor != null) {
|
||||
@@ -491,6 +487,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
|
||||
boolean requestFocus = true;
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouch (View view, MotionEvent event) {
|
||||
if (requestFocus && view != null) {
|
||||
@@ -502,51 +499,9 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
// synchronized in handler.postTouchEvent()
|
||||
touchHandler.onTouch(event, this);
|
||||
|
||||
if (sleepTime != 0) {
|
||||
try {
|
||||
Thread.sleep(sleepTime);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO Seems unused. Delete when confirmed.
|
||||
// /** Called in {@link AndroidLiveWallpaperService} on tap
|
||||
// * @param x
|
||||
// * @param y */
|
||||
// public void onTap (int x, int y) {
|
||||
// postTap(x, y);
|
||||
// }
|
||||
//
|
||||
// /** Called in {@link AndroidLiveWallpaperService} on drop
|
||||
// * @param x
|
||||
// * @param y */
|
||||
// public void onDrop (int x, int y) {
|
||||
// postTap(x, y);
|
||||
// }
|
||||
//
|
||||
// protected void postTap (int x, int y) {
|
||||
// synchronized (this) {
|
||||
// TouchEvent event = usedTouchEvents.obtain();
|
||||
// event.timeStamp = System.nanoTime();
|
||||
// event.pointer = 0;
|
||||
// event.x = x;
|
||||
// event.y = y;
|
||||
// event.type = TouchEvent.TOUCH_DOWN;
|
||||
// touchEvents.add(event);
|
||||
//
|
||||
// event = usedTouchEvents.obtain();
|
||||
// event.timeStamp = System.nanoTime();
|
||||
// event.pointer = 0;
|
||||
// event.x = x;
|
||||
// event.y = y;
|
||||
// event.type = TouchEvent.TOUCH_UP;
|
||||
// touchEvents.add(event);
|
||||
// }
|
||||
// Gdx.app.getGraphics().requestRendering();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean onKey (View v, int keyCode, android.view.KeyEvent e) {
|
||||
for (int i = 0, n = keyListeners.size(); i < n; i++)
|
||||
@@ -680,9 +635,6 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
androidApplication.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||
int usableHeight = metrics.heightPixels;
|
||||
int sdkVersion = android.os.Build.VERSION.SDK_INT;
|
||||
if (sdkVersion < 17) return usableHeight;
|
||||
|
||||
androidApplication.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
|
||||
int realHeight = metrics.heightPixels;
|
||||
|
||||
@@ -1036,7 +988,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
final String text = editText.getText().toString();
|
||||
final int selection = editText.getSelectionStart();
|
||||
Gdx.app.postRunnable(new Runnable() {
|
||||
TextInputWrapper wrapper = textInputWrapper;
|
||||
final TextInputWrapper wrapper = textInputWrapper;
|
||||
|
||||
@Override
|
||||
public void run () {
|
||||
@@ -1145,7 +1097,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
* <a href= "http://developer.android.com/reference/android/hardware/SensorManager.html#getRotationMatrix(float[], float[],
|
||||
* float[], float[])" >SensorManager#getRotationMatrix(float[], float[], float[], float[])</a>. Does not manipulate the matrix
|
||||
* if the platform does not have an accelerometer and compass, or a rotation vector sensor.
|
||||
* @param matrix */
|
||||
* @param matrix the device's rotation matrix */
|
||||
public void getRotationMatrix (float[] matrix) {
|
||||
if (rotationVectorAvailable)
|
||||
SensorManager.getRotationMatrixFromVector(matrix, rotationVectorValues);
|
||||
@@ -1323,7 +1275,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < len; i++) {
|
||||
sb.append(i + ":" + realId[i] + " ");
|
||||
sb.append(i).append(":").append(realId[i]).append(" ");
|
||||
}
|
||||
Gdx.app.log("AndroidInput", "Pointer ID lookup failed: " + pointerId + ", " + sb.toString());
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user