Java 类com.badlogic.gdx.backends.android.AndroidApplicationBase 实例源码

项目:thunderboard-android    文件:GdxDemoActivity.java   
private void init(ApplicationListener listener, AndroidApplicationConfiguration config, boolean isForView) {
    if (this.getVersion() < MINIMUM_SDK) {
        throw new GdxRuntimeException("LibGDX requires Android API Level " + MINIMUM_SDK + " or later.");
    }
    graphics = new AndroidGraphics(this, config, config.resolutionStrategy == null ? new FillResolutionStrategy()
            : config.resolutionStrategy);
    input = AndroidInputFactory.newAndroidInput(this, this.getContext(), graphics.getView(), config);
    audio = new AndroidAudio(this.getContext(), config);
    this.getContext().getFilesDir(); // workaround for Android bug #10515463
    files = new AndroidFiles(this.getContext().getAssets(), this.getContext().getFilesDir().getAbsolutePath());
    net = new AndroidNet(this);
    this.listener = listener;
    this.handler = new Handler();
    this.useImmersiveMode = config.useImmersiveMode;
    this.hideStatusBar = config.hideStatusBar;

    // Add a specialized audio lifecycle listener
    addLifecycleListener(new LifecycleListener() {

        @Override
        public void resume() {
            // No need to resume audio here
        }

        @Override
        public void pause() {
            audio.pause();
        }

        @Override
        public void dispose() {
            audio.dispose();
        }
    });

    Gdx.app = this;
    Gdx.input = this.getInput();
    Gdx.audio = this.getAudio();
    Gdx.files = this.getFiles();
    Gdx.graphics = this.getGraphics();
    Gdx.net = this.getNet();

    if (!isForView) {
        try {
            supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        } catch (Exception ex) {
            log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex);
        }

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        setContentView(graphics.getView(), createLayoutParams());
    }

    createWakeLock(config.useWakelock);
    hideStatusBar(this.hideStatusBar);
    useImmersiveMode(this.useImmersiveMode);
    if (this.useImmersiveMode && getVersion() >= Build.VERSION_CODES.KITKAT) {
        try {
            Class<?> vlistener = Class.forName("com.badlogic.gdx.backends.android.AndroidVisibilityListener");
            Object o = vlistener.newInstance();
            Method method = vlistener.getDeclaredMethod("createListener", AndroidApplicationBase.class);
            method.invoke(o, this);
        } catch (Exception e) {
            log("AndroidApplication", "Failed to create AndroidVisibilityListener", e);
        }
    }
}
项目:CodeSamples    文件:ARRenderer.java   
public ARRenderer(AndroidApplicationBase application, AndroidApplicationConfiguration config, ResolutionStrategy resolutionStrategy) {
    super(application, config, resolutionStrategy);
}
项目:CodeSamples    文件:SimpleRenderer.java   
public SimpleRenderer(Context context, AndroidApplicationBase application, AndroidApplicationConfiguration config, ResolutionStrategy resolutionStrategy) {
    super(application, config, resolutionStrategy);
    this.context = context;                         // Save Specified Context
}
项目:gdx-pd    文件:PdAudioAndroid.java   
public PdAudioAndroid() {
    super();
    this.context = ((AndroidApplicationBase)Gdx.app).getContext();

    FileHelper.trimCache(context);
}