Search in sources :

Example 16 with AdRequest

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);
}
Also used : AdRequest(com.google.android.gms.ads.AdRequest) SharedPreferences(android.content.SharedPreferences) AdView(com.google.android.gms.ads.AdView)

Example 17 with 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);
}
Also used : RadioGroup(android.widget.RadioGroup) MyDateTypeAdapter(it.angelic.mpw.model.MyDateTypeAdapter) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) LinkedMap(org.apache.commons.collections4.map.LinkedMap) AdRequest(com.google.android.gms.ads.AdRequest) MyTimeStampTypeAdapter(it.angelic.mpw.model.MyTimeStampTypeAdapter) FloatingActionButton(android.support.design.widget.FloatingActionButton) DrawerLayout(android.support.v4.widget.DrawerLayout) Job(com.firebase.jobdispatcher.Job) AdView(com.google.android.gms.ads.AdView) PoolDbHelper(it.angelic.mpw.model.db.PoolDbHelper) Toolbar(android.support.v7.widget.Toolbar) FirebaseJobDispatcher(com.firebase.jobdispatcher.FirebaseJobDispatcher) GsonBuilder(com.google.gson.GsonBuilder) GooglePlayDriver(com.firebase.jobdispatcher.GooglePlayDriver) RadioButton(android.widget.RadioButton) NavigationView(android.support.design.widget.NavigationView) LineView(im.dacer.androidcharts.LineView) View(android.view.View) AdView(com.google.android.gms.ads.AdView) TextView(android.widget.TextView) LineView(im.dacer.androidcharts.LineView) GranularityEnum(it.angelic.mpw.model.db.GranularityEnum)

Example 18 with 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);
}
Also used : AdRequest(com.google.android.gms.ads.AdRequest) NavigationView(android.support.design.widget.NavigationView) AdView(com.google.android.gms.ads.AdView) PoolDbHelper(it.angelic.mpw.model.db.PoolDbHelper)

Example 19 with AdRequest

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);
}
Also used : AdRequest(com.google.android.gms.ads.AdRequest) RequestConfiguration(com.google.android.gms.ads.RequestConfiguration) AdSize(com.google.android.gms.ads.AdSize) AdView(com.google.android.gms.ads.AdView)

Example 20 with AdRequest

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);
}
Also used : YourApplication(org.michenux.yourappidea.YourApplication) AdRequest(com.google.android.gms.ads.AdRequest) FacebookDelegate(org.michenux.yourappidea.facebook.FacebookDelegate) GoogleAuthDelegate(org.michenux.drodrolib.gms.auth.GoogleAuthDelegate) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

AdRequest (com.google.android.gms.ads.AdRequest)24 AdView (com.google.android.gms.ads.AdView)11 SharedPreferences (android.content.SharedPreferences)5 View (android.view.View)4 AdListener (com.google.android.gms.ads.AdListener)4 InterstitialAd (com.google.android.gms.ads.InterstitialAd)4 NavigationView (android.support.design.widget.NavigationView)3 AdSize (com.google.android.gms.ads.AdSize)3 FullScreenContentCallback (com.google.android.gms.ads.FullScreenContentCallback)3 LoadAdError (com.google.android.gms.ads.LoadAdError)3 RequestConfiguration (com.google.android.gms.ads.RequestConfiguration)3 PoolDbHelper (it.angelic.mpw.model.db.PoolDbHelper)3 Toolbar (android.support.v7.widget.Toolbar)2 ViewTreeObserver (android.view.ViewTreeObserver)2 Button (android.widget.Button)2 RadioGroup (android.widget.RadioGroup)2 RelativeLayout (android.widget.RelativeLayout)2 TextView (android.widget.TextView)2 NonNull (androidx.annotation.NonNull)2 AdError (com.google.android.gms.ads.AdError)2