Commit 1220ff27 authored by wanglei's avatar wanglei

...

parent e053855e
...@@ -79,18 +79,18 @@ public class MainActivity extends AppCompatActivity { ...@@ -79,18 +79,18 @@ public class MainActivity extends AppCompatActivity {
}); });
}); });
binding.ivSetting.setOnClickListener(v -> { binding.ivSetting.setOnClickListener(v -> {
AdmobHelper.INSTANCE.showInterstitialAd(this, () -> { // AdmobHelper.INSTANCE.showInterstitialAd(this, () -> {
initSetting(); // initSetting();
return null; // return null;
}, // },
() -> { // () -> {
return null; // return null;
}, // },
() -> { // () -> {
initSetting(); // initSetting();
return null; // return null;
}); // });
initSetting();
}); });
binding.cl3CleanJunk.setOnClickListener(v -> { binding.cl3CleanJunk.setOnClickListener(v -> {
......
...@@ -35,6 +35,7 @@ public class CustomScoreDialog extends Dialog { ...@@ -35,6 +35,7 @@ public class CustomScoreDialog extends Dialog {
NativeView nativeView = findViewById(R.id.fl_ad); NativeView nativeView = findViewById(R.id.fl_ad);
AdmobHelper.INSTANCE.showNativeAd(activity, (nativeAd) -> { AdmobHelper.INSTANCE.showNativeAd(activity, (nativeAd) -> {
nativeView.removeAllViews();
nativeView.setNativeAd(nativeAd, R.layout.layout_ad_native); nativeView.setNativeAd(nativeAd, R.layout.layout_ad_native);
return null; return null;
}, null, null); }, null, null);
......
...@@ -547,33 +547,34 @@ object AdmobHelper { ...@@ -547,33 +547,34 @@ object AdmobHelper {
maxCompleted: ((nativeAdLoader: MaxNativeAdLoader, nativeMaxAd: MaxAd) -> Unit)? = null, maxCompleted: ((nativeAdLoader: MaxNativeAdLoader, nativeMaxAd: MaxAd) -> Unit)? = null,
failed: (() -> Unit?)? = null failed: (() -> Unit?)? = null
) { ) {
if (!isShowAdNative() || isBlacklist()) { // if (!isShowAdNative() || isBlacklist()) {
failed?.invoke() // failed?.invoke()
return // return
} // }
Log.d(TAG, "native Ad load.") Log.e(TAG, "showNativeAd")
if (useAdmob) { if (useAdmob) {
var nativeAd: NativeAd? = null var nativeAd: NativeAd? = null
val adLoader = AdLoader.Builder(activity, NATIVE_AD_UNIT_ID) val adLoader = AdLoader.Builder(activity, NATIVE_AD_UNIT_ID)
.forNativeAd { ad: NativeAd -> .forNativeAd { ad: NativeAd ->
completed?.invoke(ad) Log.e(TAG, "forNativeAd")
ReportAdUtils.showAd(ad.responseInfo, NATIVE_AD_UNIT, activity) ReportAdUtils.showAd(ad.responseInfo, NATIVE_AD_UNIT, activity)
ad.setOnPaidEventListener(ReportAdUtils.EventOnPaidEventListener(ad)) ad.setOnPaidEventListener(ReportAdUtils.EventOnPaidEventListener(ad))
nativeAd = ad nativeAd = ad
completed?.invoke(ad)
} }
.withAdListener(object : AdListener() { .withAdListener(object : AdListener() {
override fun onAdClicked() { override fun onAdClicked() {
Log.d(TAG, "native Ad clicked.") Log.e(TAG, "native Ad clicked.")
ReportAdUtils.clickAd(nativeAd?.responseInfo, NATIVE_AD_UNIT) ReportAdUtils.clickAd(nativeAd?.responseInfo, NATIVE_AD_UNIT)
} }
override fun onAdFailedToLoad(loadAdError: LoadAdError) { override fun onAdFailedToLoad(loadAdError: LoadAdError) {
Log.d(TAG, "native Ad failed to load. ${loadAdError.message}") Log.e(TAG, "native Ad failed to load. ${loadAdError.message}")
failed?.invoke() failed?.invoke()
} }
override fun onAdLoaded() { override fun onAdLoaded() {
Log.d(TAG, "native Ad loaded.") Log.e(TAG, "native Ad loaded.")
} }
}) })
.withNativeAdOptions(NativeAdOptions.Builder().build()) .withNativeAdOptions(NativeAdOptions.Builder().build())
......
...@@ -20,7 +20,6 @@ import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_APP_MANAGER ...@@ -20,7 +20,6 @@ import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_APP_MANAGER
import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_BATTERY import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_BATTERY
import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_CLEAN import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_CLEAN
import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_LARGE_FILE import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_LARGE_FILE
import com.swiftcleaner.chovey.view.MainActivity
import com.swiftcleaner.chovey.view.activity.StartActivity import com.swiftcleaner.chovey.view.activity.StartActivity
class PermanentNotifyService : Service() { class PermanentNotifyService : Service() {
...@@ -31,9 +30,9 @@ class PermanentNotifyService : Service() { ...@@ -31,9 +30,9 @@ class PermanentNotifyService : Service() {
var isRunning = false var isRunning = false
fun Context.startOmgNotification() { fun Context.startOmgNotification() {
val intent = Intent(this, PermanentNotifyService::class.java) val intent = Intent(this, PermanentNotifyService::class.java)
// if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) {
// return return
// } }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(intent) startForegroundService(intent)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment