Commit 1042e555 authored by maxiaoliang's avatar maxiaoliang

修改问题

parent c249d5ac
......@@ -127,20 +127,7 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
val s = SPUtils.getInstance().getInt("outcomeReturnCount", 0)
if (s == 0) {
val s = SPUtils.getInstance().getInt("isShowBackIntAd", 0)
if (s == 1) {
MaxAdUtils.showInterstitialAd(this@ResultActivity) {
finishToMain()
}
} else {
finishToMain()
}
}else{
BackRelsutAt.launch(this@ResultActivity, from)
finish()
}
finishToMain()
}
})
......
......@@ -4,7 +4,6 @@ import android.content.Intent
import android.graphics.Color
import android.graphics.Typeface
import android.os.Build
import android.util.Log
import androidx.activity.OnBackPressedCallback
import androidx.annotation.RequiresApi
import androidx.fragment.app.Fragment
......@@ -47,7 +46,8 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
@RequiresApi(Build.VERSION_CODES.O)
override fun initView() {
ConfigHelper.enter_homePage++
ConfigHelper.isfirstInstall++
ConfigHelper.enterHomeTimes++
BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
// binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
......@@ -86,14 +86,24 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
PopExitWindow.show(this@NewMainActivity)
}
})
Log.e("MXL", "initView: " + ConfigHelper.enter_homePage)
if (ConfigHelper.enter_homePage == 2) {
//第二次进入首页
val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
if (s == 1) {
startActivity(Intent(this, BackRelsutAt::class.java))
if(ConfigHelper.isfirstInstall==1){
if (ConfigHelper.enterHomeTimes.toInt() == 2|| ConfigHelper.enterHomeTimes.toInt() == 3) {
//第二次进入首页
val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
if (s == 1) {
startActivity(Intent(this, BackRelsutAt::class.java))
}
}
}else{
if (ConfigHelper.enterHomeTimes.toInt() == 1|| ConfigHelper.enterHomeTimes.toInt() == 2) {
//第二次进入首页
val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
if (s == 1) {
startActivity(Intent(this, BackRelsutAt::class.java))
}
}
}
}
private fun setPage(p: Int) {
......@@ -132,14 +142,18 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
RateStarPop.show(this@NewMainActivity)
}
if (isPause) {
val localCount = SPUtils.getInstance().getInt("localCount", 0)
SPUtils.getInstance().put("localCount", localCount + 1)
val n = SPUtils.getInstance().getInt("outcomeReturnHomeCount", 0)
if (n > 0) {
if (localCount % n == 0) {
startActivity(Intent(this, BackRelsutAt::class.java))
val s = SPUtils.getInstance().getInt("outcomeReturnCount", 0)
if (s == 1) {
val localCount = SPUtils.getInstance().getInt("localCount", 0)
SPUtils.getInstance().put("localCount", localCount + 1)
val n = SPUtils.getInstance().getInt("outcomeReturnHomeCount", 0)
if (n > 0) {
if (localCount % n == 0) {
startActivity(Intent(this, BackRelsutAt::class.java))
}
}
}
}
}
}
......@@ -3,6 +3,7 @@ package com.test.easy.easycleanerjunk.helps
import com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import com.test.easy.easycleanerjunk.utils.SPUtils
import java.util.Calendar
object ConfigHelper {
......@@ -89,13 +90,30 @@ object ConfigHelper {
SPUtils.getInstance().put("fcmNotification", value, true)
}
//进入主页的次数
var enter_homePage = 0
var enterHomeTimes = 0L
get() {
return SPUtils.getInstance().getInt("enter_homePage", field)
val last = Calendar.getInstance().apply {
timeInMillis = SPUtils.getInstance().getLong("enterHomeTimes", field)
}
return Calendar.getInstance().run {
if (get(Calendar.DAY_OF_YEAR) == last[Calendar.DAY_OF_YEAR]) {
last
} else {
set(Calendar.MILLISECOND, 0)
this
}
}.timeInMillis
}
set(value) {
field = value
SPUtils.getInstance().put("enter_homePage", value)
SPUtils.getInstance().put("enterHomeTimes", value)
}
var isfirstInstall = 0
get() {
return SPUtils.getInstance().getInt("isfirstInstall", field)
}
set(value) {
field = value
SPUtils.getInstance().put("isfirstInstall", value)
}
}
\ 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