Skip to content

Commit

Permalink
Improve First Time Tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
KreitinnSoftware committed Feb 6, 2025
1 parent cfee463 commit 20f14ee
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions app/src/main/java/com/micewine/emu/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -825,11 +825,11 @@ class MainActivity : AppCompatActivity() {
}

private fun showHighlightSequence() {
currentState = HighlightState.fromOrdinal(preferences!!.getInt(HighlightState.HIGHLIGHT_PREFERENCE_KEY, 0))
if (currentState == HighlightState.HIGHLIGHT_DONE)
currentState = HighlightState.HIGHLIGHT_SHORTCUTS
if (currentState == HighlightState.HIGHLIGHT_DONE) {
return
TapTargetSequence(this)
.targets(
}
TapTargetSequence(this).targets(
TapTarget.forView(
findViewById(R.id.nav_shortcuts),
getString(R.string.highlight_nav_shortcuts)
Expand All @@ -845,41 +845,36 @@ class MainActivity : AppCompatActivity() {
getString(R.string.highlight_nav_files),
getString(R.string.highlight_nav_files_description)
)
)
.listener(object : TapTargetSequence.Listener {
).listener(object : TapTargetSequence.Listener {
override fun onSequenceFinish() {

}

override fun onSequenceStep(lastTarget: TapTarget, targetClicked: Boolean) {
if (targetClicked) {
when (currentState) {
HighlightState.HIGHLIGHT_SHORTCUTS -> {
selectedFragment = "ShortcutsFragment"
fragmentLoader(shortcutsFragment, false)

val editor = preferences!!.edit()
bottomNavigation?.selectedItemId = R.id.nav_shortcuts
currentState = HighlightState.HIGHLIGHT_SETTINGS
editor.putInt(HighlightState.HIGHLIGHT_PREFERENCE_KEY, currentState!!.ordinal)
editor.apply()
preferences!!.edit().apply {
putInt(HighlightState.HIGHLIGHT_PREFERENCE_KEY, currentState!!.ordinal)
apply()
}
}
HighlightState.HIGHLIGHT_SETTINGS -> {
selectedFragment = "SettingsFragment"
fragmentLoader(settingsFragment, false)

val editor = preferences!!.edit()
bottomNavigation?.selectedItemId = R.id.nav_settings
currentState = HighlightState.HIGHLIGHT_FILES
editor.putInt(HighlightState.HIGHLIGHT_PREFERENCE_KEY, currentState!!.ordinal)
editor.apply()
preferences!!.edit().apply {
putInt(HighlightState.HIGHLIGHT_PREFERENCE_KEY, currentState!!.ordinal)
apply()
}
}
HighlightState.HIGHLIGHT_FILES -> {
selectedFragment = "FileManagerFragment"
fragmentLoader(fileManagerFragment, false)

val editor = preferences!!.edit()
bottomNavigation?.selectedItemId = R.id.nav_file_manager
currentState = HighlightState.HIGHLIGHT_DONE
editor.putInt(HighlightState.HIGHLIGHT_PREFERENCE_KEY, currentState!!.ordinal)
editor.apply()
preferences!!.edit().apply {
putInt(HighlightState.HIGHLIGHT_PREFERENCE_KEY, currentState!!.ordinal)
apply()
}
}
else -> {
return
Expand Down

0 comments on commit 20f14ee

Please sign in to comment.