Merge pull request #6468 from kevlahnota/master2

fix ClassCastException
This commit is contained in:
kevlahnota
2024-10-30 12:13:34 +08:00
committed by GitHub

View File

@@ -31,9 +31,9 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.badlogic.gdx.*; import com.badlogic.gdx.*;
import com.badlogic.gdx.backends.android.keyboardheight.AndroidRKeyboardHeightProvider; /*import com.badlogic.gdx.backends.android.keyboardheight.AndroidRKeyboardHeightProvider;
import com.badlogic.gdx.backends.android.keyboardheight.KeyboardHeightProvider; import com.badlogic.gdx.backends.android.keyboardheight.KeyboardHeightProvider;
import com.badlogic.gdx.backends.android.keyboardheight.StandardKeyboardHeightProvider; import com.badlogic.gdx.backends.android.keyboardheight.StandardKeyboardHeightProvider;*/
import com.badlogic.gdx.backends.android.surfaceview.FillResolutionStrategy; import com.badlogic.gdx.backends.android.surfaceview.FillResolutionStrategy;
import com.badlogic.gdx.utils.*; import com.badlogic.gdx.utils.*;
@@ -63,7 +63,7 @@ public class ForgeAndroidApplication extends Activity implements AndroidApplicat
protected boolean useImmersiveMode = false; protected boolean useImmersiveMode = false;
private int wasFocusChanged = -1; private int wasFocusChanged = -1;
private boolean isWaitingForAudio = false; private boolean isWaitingForAudio = false;
private KeyboardHeightProvider keyboardHeightProvider; //private KeyboardHeightProvider keyboardHeightProvider;
protected boolean renderUnderCutout = false; protected boolean renderUnderCutout = false;
@@ -181,11 +181,11 @@ public class ForgeAndroidApplication extends Activity implements AndroidApplicat
setLayoutInDisplayCutoutMode(this.renderUnderCutout); setLayoutInDisplayCutoutMode(this.renderUnderCutout);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { /*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
keyboardHeightProvider = new AndroidRKeyboardHeightProvider(this); keyboardHeightProvider = new AndroidRKeyboardHeightProvider(this);
} else { } else {
keyboardHeightProvider = new StandardKeyboardHeightProvider(this); keyboardHeightProvider = new StandardKeyboardHeightProvider(this);
} }*/
} }
protected FrameLayout.LayoutParams createLayoutParams () { protected FrameLayout.LayoutParams createLayoutParams () {
@@ -260,7 +260,7 @@ public class ForgeAndroidApplication extends Activity implements AndroidApplicat
graphics.onPauseGLSurfaceView(); graphics.onPauseGLSurfaceView();
super.onPause(); super.onPause();
keyboardHeightProvider.setKeyboardHeightObserver(null); //keyboardHeightProvider.setKeyboardHeightObserver(null);
} }
@Override @Override
@@ -289,19 +289,19 @@ public class ForgeAndroidApplication extends Activity implements AndroidApplicat
this.isWaitingForAudio = false; this.isWaitingForAudio = false;
} }
super.onResume(); super.onResume();
keyboardHeightProvider.setKeyboardHeightObserver((DefaultAndroidInput)Gdx.input); /*keyboardHeightProvider.setKeyboardHeightObserver((DefaultAndroidInput)Gdx.input);
((AndroidGraphics)getGraphics()).getView().post(new Runnable() { ((AndroidGraphics)getGraphics()).getView().post(new Runnable() {
@Override @Override
public void run () { public void run () {
keyboardHeightProvider.start(); keyboardHeightProvider.start();
} }
}); });*/
} }
@Override @Override
protected void onDestroy () { protected void onDestroy () {
super.onDestroy(); super.onDestroy();
keyboardHeightProvider.close(); //keyboardHeightProvider.close();
} }
@Override @Override
@@ -528,7 +528,7 @@ public class ForgeAndroidApplication extends Activity implements AndroidApplicat
return new DefaultAndroidFiles(this.getAssets(), this, true); return new DefaultAndroidFiles(this.getAssets(), this, true);
} }
public KeyboardHeightProvider getKeyboardHeightProvider () { /*public KeyboardHeightProvider getKeyboardHeightProvider () {
return keyboardHeightProvider; return keyboardHeightProvider;
} }*/
} }