v0.7.5b: renamed AndroidLauncher to AndroidGame
This commit is contained in:
parent
0f52c38e7a
commit
b86d7572c8
|
@ -25,7 +25,7 @@
|
||||||
android:backupAgent=".AndroidBackupHandler">
|
android:backupAgent=".AndroidBackupHandler">
|
||||||
<activity
|
<activity
|
||||||
android:label="${appName}"
|
android:label="${appName}"
|
||||||
android:name=".AndroidLauncher"
|
android:name=".AndroidGame"
|
||||||
android:screenOrientation="nosensor"
|
android:screenOrientation="nosensor"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation">
|
android:configChanges="keyboard|keyboardHidden|orientation">
|
||||||
<intent-filter >
|
<intent-filter >
|
||||||
|
|
|
@ -37,7 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.audio.Music;
|
import com.watabou.noosa.audio.Music;
|
||||||
|
|
||||||
public class AndroidLauncher extends AndroidApplication {
|
public class AndroidGame extends AndroidApplication {
|
||||||
|
|
||||||
public static AndroidApplication instance;
|
public static AndroidApplication instance;
|
||||||
protected static GLSurfaceView view;
|
protected static GLSurfaceView view;
|
|
@ -47,15 +47,15 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
||||||
public void updateDisplaySize(){
|
public void updateDisplaySize(){
|
||||||
boolean landscape = SPDSettings.landscape();
|
boolean landscape = SPDSettings.landscape();
|
||||||
|
|
||||||
AndroidLauncher.instance.setRequestedOrientation(landscape ?
|
AndroidGame.instance.setRequestedOrientation(landscape ?
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||||
|
|
||||||
if (AndroidLauncher.view.getMeasuredWidth() == 0 || AndroidLauncher.view.getMeasuredHeight() == 0)
|
if (AndroidGame.view.getMeasuredWidth() == 0 || AndroidGame.view.getMeasuredHeight() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Game.dispWidth = AndroidLauncher.view.getMeasuredWidth();
|
Game.dispWidth = AndroidGame.view.getMeasuredWidth();
|
||||||
Game.dispHeight = AndroidLauncher.view.getMeasuredHeight();
|
Game.dispHeight = AndroidGame.view.getMeasuredHeight();
|
||||||
|
|
||||||
if ((Game.dispWidth > Game.dispHeight) != landscape){
|
if ((Game.dispWidth > Game.dispHeight) != landscape){
|
||||||
int tmp = Game.dispWidth;
|
int tmp = Game.dispWidth;
|
||||||
|
@ -89,19 +89,19 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
||||||
final int finalH = Math.round(renderHeight);
|
final int finalH = Math.round(renderHeight);
|
||||||
if (finalW != Game.width || finalH != Game.height){
|
if (finalW != Game.width || finalH != Game.height){
|
||||||
|
|
||||||
AndroidLauncher.instance.runOnUiThread(new Runnable() {
|
AndroidGame.instance.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AndroidLauncher.view.getHolder().setFixedSize(finalW, finalH);
|
AndroidGame.view.getHolder().setFixedSize(finalW, finalH);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AndroidLauncher.instance.runOnUiThread(new Runnable() {
|
AndroidGame.instance.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AndroidLauncher.view.getHolder().setSizeFromLayout();
|
AndroidGame.view.getHolder().setSizeFromLayout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -109,29 +109,29 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
||||||
|
|
||||||
public void updateSystemUI() {
|
public void updateSystemUI() {
|
||||||
|
|
||||||
AndroidLauncher.instance.runOnUiThread(new Runnable() {
|
AndroidGame.instance.runOnUiThread(new Runnable() {
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean fullscreen = Build.VERSION.SDK_INT < Build.VERSION_CODES.N
|
boolean fullscreen = Build.VERSION.SDK_INT < Build.VERSION_CODES.N
|
||||||
|| !AndroidLauncher.instance.isInMultiWindowMode();
|
|| !AndroidGame.instance.isInMultiWindowMode();
|
||||||
|
|
||||||
if (fullscreen){
|
if (fullscreen){
|
||||||
AndroidLauncher.instance.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
AndroidGame.instance.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||||
} else {
|
} else {
|
||||||
AndroidLauncher.instance.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
|
AndroidGame.instance.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
|
||||||
if (SPDSettings.fullscreen()) {
|
if (SPDSettings.fullscreen()) {
|
||||||
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
|
AndroidGame.instance.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
|
||||||
} else {
|
} else {
|
||||||
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
|
AndroidGame.instance.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||||
import com.badlogic.gdx.backends.android.AndroidGraphics;
|
import com.badlogic.gdx.backends.android.AndroidGraphics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.android.AndroidLauncher;
|
import com.shatteredpixel.shatteredpixeldungeon.android.AndroidGame;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||||
|
@ -98,7 +98,7 @@ public class WndAndroidTextInput extends Window {
|
||||||
textInput = new EditText((AndroidApplication)Gdx.app);
|
textInput = new EditText((AndroidApplication)Gdx.app);
|
||||||
textInput.setText( initialValue );
|
textInput.setText( initialValue );
|
||||||
if (!SPDSettings.systemFont()){
|
if (!SPDSettings.systemFont()){
|
||||||
textInput.setTypeface( Typeface.createFromAsset(AndroidLauncher.instance.getAssets(), "pixel_font.ttf") );
|
textInput.setTypeface( Typeface.createFromAsset(AndroidGame.instance.getAssets(), "pixel_font.ttf") );
|
||||||
}
|
}
|
||||||
textInput.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
|
textInput.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
|
||||||
textInput.setInputType( InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES );
|
textInput.setInputType( InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user