diff --git a/app/src/main/java/com/finnmglas/launcher/FirstStartupActivity.kt b/app/src/main/java/com/finnmglas/launcher/FirstStartupActivity.kt index d4dfb37..47e3317 100644 --- a/app/src/main/java/com/finnmglas/launcher/FirstStartupActivity.kt +++ b/app/src/main/java/com/finnmglas/launcher/FirstStartupActivity.kt @@ -1,6 +1,5 @@ package com.finnmglas.launcher -import android.annotation.SuppressLint import android.content.Context import android.content.SharedPreferences import android.os.Bundle @@ -30,12 +29,13 @@ fun View.blink( class FirstStartupActivity : AppCompatActivity(){ - var menuNumber = 0 - var defaultApps = mutableListOf() + /** Variables for this activity */ - /* Overrides */ + private var menuNumber = 0 + private var defaultApps = mutableListOf() + + /** Activity Lifecycle functions */ - @SuppressLint("SetTextI18n") // I do not care override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -48,14 +48,14 @@ class FirstStartupActivity : AppCompatActivity(){ setContentView(R.layout.activity_firststartup) - continue_text.blink() // animate + hintText.blink() // animate 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 } - fun clickAnywhere(view: View){ - menuNumber++ - loadMenu(this) - } + /** Touch- and Key-related functions to navigate */ override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP){ @@ -73,68 +73,30 @@ class FirstStartupActivity : AppCompatActivity(){ return true } - @SuppressLint("SetTextI18n") // I don't care! (Yet) - fun loadMenu(context :Context) { // Context needed for packageManager + fun clickAnywhere(view: View){ + menuNumber++ + loadMenu(this) + } - val sharedPref = this.getSharedPreferences( - getString(R.string.preference_file_key), Context.MODE_PRIVATE) + /** Touch- and Key-related functions to navigate */ - // Intro - if (menuNumber == 0){ - heading.text = "" - description.text = "Take a few seconds to learn how to use this Launcher!\n\n" - continue_text.text = "-- Tap anywhere to continue --" + private fun loadMenu(context :Context) { // Context needed for packageManager + + val intro = resources.getStringArray(R.array.intro) + + if (menuNumber < intro.size){ + val entry = intro[menuNumber].split("|").toTypedArray() //heading|infoText|hintText|size + + heading.text = entry[0] + if (entry[4] == "1")infoText.text = String.format(entry[1], + defaultApps[0], defaultApps[1], defaultApps[2], defaultApps[3], defaultApps[4], defaultApps[5]) + 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) - defaultApps = resetSettings(sharedPref, context) // UP, DOWN, RIGHT, LEFT, VOLUME_UP, VOLUME_DOWN - } - // Concept - else if (menuNumber == 1){ - heading.text = "Concept" - description.text = "It is designed to be minimal, efficient and free of distraction." - } - else if (menuNumber == 2){ - heading.text = "Concept" - description.text = "It is free of payments, ads and tracking services." - continue_text.text = "-- Tap anywhere to continue --" - } - // Usage - else if (menuNumber == 3){ - heading.text = "Usage" - description.text = "Your home screen contains the local date and time. No distraction." - continue_text.text = "-- Use volume keys to navigate --" - } - else if (menuNumber == 4){ - heading.text = "Usage" - description.text = "You can open your apps with a single swipe or button press." - } - // Setup - else if (menuNumber == 5){ - heading.text = "Setup" - description.setTextSize(TypedValue.COMPLEX_UNIT_SP,36F) - description.text = "We have set up some default actions for you..." - } - else if (menuNumber == 6){ - description.setTextSize(TypedValue.COMPLEX_UNIT_SP,18F) - description.text = "Swipe Up: Open a Browser (" + defaultApps[0] + ")\n\n" + - "Swipe Down: Open internal Search App (" + defaultApps[1] + ")\n\n" + - "Swipe Right: Open Mail (" + defaultApps[2] + ")\n\n" + - "Swipe Left: Open Calendar (" + defaultApps[3] + ")\n\n" + - "Volume Up: Open a messenger (" + defaultApps[4] + ")\n\n" + - "Volume Down: Open Utilities (" + defaultApps[5] + ")" - } - else if (menuNumber == 7){ - heading.text = "Setup" - description.setTextSize(TypedValue.COMPLEX_UNIT_SP,36F) - description.text = "You can choose your own apps:\n\nOpen settings by tapping and holding the home screen." - continue_text.text = "-- Use volume keys to navigate --" - } - else if (menuNumber == 8){ - heading.text = "" - description.text = "You are ready to get started!\n\n I hope this provides great value to you!\n\n- Finn M Glas\n\n" - continue_text.text = "-- Launcher by Finn M Glas --" - } - // End Intro - else { val editor: SharedPreferences.Editor = sharedPref.edit() editor.putBoolean("startedBefore", true) // never run this again editor.putLong("firstStartup", System.currentTimeMillis() / 1000L) // record first startup timestamp @@ -142,6 +104,5 @@ class FirstStartupActivity : AppCompatActivity(){ finish() } - } } diff --git a/app/src/main/res/layout/activity_firststartup.xml b/app/src/main/res/layout/activity_firststartup.xml index c933b6a..4581de9 100644 --- a/app/src/main/res/layout/activity_firststartup.xml +++ b/app/src/main/res/layout/activity_firststartup.xml @@ -24,7 +24,7 @@ app:layout_constraintVertical_bias="0.100000024" /> + app:layout_constraintTop_toBottomOf="@id/infoText" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e86d6e7..c3b742b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,6 +3,13 @@ Launcher V3RYR4ND0MK3YCR4P + + None found + + Can\'t open app + Want to change its settings (\'add it to the apps screen\')? + Open settings to choose an app for this action + Settings Applications @@ -34,12 +41,22 @@ Removed the selected application Unable to remove application - - None found - - Can\'t open app - Want to change its settings (\'add it to the apps screen\')? - Open settings to choose an app for this action + + + + |Take a few seconds to learn how to use this Launcher!\n\n|— Tap anywhere to continue —|36F|0 + Concept|It is designed to be minimal, efficient and free of distraction.|— Tap anywhere to continue —|36F|0 + Concept|It is free of payments, ads and tracking services.|— Tap anywhere to continue —|36F|0 + Usage|Your home screen contains the local date and time. No distraction.|— Tap anywhere to continue —|36F|0 + Usage|You can open your apps with a single swipe or button press.|— Tap anywhere to continue —|36F|0 + Setup|We have set up some default actions for you…|— Use volume keys to navigate —|36F|0 + Setup|Swipe Up: Open a Browser (%1$s)\n\nSwipe Down: Open internal Search App (%2$s)\n\n + Swipe Right: Open Mail (%3$s)\n\nSwipe Left: Open Calendar (%4$s)\n\n + Volume Up: Open a messenger (%5$s)\n\nVolume Down: Open Utilities (%6$s)|— Use volume keys to navigate —|18F|1 + + Setup|You can choose your own apps:\n\nOpen settings by tapping and holding the home screen.|— Use volume keys to navigate —|36F|0 + |You are ready to get started!\n\n I hope this provides great value to you!\n\n- Finn M Glas\n\n|— Launcher by Finn M Glas —|36F|0 +