Commit bb1f404e authored by wanglei's avatar wanglei

init

parent f5a0f47e
...@@ -5,6 +5,15 @@ import java.util.Locale ...@@ -5,6 +5,15 @@ import java.util.Locale
object ConstObject { object ConstObject {
var isFirstLauncher = true
get() {
return AppPreferences.getInstance().getBoolean("isFirstLauncher", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("isFirstLauncher", value, true)
}
var ifAgreePrivacy = true var ifAgreePrivacy = true
get() { get() {
return AppPreferences.getInstance().getBoolean("ifAgreePrivacy", field) return AppPreferences.getInstance().getBoolean("ifAgreePrivacy", field)
......
package com.base.locationsharewhite.ui.set package com.base.locationsharewhite.ui.set
import android.content.Intent
import android.graphics.Color import android.graphics.Color
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import com.base.locationsharewhite.bean.ConstObject import com.base.locationsharewhite.bean.ConstObject
...@@ -8,6 +9,7 @@ import com.base.locationsharewhite.bean.LanguageBean ...@@ -8,6 +9,7 @@ import com.base.locationsharewhite.bean.LanguageBean
import com.base.locationsharewhite.databinding.ActivityLanguageBinding import com.base.locationsharewhite.databinding.ActivityLanguageBinding
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.helper.MyApplication import com.base.locationsharewhite.helper.MyApplication
import com.base.locationsharewhite.ui.howuse.HowUseActivity
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
import java.util.Locale import java.util.Locale
...@@ -19,11 +21,12 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() { ...@@ -19,11 +21,12 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
override val binding: ActivityLanguageBinding by lazy { override val binding: ActivityLanguageBinding by lazy {
ActivityLanguageBinding.inflate(layoutInflater) ActivityLanguageBinding.inflate(layoutInflater)
} }
var isGuide: Boolean = false
override fun initView() { override fun initView() {
BarUtils.setStatusBarLightMode(this, true) BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.WHITE) BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
isGuide = intent.extras?.getBoolean("isGuide") ?: false
adapter = LanguageAdapter(click = { adapter = LanguageAdapter(click = {
...@@ -63,6 +66,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() { ...@@ -63,6 +66,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
adapter.submitList(languageBeanList) adapter.submitList(languageBeanList)
} }
override fun initListener() { override fun initListener() {
super.initListener() super.initListener()
binding.tvNext.setOnClickListener { binding.tvNext.setOnClickListener {
...@@ -70,6 +74,10 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() { ...@@ -70,6 +74,10 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
selectLanguageBean ?: return@setOnClickListener selectLanguageBean ?: return@setOnClickListener
ConstObject.changeLanguageSp = selectLanguageBean.language + "_" + selectLanguageBean.country ConstObject.changeLanguageSp = selectLanguageBean.language + "_" + selectLanguageBean.country
if (isGuide) {
startActivity(Intent(this, HowUseActivity::class.java))
}
finish() finish()
} }
} }
......
...@@ -6,15 +6,20 @@ import android.graphics.Color ...@@ -6,15 +6,20 @@ import android.graphics.Color
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.base.locationsharewhite.R import com.base.locationsharewhite.R
import com.base.locationsharewhite.bean.ConstObject.ifAgreePrivacy import com.base.locationsharewhite.bean.ConstObject.ifAgreePrivacy
import com.base.locationsharewhite.bean.ConstObject.isFirstLauncher
import com.base.locationsharewhite.databinding.ActivitySplashBinding import com.base.locationsharewhite.databinding.ActivitySplashBinding
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.ui.howuse.HowUseActivity
import com.base.locationsharewhite.ui.howuse.HowUseShareActivity
import com.base.locationsharewhite.ui.main.MainActivity import com.base.locationsharewhite.ui.main.MainActivity
import com.base.locationsharewhite.ui.set.LanguageActivity
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.util.Locale
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
@SuppressLint("CustomSplashScreen") @SuppressLint("CustomSplashScreen")
...@@ -61,11 +66,31 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -61,11 +66,31 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
binding.progressbar.progress = 100 binding.progressbar.progress = 100
binding.root.postDelayed({ binding.root.postDelayed({
startActivity(Intent(this, MainActivity::class.java)) if (isFirstLauncher) {
finish() isFirstLauncher = false
firstLauncherJump()
} else {
startActivity(Intent(this, MainActivity::class.java))
finish()
}
}, 100) }, 100)
} }
private fun firstLauncherJump() {
if (Locale.getDefault().language + "_" + Locale.getDefault().country != Locale.ENGLISH.language + "_" + Locale.ENGLISH.country) {
startActivity(Intent(this, LanguageActivity::class.java).apply {
putExtra("isGuide", true)
})
} else {
startActivity(Intent(this, HowUseActivity::class.java).apply {
putExtra("isGuide", true)
})
}
finish()
}
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
splashPresenter.cancelJumpJob() splashPresenter.cancelJumpJob()
......
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