mirror of
https://github.com/Matte23/circolapp.git
synced 2025-12-06 07:29: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 android.os.Bundle
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.content.edit
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import com.github.appintro.AppIntro2
|
import com.github.appintro.AppIntro2
|
||||||
import com.github.appintro.AppIntroFragment
|
import com.github.appintro.AppIntroFragment
|
||||||
import com.github.appintro.AppIntroPageTransformerType
|
import com.github.appintro.AppIntroPageTransformerType
|
||||||
@@ -43,6 +45,11 @@ class IntroActivity : AppIntro2() {
|
|||||||
override fun onDonePressed(currentFragment: Fragment?) {
|
override fun onDonePressed(currentFragment: Fragment?) {
|
||||||
super.onDonePressed(currentFragment)
|
super.onDonePressed(currentFragment)
|
||||||
// Decide what to do when the user clicks on "Done"
|
// Decide what to do when the user clicks on "Done"
|
||||||
|
|
||||||
|
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
sharedPreferences.edit {
|
||||||
|
putBoolean("first_start", false)
|
||||||
|
}
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,13 +75,10 @@ class MainActivity : AppCompatActivity(), CircularLetterAdapter.AdapterCallback
|
|||||||
|
|
||||||
PollWork.enqueue(this)
|
PollWork.enqueue(this)
|
||||||
|
|
||||||
if (getPreferences(Context.MODE_PRIVATE).getBoolean("first_start", true)) {
|
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
startIntroActivity()
|
|
||||||
|
|
||||||
getPreferences(Context.MODE_PRIVATE).edit().apply {
|
if (sharedPreferences.getBoolean("first_start", true)) {
|
||||||
putBoolean("first_start", false)
|
startIntroActivity()
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user