Commit bb1f404e authored by wanglei's avatar wanglei

init

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