Search in sources :

Example 1 with AndroidApplicationConfiguration

use of com.badlogic.gdx.backends.android.AndroidApplicationConfiguration in project libgdx by libgdx.

the class LiveWallpaper method onCreateApplication.

@Override
public void onCreateApplication() {
    super.onCreateApplication();
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    ApplicationListener listener = new MyLiveWallpaperListener();
    initialize(listener, config);
}
Also used : ApplicationListener(com.badlogic.gdx.ApplicationListener) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)

Example 2 with AndroidApplicationConfiguration

use of com.badlogic.gdx.backends.android.AndroidApplicationConfiguration in project RubeLoader by tescott.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    initialize(new RubeLoaderTest(true), cfg);
}
Also used : RubeLoaderTest(com.gushikustudios.rube.RubeLoaderTest) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)

Example 3 with AndroidApplicationConfiguration

use of com.badlogic.gdx.backends.android.AndroidApplicationConfiguration in project bdx by GoranM.

the class AndroidLauncher method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    int width = 666;
    int height = 444;
    config.resolutionStrategy = new RatioResolutionStrategy(width, height);
    initialize(new BdxApp(), config);
}
Also used : BdxApp(com.comp.proj.BdxApp) RatioResolutionStrategy(com.badlogic.gdx.backends.android.surfaceview.RatioResolutionStrategy) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)

Example 4 with AndroidApplicationConfiguration

use of com.badlogic.gdx.backends.android.AndroidApplicationConfiguration in project Mindustry by Anuken.

the class AndroidLauncher method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.useImmersiveMode = true;
    Platform.instance = new Platform() {

        DateFormat format = SimpleDateFormat.getDateTimeInstance();

        @Override
        public boolean hasDiscord() {
            return isPackageInstalled("com.discord");
        }

        @Override
        public String format(Date date) {
            return format.format(date);
        }

        @Override
        public String format(int number) {
            return NumberFormat.getIntegerInstance().format(number);
        }

        @Override
        public void addDialog(TextField field, int length) {
            TextFieldDialogListener.add(field, 0, length);
        }

        @Override
        public String getLocaleName(Locale locale) {
            return locale.getDisplayName(locale);
        }

        @Override
        public void openDonations() {
            showDonations();
        }

        @Override
        public void requestWritePerms() {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                    requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE }, WRITE_REQUEST_CODE);
                } else {
                    if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                        requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, WRITE_REQUEST_CODE);
                    }
                    if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                        requestPermissions(new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, WRITE_REQUEST_CODE);
                    }
                }
            }
        }

        @Override
        public ThreadProvider getThreadProvider() {
            return new DefaultThreadImpl();
        }

        @Override
        public boolean isDebug() {
            return false;
        }

        @Override
        public byte[] getUUID() {
            try {
                String s = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
                int len = s.length();
                byte[] data = new byte[len / 2];
                for (int i = 0; i < len; i += 2) {
                    data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16));
                }
                return data;
            } catch (Exception e) {
                Settings.defaults("uuid", "");
                String uuid = Settings.getString("uuid");
                if (uuid.isEmpty()) {
                    byte[] result = new byte[8];
                    new Random().nextBytes(result);
                    uuid = new String(Base64Coder.encode(result));
                    Settings.putString("uuid", uuid);
                    Settings.save();
                    return result;
                }
                return Base64Coder.decode(uuid);
            }
        }
    };
    if (doubleScaleTablets && isTablet(this.getContext())) {
        Unit.dp.addition = 0.5f;
    }
    config.hideStatusBar = true;
    Net.setClientProvider(new KryoClient());
    Net.setServerProvider(new KryoServer());
    initialize(new Mindustry(), config);
}
Also used : Locale(java.util.Locale) Platform(io.anuke.mindustry.io.Platform) KryoServer(io.anuke.kryonet.KryoServer) DefaultThreadImpl(io.anuke.kryonet.DefaultThreadImpl) Date(java.util.Date) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration) Random(java.util.Random) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) TextField(io.anuke.ucore.scene.ui.TextField) ThreadProvider(io.anuke.mindustry.core.ThreadHandler.ThreadProvider) KryoClient(io.anuke.kryonet.KryoClient)

Example 5 with AndroidApplicationConfiguration

use of com.badlogic.gdx.backends.android.AndroidApplicationConfiguration in project shattered-pixel-dungeon-gdx by 00-Evan.

the class AndroidLauncher method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    String version;
    int versionCode;
    try {
        version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
        versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        version = "???";
        versionCode = 0;
    }
    initialize(new ShatteredPixelDungeon(new PDPlatformSupport<GameAction>(version, versionCode, null, new AndroidInputProcessor())), config);
}
Also used : PackageManager(android.content.pm.PackageManager) PDPlatformSupport(com.watabou.utils.PDPlatformSupport) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration) ShatteredPixelDungeon(com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon)

Aggregations

AndroidApplicationConfiguration (com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)12 ApplicationListener (com.badlogic.gdx.ApplicationListener)2 PackageManager (android.content.pm.PackageManager)1 Bundle (android.os.Bundle)1 RatioResolutionStrategy (com.badlogic.gdx.backends.android.surfaceview.RatioResolutionStrategy)1 MeshShaderTest (com.badlogic.gdx.tests.MeshShaderTest)1 GdxTest (com.badlogic.gdx.tests.utils.GdxTest)1 BdxApp (com.comp.proj.BdxApp)1 RubeLoaderTest (com.gushikustudios.rube.RubeLoaderTest)1 MyFirstGame (com.mygdx.game.MyFirstGame)1 ShatteredPixelDungeon (com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon)1 Semiprime (com.snd.semiprime.Semiprime)1 PDPlatformSupport (com.watabou.utils.PDPlatformSupport)1 DefaultThreadImpl (io.anuke.kryonet.DefaultThreadImpl)1 KryoClient (io.anuke.kryonet.KryoClient)1 KryoServer (io.anuke.kryonet.KryoServer)1 ThreadProvider (io.anuke.mindustry.core.ThreadHandler.ThreadProvider)1 Platform (io.anuke.mindustry.io.Platform)1 TextField (io.anuke.ucore.scene.ui.TextField)1 DateFormat (java.text.DateFormat)1