@Override public void onBackPressed() { ContactsSync app = ContactsSync.getInstance(); if (!app.getDisableAds()) { AppBrain.getAds().maybeShowInterstitial(this); finish(); } else { super.onBackPressed(); } }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.preferences); ContactsSync app = ContactsSync.getInstance(); if (!app.getDisableAds()) { LinearLayout adContainer = (LinearLayout) findViewById(R.id.ad_container); View ad = getLayoutInflater().inflate(R.layout.applovin, null); adContainer.addView(ad); } else { ((LinearLayout) findViewById(R.id.ad_container)).setVisibility(View.GONE); } FragmentTransaction ft = getFragmentManager().beginTransaction(); mFragment = new GlobalFragment(); ft.replace(R.id.settings, mFragment); ft.commit(); }