mirror of
https://github.com/Matte23/circolapp.git
synced 2025-12-05 23:19:10 +00:00
Show configuration wizard until it's completed
This commit is contained in:
@@ -2,7 +2,9 @@ package net.underdesk.circolapp
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.edit
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.github.appintro.AppIntro2
|
||||
import com.github.appintro.AppIntroFragment
|
||||
import com.github.appintro.AppIntroPageTransformerType
|
||||
@@ -43,6 +45,11 @@ class IntroActivity : AppIntro2() {
|
||||
override fun onDonePressed(currentFragment: Fragment?) {
|
||||
super.onDonePressed(currentFragment)
|
||||
// Decide what to do when the user clicks on "Done"
|
||||
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
sharedPreferences.edit {
|
||||
putBoolean("first_start", false)
|
||||
}
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,13 +75,10 @@ class MainActivity : AppCompatActivity(), CircularLetterAdapter.AdapterCallback
|
||||
|
||||
PollWork.enqueue(this)
|
||||
|
||||
if (getPreferences(Context.MODE_PRIVATE).getBoolean("first_start", true)) {
|
||||
startIntroActivity()
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
|
||||
getPreferences(Context.MODE_PRIVATE).edit().apply {
|
||||
putBoolean("first_start", false)
|
||||
apply()
|
||||
}
|
||||
if (sharedPreferences.getBoolean("first_start", true)) {
|
||||
startIntroActivity()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user