Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
fixed ads and updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosh committed Feb 26, 2017
1 parent d1f2de0 commit 87f7a36
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- Lock & Unlock conversations on Issues and Pull Requests.
- Comment on Issues, Pull Requests, Commits and Gists
- Edit and Delete Comments.
- Create Gists.
- Create/Delete Gists.
- View Gists and their files.
- Follow and Unfollow users.
- Search Users, Repos, Issues,Pull Requests and Code.
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId "com.fastaccess.github"
minSdkVersion 21
targetSdkVersion 25
versionCode 102
versionName "1.0.2"
versionCode 103
versionName "1.0.3"
signingConfig signingConfigs.signing
buildConfigField "String", "GITHUB_CLIENT_ID", "\"${GITHUB_CLIENT_ID}\""
buildConfigField "String", "GITHUB_SECRET", "\"${GITHUB_SECRET}\""
Expand Down
1 change: 1 addition & 0 deletions app/src/debuggingApp/res/values/secrets.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string> <!-- testing key ;) -->
<string name="test_device_id">YOUR-DEVICE-ID-FROM-LOGCAT</string>
</resources>
25 changes: 23 additions & 2 deletions app/src/main/java/com/fastaccess/ui/base/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.fastaccess.ui.widgets.dialog.ProgressDialogFragment;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
import com.tapadoo.alerter.Alerter;

import net.grandcentrix.thirtyinch.TiActivity;
Expand Down Expand Up @@ -79,14 +80,31 @@ public abstract class BaseActivity<V extends BaseMvp.FAView, P extends BasePrese
}
if (adView != null) {
boolean isAdsEnabled = PrefGetter.isAdsEnabled();
adView.setVisibility(isAdsEnabled ? View.VISIBLE : View.GONE);
if (isAdsEnabled) {
AdRequest adRequest = new AdRequest.Builder().build();
adView.setVisibility(View.VISIBLE);
MobileAds.initialize(this, getString(R.string.banner_ad_unit_id));
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(getString(R.string.test_device_id))
.build();
adView.loadAd(adRequest);
}
}
}

@Override protected void onResume() {
super.onResume();
if (adView != null && adView.isShown()) {
adView.resume();
}
}

@Override protected void onPause() {
if (adView != null && adView.isShown()) {
adView.pause();
}
super.onPause();
}

@Override public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
Expand All @@ -101,6 +119,9 @@ public abstract class BaseActivity<V extends BaseMvp.FAView, P extends BasePrese
}

@Override protected void onDestroy() {
if (adView != null && adView.isShown()) {
adView.destroy();
}
super.onDestroy();
}

Expand Down

0 comments on commit 87f7a36

Please sign in to comment.