This repository was archived by the owner on Mar 24, 2023. It is now read-only.
Commit 3b6d9fc 1 parent 17ff9a9 commit 3b6d9fc Copy full SHA for 3b6d9fc
File tree 5 files changed +33
-1
lines changed
java/com/smartpack/kernelprofiler
5 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -52,5 +52,6 @@ dependencies {
52
52
transitive = true
53
53
}
54
54
implementation " com.github.topjohnwu.libsu:core:2.5.1"
55
+ implementation ' com.google.android.gms:play-services-ads:19.1.0'
55
56
implementation ' com.google.android.material:material:1.2.0-alpha06'
56
57
}
Original file line number Diff line number Diff line change 21
21
android : requestLegacyExternalStorage =" true"
22
22
tools : targetApi =" q" >
23
23
24
+ <meta-data
25
+ android : name =" com.google.android.gms.ads.APPLICATION_ID"
26
+ android : value =" ca-app-pub-7791710838910455~2723633709" />
27
+
24
28
<activity android : name =" com.smartpack.kernelprofiler.MainActivity" >
25
29
<intent-filter >
26
30
<action android : name =" android.intent.action.MAIN" />
Original file line number Diff line number Diff line change 19
19
import androidx .cardview .widget .CardView ;
20
20
import androidx .viewpager .widget .ViewPager ;
21
21
22
+ import com .google .android .gms .ads .AdRequest ;
23
+ import com .google .android .gms .ads .AdView ;
22
24
import com .smartpack .kernelprofiler .fragments .KPFragment ;
23
25
import com .smartpack .kernelprofiler .utils .CreateConfigActivity ;
24
26
import com .smartpack .kernelprofiler .utils .CreateProfileActivity ;
@@ -54,8 +56,9 @@ public class MainActivity extends AppCompatActivity {
54
56
55
57
@ Override
56
58
protected void onCreate (@ Nullable Bundle savedInstanceState ) {
57
- // Initialize App Theme
59
+ // Initialize App Theme & Google Ads
58
60
Utils .initializeAppTheme (this );
61
+ Utils .initializeGoogleAds (this );
59
62
super .onCreate (savedInstanceState );
60
63
setContentView (R .layout .activity_main );
61
64
@@ -75,6 +78,13 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
75
78
closeForeground ();
76
79
});
77
80
81
+ if (Utils .isNotDonated (this )) {
82
+ AdView mAdView = findViewById (R .id .adView );
83
+ AdRequest adRequest = new AdRequest .Builder ()
84
+ .build ();
85
+ mAdView .loadAd (adRequest );
86
+ }
87
+
78
88
mSettings = findViewById (R .id .settings_menu );
79
89
mViewPager = findViewById (R .id .viewPagerID );
80
90
AppCompatTextView textView = findViewById (R .id .unsupported_Text );
Original file line number Diff line number Diff line change 14
14
15
15
import androidx .appcompat .app .AppCompatDelegate ;
16
16
17
+ import com .google .android .gms .ads .MobileAds ;
17
18
import com .google .android .material .snackbar .Snackbar ;
18
19
import com .smartpack .kernelprofiler .BuildConfig ;
19
20
import com .smartpack .kernelprofiler .utils .root .RootFile ;
@@ -60,6 +61,11 @@ public static void initializeAppTheme(Context context) {
60
61
}
61
62
}
62
63
64
+ public static void initializeGoogleAds (Context context ) {
65
+ if (!isNotDonated (context )) return ;
66
+ MobileAds .initialize (context , "ca-app-pub-7791710838910455~2723633709" );
67
+ }
68
+
63
69
static void startService (Context context , Intent intent ) {
64
70
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
65
71
context .startForegroundService (intent );
Original file line number Diff line number Diff line change 95
95
android : padding =" 12dp"
96
96
android : textColor =" ?android:attr/colorAccent"
97
97
android : background =" @color/black" />
98
+
99
+ <com .google.android.gms.ads.AdView
100
+ xmlns : ads =" http://schemas.android.com/apk/res-auto"
101
+ android : id =" @+id/adView"
102
+ android : layout_width =" wrap_content"
103
+ android : layout_height =" wrap_content"
104
+ android : layout_gravity =" bottom|center"
105
+ ads : adSize =" BANNER"
106
+ android : background =" @android:color/transparent"
107
+ ads : adUnitId =" ca-app-pub-7791710838910455/5158225354" >
108
+ </com .google.android.gms.ads.AdView>
98
109
</FrameLayout >
99
110
100
111
<include layout =" @layout/rv_foreground_view" />
You can’t perform that action at this time.
0 commit comments