Skip to content

Commit

Permalink
Fix issues and update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Jun 19, 2024
1 parent 9c3672d commit d6ebce5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
compileSdk 34
defaultConfig {
applicationId "com.tananaev.logcat"
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 34
versionCode 16
versionName "2.2"
Expand Down
8 changes: 7 additions & 1 deletion app/src/google/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application>

Expand All @@ -12,6 +13,11 @@
</intent-filter>
</activity>

<property
android:name="android.adservices.AD_SERVICES_CONFIG"
android:resource="@xml/gma_ad_services_config"
tools:replace="android:resource" />

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-9061647223840223~6856100115"/>
Expand Down
10 changes: 9 additions & 1 deletion app/src/google/java/com/tananaev/logcat/GoogleActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.tananaev.logcat

import android.os.Bundle
import android.preference.PreferenceManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.AdView
import com.google.android.gms.ads.MobileAds
Expand All @@ -18,7 +19,14 @@ class GoogleActivity : MainActivity() {
MobileAds.initialize(this) {}
setContentView(R.layout.activity_google)
super.onCreate(savedInstanceState)
findViewById<AdView>(R.id.ad_view).loadAd(AdRequest.Builder().build())
adapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
if (adapter.itemCount > 0) {
findViewById<AdView>(R.id.ad_view).loadAd(AdRequest.Builder().build())
adapter.unregisterAdapterDataObserver(this)
}
}
})
}

override fun onResume() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/tananaev/logcat/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import java.security.spec.X509EncodedKeySpec
abstract class MainActivity : AppCompatActivity() {

private lateinit var recyclerView: RecyclerView
private lateinit var adapter: LineAdapter
protected lateinit var adapter: LineAdapter
private lateinit var keyPair: KeyPair
private var readerTask: ReaderTask? = null
private var statusItem: MenuItem? = null
Expand Down

0 comments on commit d6ebce5

Please sign in to comment.