use of com.google.android.gms.ads.InterstitialAd in project superCleanMaster by joyoyao.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFragmentContainerView = (View) findViewById(R.id.navigation_drawer);
mTitle = getTitle();
applyKitKatTranslucency();
onNavigationDrawerItemSelected(0);
initDrawer();
MobileAds.initialize(this, "ca-app-pub-4369038195513432/2986510514");
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("ca-app-pub-4369038195513432/2986510514");
mInterstitialAd.loadAd(new AdRequest.Builder().build());
MyApp myApp = new MyApp();
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
use of com.google.android.gms.ads.InterstitialAd in project Android-NotesApp by HelloPraveenIO.
the class EditActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(EditActivity.this);
premium = preferences.getInt("premium", 0);
interstitialAd = new InterstitialAd(EditActivity.this);
interstitialAd.setAdUnitId("ca-app-pub-8429477298745270/2004640333");
interstitialAd.loadAd(new AdRequest.Builder().build());
intent = new Intent(EditActivity.this, MainActivity.class);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/whitney.ttf").setFontAttrId(R.attr.fontPath).build());
Typeface font2 = Typeface.createFromAsset(getAssets(), "fonts/whitney.ttf");
SpannableStringBuilder SS = new SpannableStringBuilder("Edit Note");
SS.setSpan(new CustomTypefaceSpan("", font2), 0, SS.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(SS);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
String noteText = "", noteTitle = "";
if (getIntent().getExtras() != null) {
noteText = getIntent().getExtras().getString("note");
noteTitle = getIntent().getExtras().getString("title");
}
FloatingActionButton fab = findViewById(R.id.edit_fab);
text = findViewById(R.id.edit_text);
title = findViewById(R.id.edit_title);
text.setText(noteText);
title.setText(noteTitle);
text.setSelection(noteText != null ? noteText.length() : 0);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(@NonNull View v) {
String note = text.getText().toString();
Title = title.getText().toString();
if (note.length() > 0) {
Calendar c = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("HH:mm dd/MM/yyyy", Locale.ENGLISH);
String formattedDate = df.format(c.getTime());
int id = 0;
if (getIntent().getExtras() != null) {
id = getIntent().getExtras().getInt("id");
}
DatabaseHandler db = new DatabaseHandler(EditActivity.this);
db.updateNote(new Note(id, note, formattedDate, imp, Title));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.putExtra("edit", true);
intent.putExtra("note", true);
if (interstitialAd.isLoaded() && premium != 1) {
interstitialAd.show();
interstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
startActivity(intent);
finish();
}
});
} else {
startActivity(intent);
finish();
}
} else
Snackbar.make(v, "Note is empty!", Snackbar.LENGTH_SHORT).show();
}
});
}
Aggregations