This repository was archived by the owner on Mar 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
java/com/smartpack/kernelprofiler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,5 +52,6 @@ dependencies {
5252 transitive = true
5353 }
5454 implementation " com.github.topjohnwu.libsu:core:2.5.1"
55+ implementation ' com.google.android.gms:play-services-ads:19.1.0'
5556 implementation ' com.google.android.material:material:1.2.0-alpha06'
5657}
Original file line number Diff line number Diff line change 2121 android : requestLegacyExternalStorage =" true"
2222 tools : targetApi =" q" >
2323
24+ <meta-data
25+ android : name =" com.google.android.gms.ads.APPLICATION_ID"
26+ android : value =" ca-app-pub-7791710838910455~2723633709" />
27+
2428 <activity android : name =" com.smartpack.kernelprofiler.MainActivity" >
2529 <intent-filter >
2630 <action android : name =" android.intent.action.MAIN" />
Original file line number Diff line number Diff line change 1919import androidx .cardview .widget .CardView ;
2020import androidx .viewpager .widget .ViewPager ;
2121
22+ import com .google .android .gms .ads .AdRequest ;
23+ import com .google .android .gms .ads .AdView ;
2224import com .smartpack .kernelprofiler .fragments .KPFragment ;
2325import com .smartpack .kernelprofiler .utils .CreateConfigActivity ;
2426import com .smartpack .kernelprofiler .utils .CreateProfileActivity ;
@@ -54,8 +56,9 @@ public class MainActivity extends AppCompatActivity {
5456
5557 @ Override
5658 protected void onCreate (@ Nullable Bundle savedInstanceState ) {
57- // Initialize App Theme
59+ // Initialize App Theme & Google Ads
5860 Utils .initializeAppTheme (this );
61+ Utils .initializeGoogleAds (this );
5962 super .onCreate (savedInstanceState );
6063 setContentView (R .layout .activity_main );
6164
@@ -75,6 +78,13 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
7578 closeForeground ();
7679 });
7780
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+
7888 mSettings = findViewById (R .id .settings_menu );
7989 mViewPager = findViewById (R .id .viewPagerID );
8090 AppCompatTextView textView = findViewById (R .id .unsupported_Text );
Original file line number Diff line number Diff line change 1414
1515import androidx .appcompat .app .AppCompatDelegate ;
1616
17+ import com .google .android .gms .ads .MobileAds ;
1718import com .google .android .material .snackbar .Snackbar ;
1819import com .smartpack .kernelprofiler .BuildConfig ;
1920import com .smartpack .kernelprofiler .utils .root .RootFile ;
@@ -60,6 +61,11 @@ public static void initializeAppTheme(Context context) {
6061 }
6162 }
6263
64+ public static void initializeGoogleAds (Context context ) {
65+ if (!isNotDonated (context )) return ;
66+ MobileAds .initialize (context , "ca-app-pub-7791710838910455~2723633709" );
67+ }
68+
6369 static void startService (Context context , Intent intent ) {
6470 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
6571 context .startForegroundService (intent );
Original file line number Diff line number Diff line change 9595 android : padding =" 12dp"
9696 android : textColor =" ?android:attr/colorAccent"
9797 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>
98109 </FrameLayout >
99110
100111 <include layout =" @layout/rv_foreground_view" />
You can’t perform that action at this time.
0 commit comments