Show configuration wizard until it's completed

This commit is contained in:
Matte23
2020-10-29 23:12:28 +01:00
parent 76b4886c6e
commit dcb0d18e8f
2 changed files with 10 additions and 6 deletions

View File

@@ -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()
}
}

View File

@@ -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()
}
}