use of com.google.android.gms.ads.AdRequest in project MPW by shineangelic.
the class ChoosePoolActivity method onStart.
@Override
protected void onStart() {
super.onStart();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ChoosePoolActivity.this);
restoreLastSettings(prefs);
// ADS
AdView mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
use of com.google.android.gms.ads.AdRequest in project MPW by shineangelic.
the class MainActivity method onCreate.
/* private static long getAverageBlockSecondsSincePoolsBirth(HomeStats lastHit) {
final Date firstBlockDate = new Date();//2017/07/15
firstBlockDate.setTime(1500099900000L);
long datediffFirst = (new Date().getTime() - firstBlockDate.getTime()) / 1000;
//meno uno perche` il conto parte dal secondo blocco. Il primo boh
return datediffFirst / (lastHit.getMaturedTotal() - 1);
}*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Locale current = getResources().getConfiguration().locale;
mDbHelper = new PoolDbHelper(this, mPool, mCur);
builder = new GsonBuilder();
// gestione UNIX time lungo e non
builder.registerTypeAdapter(Date.class, new MyDateTypeAdapter());
builder.registerTypeAdapter(Calendar.class, new MyTimeStampTypeAdapter());
noobText = findViewById(R.id.textViewWalletTitle);
hashText = findViewById(R.id.hashrateText);
textViewNetDiffTitle = findViewById(R.id.textViewWalHashrateTitle);
poolLastBeat = findViewById(R.id.textViewWalLastShareValue);
textViewNetDiffValue = findViewById(R.id.textViewNetDiffValue);
lastFoundTextLabel = findViewById(R.id.textViewLastBlock);
lastFoundText = findViewById(R.id.textViewWalPaymentsValue);
onlineMinersText = findViewById(R.id.textViewWalCurHashrateValue);
textViewBlockChainHeightValue = findViewById(R.id.textViewBlockChainHeightValue);
poolHashrateText = findViewById(R.id.textViewPoolHashrateValue);
roundSharesText = findViewById(R.id.textViewRoundSharesValue);
textViewVarianceValue = findViewById(R.id.textViewVarianceValue);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Async Refresh Sent", Snackbar.LENGTH_SHORT).setAction("Action", null).show();
issueRefresh(mDbHelper, builder);
}
});
// i grafici hanno controlli globali
RadioGroup radioGroupChartGranularity = findViewById(R.id.radioDifficultyGranularity);
radioGroupBackTo = findViewById(R.id.radioBackto);
final RadioButton radioDay = findViewById(R.id.radioButtonDay);
final RadioButton radioMin = findViewById(R.id.radioButtonMinutes);
final RadioGroup.OnCheckedChangeListener mescola = new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
radioGroupBackTo.post(new Runnable() {
@Override
public void run() {
GranularityEnum granoEnum = GranularityEnum.HOUR;
if (radioDay.isChecked())
granoEnum = GranularityEnum.DAY;
else if (radioMin.isChecked())
granoEnum = GranularityEnum.MINUTE;
int radioButtonID = radioGroupBackTo.getCheckedRadioButtonId();
View radioButton = findViewById(radioButtonID);
LinkedMap<Date, HomeStats> storia = mDbHelper.getHistoryData(BackToEnum.valueOf((String) radioButton.getTag()));
ChartUtils.drawDifficultyHistory(textViewNetDiffTitle, PoolQueryGrouper.groupAvgQueryResult(storia, granoEnum), (LineView) findViewById(R.id.line_view_difficulty), granoEnum);
ChartUtils.drawHashrateHistory(hashText, PoolQueryGrouper.groupAvgQueryResult(storia, granoEnum), (LineView) findViewById(R.id.line_view_hashrate), granoEnum);
}
});
}
};
radioGroupBackTo.setOnCheckedChangeListener(mescola);
radioGroupChartGranularity.setOnCheckedChangeListener(mescola);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
Job myJob = MPWCoinmarketcapService.getJobUpdate(dispatcher);
dispatcher.schedule(myJob);
// ADS
AdView mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
use of com.google.android.gms.ads.AdRequest in project MPW by shineangelic.
the class PaymentsActivity method onStart.
@Override
protected void onStart() {
super.onStart();
// ADS
AdView mAdView = findViewById(R.id.adViewPayments);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
NavigationView navigationView = findViewById(R.id.navigation_view);
navigationView.setNavigationItemSelectedListener(this);
navigationView.setCheckedItem(R.id.nav_payment);
final PoolDbHelper mDbHelper = new PoolDbHelper(this, mPool, mCur);
issueRefresh(mDbHelper, builder, Utils.getWalletStatsUrl(PreferenceManager.getDefaultSharedPreferences(this)) + minerAddr);
}
use of com.google.android.gms.ads.AdRequest in project mopub-android-mediation by mopub.
the class GooglePlayServicesBanner method load.
@Override
protected void load(@NonNull final Context context, @NonNull final AdData adData) {
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(adData);
adWidth = adData.getAdWidth();
adHeight = adData.getAdHeight();
final Map<String, String> extras = adData.getExtras();
mAdUnitId = extras.get(AD_UNIT_ID_KEY);
mGoogleAdView = new AdView(context);
mGoogleAdView.setAdListener(new AdViewListener());
mGoogleAdView.setAdUnitId(mAdUnitId);
final AdSize adSize = (adWidth == null || adHeight == null || adWidth <= 0 || adHeight <= 0) ? null : new AdSize(adWidth, adHeight);
if (adSize != null) {
mGoogleAdView.setAdSize(adSize);
} else {
MoPubLog.log(getAdNetworkId(), LOAD_FAILED, ADAPTER_NAME, NETWORK_NO_FILL.getIntCode(), NETWORK_NO_FILL);
if (mLoadListener != null) {
mLoadListener.onAdLoadFailed(NETWORK_NO_FILL);
}
return;
}
final AdRequest.Builder builder = new AdRequest.Builder();
builder.setRequestAgent("MoPub");
// Publishers may append a content URL by passing it to the MoPubView.setLocalExtras() call.
final String contentUrl = extras.get(CONTENT_URL_KEY);
if (!TextUtils.isEmpty(contentUrl)) {
builder.setContentUrl(contentUrl);
}
forwardNpaIfSet(builder);
final RequestConfiguration.Builder requestConfigurationBuilder = new RequestConfiguration.Builder();
// Publishers may request for test ads by passing test device IDs to the MoPubView.setLocalExtras() call.
final String testDeviceId = extras.get(TEST_DEVICES_KEY);
if (!TextUtils.isEmpty(testDeviceId)) {
requestConfigurationBuilder.setTestDeviceIds(Collections.singletonList(testDeviceId));
}
// Publishers may want to indicate that their content is child-directed and forward this
// information to Google.
final String childDirected = extras.get(TAG_FOR_CHILD_DIRECTED_KEY);
if (childDirected != null) {
if (Boolean.parseBoolean(childDirected)) {
requestConfigurationBuilder.setTagForChildDirectedTreatment(TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE);
} else {
requestConfigurationBuilder.setTagForChildDirectedTreatment(TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE);
}
} else {
requestConfigurationBuilder.setTagForChildDirectedTreatment(TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED);
}
// Publishers may want to mark their requests to receive treatment for users in the
// European Economic Area (EEA) under the age of consent.
final String underAgeOfConsent = extras.get(TAG_FOR_UNDER_AGE_OF_CONSENT_KEY);
if (underAgeOfConsent != null) {
if (Boolean.parseBoolean(underAgeOfConsent)) {
requestConfigurationBuilder.setTagForUnderAgeOfConsent(TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE);
} else {
requestConfigurationBuilder.setTagForUnderAgeOfConsent(TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE);
}
} else {
requestConfigurationBuilder.setTagForUnderAgeOfConsent(TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED);
}
final RequestConfiguration requestConfiguration = requestConfigurationBuilder.build();
MobileAds.setRequestConfiguration(requestConfiguration);
final AdRequest adRequest = builder.build();
mGoogleAdView.loadAd(adRequest);
MoPubLog.log(getAdNetworkId(), LOAD_ATTEMPTED, ADAPTER_NAME);
}
use of com.google.android.gms.ads.AdRequest in project YourAppIdea by Michenux.
the class YourAppMainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((YourApplication) getApplication()).inject(this);
setContentView(R.layout.main);
// toolbar
Toolbar toolBar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolBar);
// For debug
if (BuildConfig.DEBUG) {
Log.d(YourApplication.LOG_TAG, "HashKey: " + SecurityUtils.logHashKey(this));
}
// app usage
AppUsageUtils.updateLastUsedTimestamp(this);
// init fragment
if (savedInstanceState == null) {
this.navController.goHomeFragment(this);
this.navController.showWhatsNew(this);
}
// ads
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("1174B15820BDCDE357023377AAF1D72D").addTestDevice("FB73634EFAFEF29BE7973A97B5543A4D").addTestDevice(// LG Nexus 5
"3C4438D5DE2E7086B63C92FC5846F662").build();
mAdView.loadAd(adRequest);
// social networks
mFacebookDelegate = new FacebookDelegate(mUserHelper, this);
mFacebookDelegate.setUserSessionCallback(this);
mGoogleAuthDelegate = new GoogleAuthDelegate(this, mUserHelper);
mGoogleAuthDelegate.setUserSessionCallback(this);
}
Aggregations