Rev 342 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.pingkfree;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.gebauz.pingk.PingkApp;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
public class MainFreeActivity
extends AndroidApplication
{
@
Override
public void onCreate
(Bundle savedInstanceState
)
{
super.
onCreate(savedInstanceState
);
AndroidApplicationConfiguration cfg =
new AndroidApplicationConfiguration
();
cfg.
useGL20 =
true;
cfg.
useAccelerometer =
false;
cfg.
useCompass =
false;
RelativeLayout layout =
new RelativeLayout
(this);
// Do the stuff that initialize() would do for you
requestWindowFeature
(Window.
FEATURE_NO_TITLE);
getWindow
().
setFlags(WindowManager.
LayoutParams.
FLAG_FULLSCREEN,
WindowManager.
LayoutParams.
FLAG_FULLSCREEN);
getWindow
().
clearFlags(WindowManager.
LayoutParams.
FLAG_FORCE_NOT_FULLSCREEN);
getWindow
().
addFlags(WindowManager.
LayoutParams.
FLAG_KEEP_SCREEN_ON);
// Create the libgdx View
View gameView = initializeForView
(new PingkApp
(true), cfg
);
// Create and setup the AdMob view
AdView adView =
new AdView
(this, AdSize.
BANNER,
"a1502cdacab5f14"); // Put in your secret key here
adView.
loadAd(new AdRequest
());
// Add the libgdx view
layout.
addView(gameView
);
// Add the AdMob view
RelativeLayout.
LayoutParams adParams =
new RelativeLayout.
LayoutParams(RelativeLayout.
LayoutParams.
WRAP_CONTENT,
RelativeLayout.
LayoutParams.
WRAP_CONTENT);
adParams.
addRule(RelativeLayout.
ALIGN_PARENT_BOTTOM);
adParams.
addRule(RelativeLayout.
CENTER_IN_PARENT);
layout.
addView(adView, adParams
);
// Hook it all up
setContentView
(layout
);
//initialize(new PingkApp(), cfg);
}
}