Commit dc0b08ce authored by wanglei's avatar wanglei

...

parent f43b9a38
...@@ -5,9 +5,17 @@ import android.content.Intent ...@@ -5,9 +5,17 @@ import android.content.Intent
import com.base.appzxhy.ui.main.MainActivity import com.base.appzxhy.ui.main.MainActivity
import com.didi.drouter.annotation.Service import com.didi.drouter.annotation.Service
import com.koko.drouter.app.AppService import com.koko.drouter.app.AppService
import java.util.Locale
@Service(function = [AppService::class]) @Service(function = [AppService::class])
class AppServiceImp : AppService { class AppServiceImp : AppService {
override fun getCurrentSpLocal(): Locale {
return Locale.getDefault()
}
override fun changeActivityLanguage(activity: Activity, currentLocale: Locale, changeAction: () -> Unit): Boolean {
return false
}
override fun finishToMainTop(activity: Activity) { override fun finishToMainTop(activity: Activity) {
val intent = Intent(activity, MainActivity::class.java) val intent = Intent(activity, MainActivity::class.java)
......
...@@ -12,10 +12,9 @@ class InterAdServiceImp : InterAdService { ...@@ -12,10 +12,9 @@ class InterAdServiceImp : InterAdService {
override fun showInterAd(activity: Activity, interWhere: String, callBack: () -> Unit) { override fun showInterAd(activity: Activity, interWhere: String, callBack: () -> Unit) {
val isUnLimit = false
if (AdConfigBean.adsConfigBean.functionInShowAd) { if (AdConfigBean.adsConfigBean.functionInShowAd) {
AdsMgr.showInsert(activity, isUnLimit, object : AdsShowCallBack() { AdsMgr.showInsert(activity, object : AdsShowCallBack() {
override fun close(where: Int) { override fun close(where: Int) {
callBack.invoke() callBack.invoke()
} }
...@@ -24,9 +23,11 @@ class InterAdServiceImp : InterAdService { ...@@ -24,9 +23,11 @@ class InterAdServiceImp : InterAdService {
callBack.invoke() callBack.invoke()
} }
override fun googleFailed(where: Int) { override fun adFailed(where: Int) {
callBack.invoke() callBack.invoke()
} }
}) })
} else { } else {
callBack.invoke() callBack.invoke()
...@@ -35,10 +36,9 @@ class InterAdServiceImp : InterAdService { ...@@ -35,10 +36,9 @@ class InterAdServiceImp : InterAdService {
} }
override fun showInterAdBack(activity: Activity, interWhere: String, callBack: () -> Unit) { override fun showInterAdBack(activity: Activity, interWhere: String, callBack: () -> Unit) {
val isUnLimit = false
if (AdConfigBean.adsConfigBean.functionBackShowAd) { if (AdConfigBean.adsConfigBean.functionBackShowAd) {
AdsMgr.showInsert(activity, isUnLimit, object : AdsShowCallBack() { AdsMgr.showInsert(activity, object : AdsShowCallBack() {
override fun close(where: Int) { override fun close(where: Int) {
callBack.invoke() callBack.invoke()
} }
...@@ -47,7 +47,7 @@ class InterAdServiceImp : InterAdService { ...@@ -47,7 +47,7 @@ class InterAdServiceImp : InterAdService {
callBack.invoke() callBack.invoke()
} }
override fun googleFailed(where: Int) { override fun adFailed(where: Int) {
callBack.invoke() callBack.invoke()
} }
}) })
......
...@@ -16,11 +16,12 @@ class NativeAdServiceImp : NativeAdService { ...@@ -16,11 +16,12 @@ class NativeAdServiceImp : NativeAdService {
override fun showNative(activity: Activity, flAd: FrameLayout, nativeType: String) { override fun showNative(activity: Activity, flAd: FrameLayout, nativeType: String) {
LogEx.logDebug(TAG, "activity=${activity::class.java.simpleName}") LogEx.logDebug(TAG, "activity=${activity::class.java.simpleName}")
val layout = when (nativeType) { val admobLayout = when (nativeType) {
NativeBatteryType -> R.layout.layout_admob_native_custom NativeBatteryType -> R.layout.layout_admob_native_custom
else -> R.layout.layout_admob_native_custom else -> R.layout.layout_admob_native_custom
} }
AdsMgr.showNative(activity, flAd, layout) val maxLayout = R.layout.layout_max_native_custom
AdsMgr.showNative(activity, flAd, admobLayout, maxLayout)
} }
......
...@@ -7,25 +7,22 @@ import androidx.activity.SystemBarStyle ...@@ -7,25 +7,22 @@ import androidx.activity.SystemBarStyle
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.ViewModelProvider
import com.base.appzxhy.R
import com.base.appzxhy.ads.AdsMgr
import com.base.appzxhy.databinding.ActivityStartBinding import com.base.appzxhy.databinding.ActivityStartBinding
import com.koko.batteryinfo.BatteryInfoActivity import com.koko.batteryinfo.BatteryInfoActivity
import com.koko.drouter.base.BaseActivity import com.koko.drouter.base.BaseActivity
class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::inflate) { class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::inflate) {
override fun initView() {
super.initView()
}
override fun useDefaultImmersive() { private val viewModel by lazy(LazyThreadSafetyMode.NONE) {
// enableEdgeToEdge(SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT)) ViewModelProvider(this)[StartViewModel::class.java]
enableEdgeToEdge(SystemBarStyle.dark(Color.TRANSPARENT))
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, 0, systemBars.right, systemBars.bottom)
insets
} }
override fun initView() {
super.initView()
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
...@@ -46,4 +43,28 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i ...@@ -46,4 +43,28 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i
startActivity(Intent(this, BatteryInfoActivity::class.java)) startActivity(Intent(this, BatteryInfoActivity::class.java))
} }
} }
override fun onResumeOneShoot() {
super.onResumeOneShoot()
viewModel.startJumpCountdown()
}
override fun onStop() {
super.onStop()
viewModel.cancelJumpCountDown()
}
override fun useDefaultImmersive() {
// enableEdgeToEdge(SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT))
enableEdgeToEdge(SystemBarStyle.dark(Color.TRANSPARENT))
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, 0, systemBars.right, systemBars.bottom)
insets
}
}
} }
\ No newline at end of file
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