Помогите разобраться и реализовать метод показ AppIntro только при первом запуске. AppIntro создал по этому ресурсу https://github.com/AppIntro/AppIntro Имею SplashActivity ,MyCustomAppIntro, MainActivity. Показ при первом запуске : сперва всегда со Splash затем MyCustomAppIntro и MainActivity. Если запуск не первый : Splash и MainActivity
class SplashActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//hiding title bar of this activity
window.requestFeature(Window.FEATURE_NO_TITLE)
//making this activity full screen
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
setContentView(R.layout.activity_splash)
//4second splash time
Handler().postDelayed({
//start main activity
startActivity(Intent(this@SplashActivity, MyCustomAppIntro::class.java))
//finish this activity
finish()
},2000)
}
}
Следующий класс
class MyCustomAppIntro : AppIntro() {
companion object {
fun startActivity(context: Context) {
val intent = Intent(context, MyCustomAppIntro::class.java)
context.startActivity(intent)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setTransformer(AppIntroPageTransformerType.Depth)
// You can customize your parallax parameters in the constructors.
setTransformer(AppIntroPageTransformerType.Parallax(
titleParallaxFactor = 1.0,
imageParallaxFactor = -1.0,
descriptionParallaxFactor = 2.0
))
// Make sure you don't call setContentView!
// Call addSlide passing your Fragments.
// You can use AppIntroFragment to use a pre-built fragment
addSlide(
AppIntroFragment.newInstance(
imageDrawable = R.drawable.ayana,
backgroundDrawable = R.color.black,
description = "Привет мой друг"
))
addSlide(
AppIntroFragment.newInstance(
imageDrawable = R.drawable.ayana,
backgroundDrawable = R.color.black,
description = "Меня зовут AYANA"
))
addSlide(
AppIntroFragment.newInstance(
backgroundDrawable = R.drawable.screen_3
))
}
override fun onSkipPressed(currentFragment: Fragment?) {
super.onSkipPressed(currentFragment)
// Decide what to do when the user clicks on "Skip"
val intent = Intent(this,MainActivity::class.java)
startActivity(intent);
finish()
}
override fun onDonePressed(currentFragment: Fragment?) {
super.onDonePressed(currentFragment)
val intent = Intent(this,MainActivity::class.java)
startActivity(intent);
finish()
}
И MainActivity