mirror of
https://github.com/jrpie/Launcher.git
synced 2025-04-19 10:20:51 +02:00
Add option to view Tutorial again
Another button in the 'Launcher' Tab of settings. I made sure this does not reset any user preferences. It just plays the tutorial and returns to settings.
This commit is contained in:
parent
817fe0d732
commit
215827ae1b
4 changed files with 32 additions and 9 deletions
|
@ -17,6 +17,7 @@ class FirstStartupActivity : AppCompatActivity(){
|
|||
|
||||
private var menuNumber = 0
|
||||
private var defaultApps = mutableListOf<String>()
|
||||
private var isFirstTime = false
|
||||
|
||||
/** Activity Lifecycle functions */
|
||||
|
||||
|
@ -36,7 +37,11 @@ class FirstStartupActivity : AppCompatActivity(){
|
|||
loadMenu(this)
|
||||
|
||||
val sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE)
|
||||
defaultApps = resetSettings(sharedPref, this) // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN
|
||||
|
||||
isFirstTime = !sharedPref.getBoolean("startedBefore", false)
|
||||
|
||||
if (isFirstTime)
|
||||
defaultApps = resetSettings(sharedPref, this) // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN
|
||||
}
|
||||
|
||||
/** Touch- and Key-related functions to navigate */
|
||||
|
@ -72,19 +77,23 @@ class FirstStartupActivity : AppCompatActivity(){
|
|||
val entry = intro[menuNumber].split("|").toTypedArray() //heading|infoText|hintText|size
|
||||
|
||||
heading.text = entry[0]
|
||||
if (entry[4] == "1")infoText.text = String.format(entry[1],
|
||||
if (entry[4] == "1" && isFirstTime)infoText.text = String.format(entry[1],
|
||||
defaultApps[0], defaultApps[1], defaultApps[2], defaultApps[3], defaultApps[4], defaultApps[5])
|
||||
else if (entry[4] == "1" && !isFirstTime)infoText.text = String.format(entry[1],
|
||||
"-", "-", "-", "-", "-", "-")
|
||||
else infoText.text = entry[1]
|
||||
hintText.text = entry[2]
|
||||
infoText.setTextSize(TypedValue.COMPLEX_UNIT_SP, entry[3].toFloat())
|
||||
|
||||
} else { // End intro
|
||||
val sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE)
|
||||
if (isFirstTime){
|
||||
val sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE)
|
||||
|
||||
val editor: SharedPreferences.Editor = sharedPref.edit()
|
||||
editor.putBoolean("startedBefore", true) // never run this again
|
||||
editor.putLong("firstStartup", System.currentTimeMillis() / 1000L) // record first startup timestamp
|
||||
editor.apply()
|
||||
val editor: SharedPreferences.Editor = sharedPref.edit()
|
||||
editor.putBoolean("startedBefore", true) // never auto run this again
|
||||
editor.putLong("firstStartup", System.currentTimeMillis() / 1000L) // record first startup timestamp
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
finish()
|
||||
}
|
||||
|
|
|
@ -83,8 +83,9 @@ class SettingsActivity : AppCompatActivity() {
|
|||
fun openFinnWebsite(view: View) { openNewTabWindow(getString(R.string.settings_footer_web), this) }
|
||||
fun openGithubRepo(view: View) { openNewTabWindow(getString(R.string.settings_footer_repo), this) }
|
||||
|
||||
// Just copied code from https://stackoverflow.com/q/10816757/12787264
|
||||
// that is how we write good software ^
|
||||
// Rate App
|
||||
// Just copied code from https://stackoverflow.com/q/10816757/12787264
|
||||
// that is how we write good software ^
|
||||
fun rateApp(view: View) {
|
||||
try {
|
||||
val rateIntent = rateIntentForUrl("market://details")
|
||||
|
@ -138,6 +139,10 @@ class SettingsActivity : AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
fun viewTutorial (view: View){
|
||||
startActivity(Intent(this, FirstStartupActivity::class.java))
|
||||
}
|
||||
|
||||
// Show a dialog prompting for confirmation
|
||||
fun resetSettingsClick(view: View) {
|
||||
AlertDialog.Builder(this)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue