diff --git a/README.md b/README.md
index 681cddd..2589fec 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,28 @@
# OpenC25k
+
Open source couch to 5k run tracker app
Inspired by [this project.](https://github.com/roelb/Simple-C25K)
+
+## Features
+
+- C25k run list of which the user selects one individual run to track on each running session
+
+- Tap on a run to track it
+
+- Hold on a run to check/uncheck the completed checkbox
+
+- The run is broken into intervals, e.g. Walk 90 seconds, run 60 seconds which are tracked
+
+- Beeps and vibrates:
+ - Once for walk
+ - Twice for jog
+ - 4 times for completed run
+
+- Sound and vibration enable and disable settings
+
+- Tracks which runs have been completed and displayed on checkboxes
+
+- Progress and settings store persistently between app runs. Can be reset by deleting app storage in android settings.
+
+- Material you colors which change depending on which theme the user has set for their device
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 0000000..98a6e3d
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,54 @@
+plugins {
+ id("com.android.application")
+ id("org.jetbrains.kotlin.android")
+ id("kotlin-parcelize")
+}
+
+android {
+ namespace = "se.wmuth.openc25k"
+ compileSdk = 34
+
+ defaultConfig {
+ applicationId = "se.wmuth.openc25k"
+ minSdk = 31
+ targetSdk = 33
+ versionCode = 1
+ versionName = "1.0"
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildFeatures {
+ viewBinding = true
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+}
+
+dependencies {
+ implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
+ implementation("androidx.core:core-ktx:1.10.1")
+ implementation("androidx.appcompat:appcompat:1.6.1")
+ implementation("com.google.android.material:material:1.9.0")
+ implementation("androidx.constraintlayout:constraintlayout:2.1.4")
+ implementation("androidx.datastore:datastore-preferences:1.0.0")
+ implementation("androidx.cardview:cardview:1.0.0")
+ testImplementation("junit:junit:4.13.2")
+ androidTestImplementation("androidx.test.ext:junit:1.1.5")
+ androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
+}
\ No newline at end of file
diff --git a/app/debug/output-metadata.json b/app/debug/output-metadata.json
new file mode 100644
index 0000000..7b20ef8
--- /dev/null
+++ b/app/debug/output-metadata.json
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "artifactType": {
+ "type": "APK",
+ "kind": "Directory"
+ },
+ "applicationId": "se.wmuth.openc25k",
+ "variantName": "debug",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "attributes": [],
+ "versionCode": 1,
+ "versionName": "1.0",
+ "outputFile": "app-debug.apk"
+ }
+ ],
+ "elementType": "File"
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
new file mode 100644
index 0000000..1405dda
--- /dev/null
+++ b/app/release/output-metadata.json
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "artifactType": {
+ "type": "APK",
+ "kind": "Directory"
+ },
+ "applicationId": "se.wmuth.openc25k",
+ "variantName": "release",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "attributes": [],
+ "versionCode": 1,
+ "versionName": "1.0",
+ "outputFile": "app-release.apk"
+ }
+ ],
+ "elementType": "File"
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..985d745
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_green-playstore.png b/app/src/main/ic_green-playstore.png
new file mode 100644
index 0000000..518b769
Binary files /dev/null and b/app/src/main/ic_green-playstore.png differ
diff --git a/app/src/main/java/se/wmuth/openc25k/MainActivity.kt b/app/src/main/java/se/wmuth/openc25k/MainActivity.kt
new file mode 100644
index 0000000..41404cd
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/MainActivity.kt
@@ -0,0 +1,132 @@
+package se.wmuth.openc25k
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import androidx.activity.result.ActivityResultLauncher
+import androidx.activity.result.contract.ActivityResultContracts
+import androidx.appcompat.app.AppCompatActivity
+import androidx.datastore.core.DataStore
+import androidx.datastore.preferences.core.Preferences
+import androidx.datastore.preferences.preferencesDataStore
+import androidx.recyclerview.widget.LinearLayoutManager
+import se.wmuth.openc25k.both.Beeper
+import se.wmuth.openc25k.data.Run
+import se.wmuth.openc25k.databinding.ActivityMainBinding
+import se.wmuth.openc25k.main.DataHandler
+import se.wmuth.openc25k.main.RunAdapter
+import se.wmuth.openc25k.main.SettingsMenu
+import se.wmuth.openc25k.main.VolumeDialog
+
+// Get the datastore for the app
+val Context.datastore: DataStore by preferencesDataStore(name = "settings")
+
+/**
+ * The main activity, ties together everything on the apps 'home' page
+ */
+class MainActivity : AppCompatActivity(), RunAdapter.RunAdapterClickListener,
+ SettingsMenu.SettingsMenuListener, VolumeDialog.VolumeDialogListener {
+ private lateinit var menu: SettingsMenu
+ private lateinit var runs: Array
+ private lateinit var volDialog: VolumeDialog
+ private lateinit var handler: DataHandler
+ private lateinit var adapter: RunAdapter
+ private lateinit var launcher: ActivityResultLauncher
+ private var sound: Boolean = true
+ private var vibrate: Boolean = true
+ private var volume: Float = 0.5f
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ handler = DataHandler(this, datastore)
+ sound = handler.getSound()
+ vibrate = handler.getVibrate()
+ volume = handler.getVolume()
+ runs = handler.getRuns()
+
+ super.onCreate(savedInstanceState)
+ val binding = ActivityMainBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ volDialog = VolumeDialog(this, this, layoutInflater)
+ menu = SettingsMenu(this, binding.materialToolbar.menu)
+
+ val runRV = binding.recyclerView
+ adapter = RunAdapter(this, runs, this)
+ runRV.adapter = adapter
+ runRV.layoutManager = LinearLayoutManager(this)
+
+ binding.materialToolbar.setOnMenuItemClickListener(menu)
+ binding.materialToolbar.menu.findItem(R.id.vibrate).isChecked = vibrate
+ binding.materialToolbar.menu.findItem(R.id.sound).isChecked = sound
+
+ launcher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
+ handleActivityResult(it.resultCode, it.data)
+ }
+ }
+
+ override fun onRunItemClick(position: Int) {
+ // Run was clicked, launch TrackActivity with extras
+ val intent = Intent(this, TrackActivity::class.java)
+ intent.putExtra("run", runs[position])
+ intent.putExtra("id", position)
+ intent.putExtra("sound", sound)
+ intent.putExtra("vibrate", vibrate)
+ intent.putExtra("volume", volume)
+ launcher.launch(intent)
+ }
+
+ override fun onRunItemLongClick(position: Int) {
+ // Run held, toggle isComplete
+ runs[position].isComplete = !runs[position].isComplete
+ adapter.notifyItemChanged(position)
+ handler.setRuns(runs)
+ }
+
+ /**
+ * Handle the result of the TrackActivity
+ *
+ * @param resultCode if RESULT_OK, run was finished
+ * @param data the data sent back from the activity, which run was completed
+ */
+ private fun handleActivityResult(resultCode: Int, data: Intent?) {
+ if (resultCode == RESULT_OK && data != null) {
+ runs[data.getIntExtra("id", 0)].isComplete = true
+ adapter.notifyItemChanged(data.getIntExtra("id", 0))
+ handler.setRuns(runs)
+ }
+ }
+
+ override fun createVolumeDialog() {
+ volDialog.createAlertDialog(volume)
+ }
+
+ override fun shouldMakeSound(): Boolean {
+ return sound
+ }
+
+ override fun shouldVibrate(): Boolean {
+ return vibrate
+ }
+
+ override fun testVolume() {
+ val beeper = Beeper(applicationContext, volume)
+ if (sound) {
+ beeper.beep()
+ }
+ }
+
+ override fun toggleSound() {
+ sound = !sound
+ handler.setSound(sound)
+ }
+
+ override fun toggleVibration() {
+ vibrate = !vibrate
+ handler.setVibrate(vibrate)
+ }
+
+ override fun setVolume(nV: Float) {
+ volume = nV
+ handler.setVolume(volume)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/TrackActivity.kt b/app/src/main/java/se/wmuth/openc25k/TrackActivity.kt
new file mode 100644
index 0000000..46d99da
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/TrackActivity.kt
@@ -0,0 +1,118 @@
+package se.wmuth.openc25k
+
+import android.content.Intent
+import android.os.Build
+import android.os.Bundle
+import android.os.VibratorManager
+import androidx.appcompat.app.AppCompatActivity
+import se.wmuth.openc25k.both.Beeper
+import se.wmuth.openc25k.data.Interval
+import se.wmuth.openc25k.data.Run
+import se.wmuth.openc25k.databinding.ActivityTrackBinding
+import se.wmuth.openc25k.track.RunTimer
+import se.wmuth.openc25k.track.Shaker
+
+/**
+ * Combines all the tracking parts of the app to one cohesive whole
+ * Should be sent intent with keys
+ * "id" -> index of the run in the recyclerview: Int
+ * "run" -> run object to track: Run
+ * "sound" -> if sound is enabled: Boolean
+ * "vibrate" -> if vibration is enabled: Boolean
+ * "volume" -> what the volume is: Float
+ */
+class TrackActivity : AppCompatActivity(), RunTimer.RunTimerListener {
+ private lateinit var beeper: Beeper
+ private lateinit var binding: ActivityTrackBinding
+ private lateinit var intentReturn: Intent
+ private lateinit var intervals: Iterator
+ private lateinit var shaker: Shaker
+ private lateinit var timer: RunTimer
+ private var sound: Boolean = true
+ private var vibrate: Boolean = true
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ binding = ActivityTrackBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ val run = if (Build.VERSION.SDK_INT >= 33) {
+ intent.getParcelableExtra("run", Run::class.java) ?: return
+ } else {
+ // Above is more typesafe but only works on newer SDK
+ @Suppress("DEPRECATION")
+ (intent.getParcelableExtra("run") ?: return)
+ }
+
+ intervals = run.intervals.iterator()
+ sound = intent.getBooleanExtra("sound", true)
+ vibrate = intent.getBooleanExtra("vibrate", true)
+
+ beeper = Beeper(this, intent.getFloatExtra("volume", 0.5f))
+ shaker = Shaker(getSystemService(VIBRATOR_MANAGER_SERVICE) as VibratorManager)
+ timer = RunTimer(run.intervals, this)
+
+ binding.twRemainTimer.text = timer.getTotalRemaining()
+ binding.twStatus.text = intervals.next().title
+ binding.twSummary.text = run.description
+ binding.twTimer.text = timer.getIntervalRemaining()
+ binding.twTitle.text = run.name
+
+ binding.btnPause.setOnClickListener { timer.pause() }
+ binding.btnSkip.setOnClickListener { timer.skip() }
+ binding.btnStart.setOnClickListener { timer.start() }
+
+ intentReturn = Intent()
+ intentReturn.putExtra("id", intent.getIntExtra("id", 0))
+ setResult(RESULT_CANCELED, intentReturn)
+ }
+
+ override fun tick() {
+ runOnUiThread {
+ binding.twRemainTimer.text = timer.getTotalRemaining()
+ binding.twTimer.text = timer.getIntervalRemaining()
+ }
+ }
+
+ override fun nextInterval() {
+ val next = intervals.next()
+ runOnUiThread {
+ binding.twStatus.text = next.title
+ binding.twTimer.text = next.time.toString()
+ }
+
+ if (next.title == getString(R.string.walk)) {
+ if (sound) {
+ beeper.beep()
+ }
+ if (vibrate) {
+ shaker.walkShake()
+ }
+ } else {
+ if (sound) {
+ beeper.beepMultiple(2u)
+ }
+ if (vibrate) {
+ shaker.jogShake()
+ }
+ }
+ }
+
+ override fun finishRun() {
+ runOnUiThread {
+ binding.twStatus.text = getString(R.string.runComplete)
+ }
+ setResult(RESULT_OK, intentReturn)
+ if (sound) {
+ beeper.beepMultiple(4u)
+ }
+ if (vibrate) {
+ shaker.completeShake()
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ timer.pause()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/both/Beeper.kt b/app/src/main/java/se/wmuth/openc25k/both/Beeper.kt
new file mode 100644
index 0000000..0932e49
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/both/Beeper.kt
@@ -0,0 +1,62 @@
+package se.wmuth.openc25k.both
+
+import android.content.Context
+import android.content.res.AssetFileDescriptor
+import android.media.AudioAttributes
+import android.media.AudioAttributes.CONTENT_TYPE_SONIFICATION
+import android.media.AudioAttributes.USAGE_ALARM
+import android.media.MediaPlayer
+import se.wmuth.openc25k.R
+
+/**
+ * Used to create the beeping noise in the application
+ * Uses MediaPlayer to play the raw mp3-file in the project
+ *
+ * @param pCon the context of the parent of the beeper
+ * @param vol the initial volume of the beeper, 0.0 to 1.0
+ * @constructor Creates beeper with standard attributes
+ */
+class Beeper(pCon: Context, vol: Float) : MediaPlayer.OnCompletionListener {
+ private val mp: MediaPlayer
+ private var playCount: UInt = 0u
+
+ init {
+ val file: AssetFileDescriptor = pCon.resources.openRawResourceFd(R.raw.beep)
+ mp = MediaPlayer().apply {
+ setAudioAttributes(
+ AudioAttributes
+ .Builder()
+ .setContentType(CONTENT_TYPE_SONIFICATION)
+ .setUsage(USAGE_ALARM)
+ .build()
+ )
+ setVolume(vol, vol)
+ setDataSource(file.fileDescriptor, file.startOffset, file.length)
+ }
+ mp.prepare()
+ mp.setOnCompletionListener(this)
+ file.close()
+ }
+
+ /**
+ * Makes the Beeper beep
+ */
+ fun beep() {
+ mp.start()
+ }
+
+ /**
+ * Makes the Beeper beep a [number] of times
+ */
+ fun beepMultiple(number: UInt) {
+ playCount = number - 1u
+ beep()
+ }
+
+ override fun onCompletion(p0: MediaPlayer?) {
+ if (playCount > 0u) {
+ playCount--
+ beep()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/data/Interval.kt b/app/src/main/java/se/wmuth/openc25k/data/Interval.kt
new file mode 100644
index 0000000..613224f
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/data/Interval.kt
@@ -0,0 +1,14 @@
+package se.wmuth.openc25k.data
+
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
+/**
+ * Stores the data for one interval e.g. title: "Walk", time: 300 (seconds)
+ *
+ * @param time the integer seconds the interval lasts for
+ * @param title the title of what the user should do during, walk, run, warmup, etc
+ * @constructor creates a single interval containing a title and time
+ */
+@Parcelize
+data class Interval(val time: Int, val title: String) : Parcelable
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/data/Run.kt b/app/src/main/java/se/wmuth/openc25k/data/Run.kt
new file mode 100644
index 0000000..63c4896
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/data/Run.kt
@@ -0,0 +1,44 @@
+package se.wmuth.openc25k.data
+
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
+/**
+ * Keeps the data for an entire running session
+ *
+ * @param name the name of the run e.g. Week 1 Day 1
+ * @param description the description of the run, any extra info the user needs
+ * @param isComplete whether the user has completed this run
+ * @param intervals an array of intervals which the run consists of
+ * @constructor creates a running session containing all needed info
+ */
+@Parcelize
+data class Run(
+ val name: String,
+ val description: String,
+ var isComplete: Boolean,
+ val intervals: Array
+) : Parcelable {
+ // Autogenerated comparison functions
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (javaClass != other?.javaClass) return false
+
+ other as Run
+
+ if (name != other.name) return false
+ if (description != other.description) return false
+ if (isComplete != other.isComplete) return false
+ if (!intervals.contentEquals(other.intervals)) return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = name.hashCode()
+ result = 31 * result + description.hashCode()
+ result = 31 * result + isComplete.hashCode()
+ result = 31 * result + intervals.contentHashCode()
+ return result
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/main/DataHandler.kt b/app/src/main/java/se/wmuth/openc25k/main/DataHandler.kt
new file mode 100644
index 0000000..77b6c07
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/main/DataHandler.kt
@@ -0,0 +1,651 @@
+package se.wmuth.openc25k.main
+
+import android.content.Context
+import androidx.datastore.core.DataStore
+import androidx.datastore.preferences.core.booleanPreferencesKey
+import androidx.datastore.preferences.core.edit
+import androidx.datastore.preferences.core.floatPreferencesKey
+import androidx.datastore.preferences.core.Preferences
+import androidx.datastore.preferences.core.stringPreferencesKey
+import kotlinx.coroutines.runBlocking
+import se.wmuth.openc25k.R
+import se.wmuth.openc25k.data.Interval
+import se.wmuth.openc25k.data.Run
+
+/**
+ * Allows for easy editing of persistent data on the android device for the app
+ *
+ * Each data key we want to save has it's own getting and setting function
+ * since this more easily allows me to be more typesafe, however there is
+ * a decent amount of repeated code which could be excluded using e.g.
+ * a enum class for which data you want and one getter function
+ *
+ * @param pCon the parent context
+ * @param datastore the datastore to edit
+ * @constructor Creates DataHandler of context which edits the datastore
+ */
+class DataHandler(pCon: Context, datastore: DataStore) {
+ private val con: Context = pCon
+ private val ds: DataStore = datastore
+
+ /**
+ * Gets the vibration enabled setting
+ * @return the saved setting for vibration, default true
+ */
+ fun getVibrate(): Boolean {
+ val v = booleanPreferencesKey("vibrate")
+ var d: Boolean? = null
+ runBlocking {
+ ds.edit { settings ->
+ d = settings[v]
+ }
+ }
+ return d ?: true
+ }
+
+ /**
+ * Gets the sound enabled setting
+ * @return the saved setting for sound, default true
+ */
+ fun getSound(): Boolean {
+ val s = booleanPreferencesKey("sound")
+ var d: Boolean? = null
+ runBlocking {
+ ds.edit { settings ->
+ d = settings[s]
+ }
+ }
+ return d ?: true
+ }
+
+ /**
+ * Gets the volume setting
+ * @return the saved float value between 0 and 1.0, default 0.5
+ */
+ fun getVolume(): Float {
+ val vol = floatPreferencesKey("volume")
+ var d: Float? = null
+ runBlocking {
+ ds.edit { settings ->
+ d = settings[vol]
+ }
+ }
+ return d ?: 0.5f
+ }
+
+ /**
+ * Gets the saved runs array
+ * @return the saved runs with isComplete progress or default
+ */
+ fun getRuns(): Array {
+ val r = stringPreferencesKey("runs")
+ var d: String? = null
+ runBlocking {
+ ds.edit { settings ->
+ d = settings[r]
+ }
+ }
+ return deserialize(d) ?: defaultRuns()
+ }
+
+ /**
+ * Persistently stores the vibration setting
+ * @param vibrate whether vibration should be enabled or not
+ */
+ fun setVibrate(vibrate: Boolean) {
+ val v = booleanPreferencesKey("vibrate")
+ runBlocking {
+ ds.edit { settings ->
+ settings[v] = vibrate
+ }
+ }
+ }
+
+ /**
+ * Persistently stores the sound setting
+ * @param sound whether sound should be enabled or not
+ */
+ fun setSound(sound: Boolean) {
+ val s = booleanPreferencesKey("sound")
+ runBlocking {
+ ds.edit { settings ->
+ settings[s] = sound
+ }
+ }
+ }
+
+ /**
+ * Persistently stores the volume setting
+ * @param volume how loud the sound should be, 0.0 to 1.0
+ */
+ fun setVolume(volume: Float) {
+ val vol = floatPreferencesKey("volume")
+ runBlocking {
+ ds.edit { settings ->
+ settings[vol] = volume
+ }
+ }
+ }
+
+ /**
+ * Persistently stores the runs array
+ * @param runs the array of runs with new isComplete progress
+ */
+ fun setRuns(runs: Array) {
+ val r = stringPreferencesKey("runs")
+ runBlocking {
+ ds.edit { settings ->
+ settings[r] = serialize(runs)
+ }
+ }
+ }
+
+ /**
+ * Extremely basic serialization function, could be improved
+ * @param r Array of runs to serialize
+ * @return the serialized string
+ */
+ private fun serialize(r: Array): String {
+ var s = ""
+
+ // For each run, destruct the run and add values with separator
+ r.forEach { (name, description, isComplete, intervals) ->
+ s += "$name|"
+ s += "$description|"
+ s += "$isComplete|"
+ // Since intervals differs in length, for each append these too
+ intervals.forEach { (time, title) ->
+ s += "$time|"
+ s += "$title|"
+ }
+ // Make sure each run ends with || for deserialization
+ s += "|"
+ }
+
+ // Drop ending || so .split() doesn't result in empty index at the end
+ s = s.dropLast(2)
+
+ return s
+ }
+
+
+ /**
+ * Extremely basic deserialization function, could be improved
+ * @param d the data to deserialize
+ * @return the deserialized array or null if invalid data
+ */
+ private fun deserialize(d: String?): Array? {
+ if (d == null) {
+ return null
+ }
+
+ // Create empty list and split string on || which separates each run
+ val runs: MutableList = mutableListOf()
+ val split = d.split("||")
+ // For each run from the split
+ split.forEach { severalRuns ->
+ // Create an iterator which yields each field in the run
+ val run = severalRuns.split("|").iterator()
+ // First yields name
+ val name = run.next()
+ // Then description
+ val desc = run.next()
+ val isComplete = run.next().toBoolean()
+ val intervals: MutableList = mutableListOf()
+ // Since intervals is a list we do a for each on the remaining items in the iterator
+ run.forEach {
+ intervals.add(Interval(it.toInt(), run.next()))
+ }
+ // Add all the values extracted
+ runs.add(Run(name, desc, isComplete, intervals.toTypedArray()))
+ }
+ return runs.toTypedArray()
+ }
+
+ /**
+ * Returns the default runs, hardcoded since it follows a real world regimen.
+ * This whole structure could be massively improved, I have just done
+ * the most basic implementation for this simple app.
+ * Should be fast enough for the purposes
+ * @return the default state of the runs array
+ */
+ private fun defaultRuns(): Array {
+ val r = con.resources
+ return arrayOf(
+ Run(
+ name = String.format(
+ "%s 1 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w1d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 1 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w1d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 1 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w1d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(60, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 2 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w2d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(60, r.getString(R.string.walk)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 2 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w2d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(60, r.getString(R.string.walk)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 2 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w2d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(120, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(60, r.getString(R.string.walk)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 3 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w3d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 3 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w3d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 3 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w3d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(90, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 4 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w4d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ Interval(150, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 4 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w4d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ Interval(150, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 4 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w4d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ Interval(150, r.getString(R.string.walk)),
+ Interval(180, r.getString(R.string.jog)),
+ Interval(90, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 5 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w5d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(300, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 5 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w5d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(480, r.getString(R.string.jog)),
+ Interval(300, r.getString(R.string.walk)),
+ Interval(480, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 5 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w5d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1200, r.getString(R.string.jog)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 6 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w6d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(300, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(480, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(300, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 6 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w6d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(600, r.getString(R.string.jog)),
+ Interval(180, r.getString(R.string.walk)),
+ Interval(600, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 6 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w6d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1320, r.getString(R.string.jog)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 7 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w7d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1500, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 7 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w7d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1500, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 7 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w7d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1500, r.getString(R.string.jog)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 8 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w8d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1680, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 8 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w8d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1680, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 8 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w8d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1680, r.getString(R.string.jog)),
+ )
+ ),
+
+ Run(
+ name = String.format(
+ "%s 9 %s 1", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w9d1),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1800, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 9 %s 2", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w9d2),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1800, r.getString(R.string.jog)),
+ )
+ ),
+ Run(
+ name = String.format(
+ "%s 9 %s 3", r.getString(R.string.week), r.getString(R.string.day)
+ ),
+ description = r.getString(R.string.w9d3),
+ isComplete = false,
+ intervals = arrayOf(
+ Interval(300, r.getString(R.string.warmup)),
+ Interval(1800, r.getString(R.string.jog)),
+ )
+ ),
+ )
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/main/RunAdapter.kt b/app/src/main/java/se/wmuth/openc25k/main/RunAdapter.kt
new file mode 100644
index 0000000..4b2d9c7
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/main/RunAdapter.kt
@@ -0,0 +1,108 @@
+@file:Suppress("CyclicClassDependency")
+
+package se.wmuth.openc25k.main
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.recyclerview.widget.RecyclerView
+import se.wmuth.openc25k.R
+import se.wmuth.openc25k.data.Run
+
+/**
+ * Used to adapt an array of runs for display in a RecyclerView
+ *
+ * @param parentContext the context for the adapter
+ * @param runsArr the array of runs to display
+ * @param toListen a listener which listens to click events on the adapter and it's items
+ * @constructor returns the adapter based on the input variables
+ */
+class RunAdapter(parentContext: Context, runsArr: Array, toListen: RunAdapterClickListener) :
+ RecyclerView.Adapter() {
+ private val context: Context = parentContext
+ private val listener: RunAdapterClickListener = toListen
+ private val runs: Array = runsArr
+
+ interface RunAdapterClickListener {
+ /**
+ * Whenever a run in the adapter is clicked
+ * this is called with the position in the adapter
+ * a.k.a. index in array of the clicked item
+ */
+ fun onRunItemClick(position: Int)
+
+ /**
+ * Whenever a run in the adapter is long clicked (held)
+ * this is called with the position in the adapter
+ * a.k.a. index in array of the clicked item
+ */
+ fun onRunItemLongClick(position: Int)
+ }
+
+ /**
+ * A class which holds each view for the adapter and detects clicks
+ * @param itemView the view to hold
+ * @constructor creates the standard implementation with onclick listeners for the itemView
+ */
+ inner class RunViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
+ View.OnClickListener, View.OnLongClickListener {
+ val iw: ImageView
+ val tw: TextView
+
+ init {
+ itemView.setOnClickListener(this)
+ itemView.setOnLongClickListener(this)
+ iw = itemView.findViewById(R.id.imageView)
+ tw = itemView.findViewById(R.id.textView)
+ }
+
+ override fun onClick(p0: View?) {
+ val position = adapterPosition
+ if (position != RecyclerView.NO_POSITION) {
+ listener.onRunItemClick(position)
+ }
+ }
+
+ override fun onLongClick(v: View?): Boolean {
+ val position = adapterPosition
+ if (position != RecyclerView.NO_POSITION) {
+ listener.onRunItemLongClick(position)
+ return true
+ }
+ return false
+ }
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RunViewHolder {
+ return RunViewHolder(LayoutInflater.from(context).inflate(R.layout.run_row, parent, false))
+ }
+
+ override fun getItemCount(): Int {
+ return runs.size
+ }
+
+ override fun onBindViewHolder(holder: RunViewHolder, position: Int) {
+ val curRun = runs[position]
+ holder.apply {
+ tw.text = curRun.name
+
+ val img = if (curRun.isComplete) {
+ AppCompatResources.getDrawable(
+ context,
+ com.google.android.material.R.drawable.btn_checkbox_checked_mtrl
+ )
+ } else {
+ AppCompatResources.getDrawable(
+ context,
+ com.google.android.material.R.drawable.btn_checkbox_unchecked_mtrl
+ )
+ }
+
+ iw.setImageDrawable(img)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/main/SettingsMenu.kt b/app/src/main/java/se/wmuth/openc25k/main/SettingsMenu.kt
new file mode 100644
index 0000000..232024d
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/main/SettingsMenu.kt
@@ -0,0 +1,75 @@
+package se.wmuth.openc25k.main
+
+import android.view.Menu
+import android.view.MenuItem
+import androidx.appcompat.widget.Toolbar
+import se.wmuth.openc25k.R
+
+/**
+ * Handles click events on the toolbar and calls the according
+ * functions in the [SettingsMenuListener] interface
+ *
+ * @param p the parent, or listener for this class
+ * @param s: the self, or menu that this class handles
+ * @constructor Creates default object with passed values
+ */
+class SettingsMenu(p: SettingsMenuListener, s: Menu) : Toolbar.OnMenuItemClickListener {
+ private val parent: SettingsMenuListener = p
+ private val self: Menu = s
+
+ interface SettingsMenuListener {
+ /**
+ * Creates the volume setting dialog
+ */
+ fun createVolumeDialog()
+
+ /**
+ * Returns the current sound setting
+ * @return true if enabled, false if disabled
+ */
+ fun shouldMakeSound(): Boolean
+
+ /**
+ * Returns the current vibration setting
+ * @return true if enabled, false if disabled
+ */
+ fun shouldVibrate(): Boolean
+
+ /**
+ * Plays a beep to allow the user to test their volume setting
+ */
+ fun testVolume()
+
+ /**
+ * Toggles the sound setting, true if was false and vice versa
+ */
+ fun toggleSound()
+
+ /**
+ * Toggles the vibration setting, true if was false and vice versa
+ */
+ fun toggleVibration()
+ }
+
+ override fun onMenuItemClick(p0: MenuItem?): Boolean {
+ if (p0 == null) {
+ return false
+ }
+ when (p0.itemId) {
+ R.id.vibrate -> {
+ parent.toggleVibration()
+ self.findItem(R.id.vibrate).isChecked = parent.shouldVibrate()
+ }
+
+ R.id.sound -> {
+ parent.toggleSound()
+ self.findItem(R.id.sound).isChecked = parent.shouldMakeSound()
+ }
+
+ R.id.setVol -> parent.createVolumeDialog()
+ R.id.testVol -> parent.testVolume()
+ else -> return false
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/main/VolumeDialog.kt b/app/src/main/java/se/wmuth/openc25k/main/VolumeDialog.kt
new file mode 100644
index 0000000..ddf2bfa
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/main/VolumeDialog.kt
@@ -0,0 +1,73 @@
+package se.wmuth.openc25k.main
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.widget.SeekBar
+import android.widget.SeekBar.OnSeekBarChangeListener
+import android.widget.TextView
+import androidx.appcompat.app.AlertDialog
+import se.wmuth.openc25k.databinding.VolumeDialogBinding
+
+/**
+ * Creates the volume selection dialog and updates the listener
+ * when the user selects a new volume
+ *
+ * @param p the parent or listener to send the update volume event to
+ * @param pCon the context of the parent
+ * @param pLIf the layout inflater used in the parent so we can inflate the dialog
+ */
+class VolumeDialog(p: VolumeDialogListener, pCon: Context, pLIf: LayoutInflater) :
+ OnSeekBarChangeListener, View.OnClickListener {
+ private lateinit var dialog: AlertDialog
+ private lateinit var twProgress: TextView
+ private val parentContext: Context = pCon
+ private val parentInflater: LayoutInflater = pLIf
+ private val parent = p
+ private var newVolume: Int = 0
+
+ /**
+ * Creates the volume alert dialog
+ *
+ * @param initialVol the initial volume to display, probably current selected volume
+ */
+ fun createAlertDialog(initialVol: Float) {
+ newVolume = (initialVol * 100).toInt()
+
+ val builder = AlertDialog.Builder(parentContext)
+ val binding = VolumeDialogBinding.inflate(parentInflater)
+
+ binding.seekbarVolume.progress = newVolume
+ binding.seekbarVolume.setOnSeekBarChangeListener(this)
+
+ binding.btnConfirm.setOnClickListener(this)
+
+ twProgress = binding.twProgress
+ twProgress.text = newVolume.toString()
+
+ builder.setView(binding.root)
+ dialog = builder.show()
+ }
+
+ interface VolumeDialogListener {
+ /**
+ * Set the volume in the listener to newVolume, [nV]
+ */
+ fun setVolume(nV: Float)
+ }
+
+ override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
+ if (p0 != null && p2) {
+ newVolume = p1
+ twProgress.text = p1.toString()
+ }
+ }
+
+ override fun onClick(p0: View?) {
+ parent.setVolume(newVolume.toFloat() / 100.0f)
+ dialog.dismiss()
+ }
+
+ override fun onStartTrackingTouch(p0: SeekBar?) {}
+ override fun onStopTrackingTouch(p0: SeekBar?) {}
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/track/RunTimer.kt b/app/src/main/java/se/wmuth/openc25k/track/RunTimer.kt
new file mode 100644
index 0000000..9f9d6b5
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/track/RunTimer.kt
@@ -0,0 +1,118 @@
+package se.wmuth.openc25k.track
+
+import android.os.CountDownTimer
+import se.wmuth.openc25k.data.Interval
+
+/**
+ * Times an array of intervals, sending events throughout
+ *
+ * @param iVal the interval array to time
+ * @param listener the listener which gets notified of the timer's events
+ * @constructor Creates default implementation of timer to track the intervals
+ */
+class RunTimer(iVal: Array, listener: RunTimerListener) {
+ private val intervals: Iterator = iVal.iterator()
+ private val parent: RunTimerListener = listener
+ private val totSeconds: Int = iVal.fold(0) { acc, (time) -> acc + time }
+ private var curInterval: Interval = intervals.next()
+ private var intervalSeconds: Int = 0
+ private var timer: CountDownTimer? = null
+ private var secondsPassed: Int = 0
+ private var finished: Boolean = false
+ private var thereIsTimer: Boolean = false
+
+ interface RunTimerListener {
+ /**
+ * When the timer runs out of intervals to track this is called
+ */
+ fun finishRun()
+
+ /**
+ * When the current interval finishes and we move onto the next one,
+ * this method is called
+ */
+ fun nextInterval()
+
+ /**
+ * On each tick, for now always 1 second long, this method is called
+ */
+ fun tick()
+ }
+
+ /**
+ * Start the timer, period 1 second
+ * Will resumed if paused earlier
+ */
+ fun start() {
+ if (!finished && !thereIsTimer) {
+ timer = object :
+ CountDownTimer((((curInterval.time - intervalSeconds) * 1000).toLong()), 1000) {
+ override fun onTick(millisUntilFinished: Long) {
+ tick()
+ }
+
+ override fun onFinish() {}
+ }.start()
+
+ thereIsTimer = true
+ }
+ }
+
+ /**
+ * Pauses the timer
+ */
+ fun pause() {
+ timer?.cancel()
+ thereIsTimer = false
+ }
+
+ /**
+ * Skips the rest of the current interval and moves to the next one
+ */
+ fun skip() {
+ pause()
+ secondsPassed += (curInterval.time - intervalSeconds)
+ intervalSeconds = 0
+ if (intervals.hasNext()) {
+ curInterval = intervals.next()
+ parent.nextInterval()
+ start()
+ } else if (!finished) {
+ parent.finishRun()
+ finished = true
+ }
+ }
+
+ /**
+ * Gets the remaining time in the current interval
+ * Format is MM:SS
+ */
+ fun getIntervalRemaining(): String {
+ return String.format(
+ "%02d:%02d",
+ ((curInterval.time - intervalSeconds) / 60),
+ ((curInterval.time - intervalSeconds) % 60)
+ )
+ }
+
+ /**
+ * Gets the remaining time in total for the entire run
+ * Format is MM:SS
+ */
+ fun getTotalRemaining(): String {
+ return String.format(
+ "%02d:%02d", ((totSeconds - secondsPassed) / 60), ((totSeconds - secondsPassed) % 60)
+ )
+ }
+
+ private fun tick() {
+ intervalSeconds++
+ secondsPassed++
+
+ if (intervalSeconds >= curInterval.time) {
+ skip()
+ } else {
+ parent.tick()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/se/wmuth/openc25k/track/Shaker.kt b/app/src/main/java/se/wmuth/openc25k/track/Shaker.kt
new file mode 100644
index 0000000..7419512
--- /dev/null
+++ b/app/src/main/java/se/wmuth/openc25k/track/Shaker.kt
@@ -0,0 +1,64 @@
+package se.wmuth.openc25k.track
+
+import android.os.Build
+import android.os.CombinedVibration
+import android.os.VibrationAttributes
+import android.os.VibrationEffect
+import android.os.VibratorManager
+
+/**
+ * Handles vibration, or shaking, in the app
+ *
+ * @param manager the vibration manager to use when telling the device to vibrate
+ * @constructor Creates default object and effects used later on
+ */
+class Shaker(manager: VibratorManager) {
+ private val man: VibratorManager
+ private val completeEffect: CombinedVibration
+ private val walkEffect: CombinedVibration
+ private val jogEffect: CombinedVibration
+ private val delay: Long = 100L // default delay
+ private val vib: Long = 350L // default time to vibrate
+
+ init {
+ man = manager
+
+ val w = longArrayOf(0L, vib)
+ walkEffect = CombinedVibration.createParallel(VibrationEffect.createWaveform(w, -1))
+
+ val j = longArrayOf(0L, vib, delay, vib)
+ jogEffect = CombinedVibration.createParallel(VibrationEffect.createWaveform(j, -1))
+
+ val c = longArrayOf(0L, vib, delay, vib, delay, vib, delay, vib)
+ completeEffect = CombinedVibration.createParallel(VibrationEffect.createWaveform(c, -1))
+ }
+
+ /**
+ * Creates the shaking effect when switching to walking
+ */
+ fun walkShake() {
+ shake(walkEffect)
+ }
+
+ /**
+ * Creates the shaking effect when switching to jogging
+ */
+ fun jogShake() {
+ shake(jogEffect)
+ }
+
+ /**
+ * Creates the shaking effect when completing the run
+ */
+ fun completeShake() {
+ shake(completeEffect)
+ }
+
+ private fun shake(e: CombinedVibration) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ man.vibrate(e, VibrationAttributes.createForUsage(VibrationAttributes.USAGE_ALARM))
+ } else {
+ man.vibrate(e)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_green_background.xml b/app/src/main/res/drawable/ic_green_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_green_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..721ed0b
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_track.xml b/app/src/main/res/layout/activity_track.xml
new file mode 100644
index 0000000..7b3af29
--- /dev/null
+++ b/app/src/main/res/layout/activity_track.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/run_row.xml b/app/src/main/res/layout/run_row.xml
new file mode 100644
index 0000000..4af2f18
--- /dev/null
+++ b/app/src/main/res/layout/run_row.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/volume_dialog.xml b/app/src/main/res/layout/volume_dialog.xml
new file mode 100644
index 0000000..01cde7f
--- /dev/null
+++ b/app/src/main/res/layout/volume_dialog.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/settings_menu.xml b/app/src/main/res/menu/settings_menu.xml
new file mode 100644
index 0000000..f70a81b
--- /dev/null
+++ b/app/src/main/res/menu/settings_menu.xml
@@ -0,0 +1,27 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi/ic_green.xml b/app/src/main/res/mipmap-anydpi/ic_green.xml
new file mode 100644
index 0000000..38d521c
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi/ic_green.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi/ic_green_round.xml b/app/src/main/res/mipmap-anydpi/ic_green_round.xml
new file mode 100644
index 0000000..38d521c
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi/ic_green_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_green.webp b/app/src/main/res/mipmap-hdpi/ic_green.webp
new file mode 100644
index 0000000..a659554
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_green.webp differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_green_foreground.webp b/app/src/main/res/mipmap-hdpi/ic_green_foreground.webp
new file mode 100644
index 0000000..9e80a4b
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_green_foreground.webp differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_green_round.webp b/app/src/main/res/mipmap-hdpi/ic_green_round.webp
new file mode 100644
index 0000000..e0dd50d
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_green_round.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_green.webp b/app/src/main/res/mipmap-mdpi/ic_green.webp
new file mode 100644
index 0000000..8b30149
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_green.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_green_foreground.webp b/app/src/main/res/mipmap-mdpi/ic_green_foreground.webp
new file mode 100644
index 0000000..b721d11
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_green_foreground.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_green_round.webp b/app/src/main/res/mipmap-mdpi/ic_green_round.webp
new file mode 100644
index 0000000..d039a6d
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_green_round.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_green.webp b/app/src/main/res/mipmap-xhdpi/ic_green.webp
new file mode 100644
index 0000000..4d02bf9
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_green.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_green_foreground.webp b/app/src/main/res/mipmap-xhdpi/ic_green_foreground.webp
new file mode 100644
index 0000000..b90c2b7
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_green_foreground.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_green_round.webp b/app/src/main/res/mipmap-xhdpi/ic_green_round.webp
new file mode 100644
index 0000000..f6798f7
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_green_round.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_green.webp b/app/src/main/res/mipmap-xxhdpi/ic_green.webp
new file mode 100644
index 0000000..7897600
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_green.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_green_foreground.webp b/app/src/main/res/mipmap-xxhdpi/ic_green_foreground.webp
new file mode 100644
index 0000000..d490a72
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_green_foreground.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_green_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_green_round.webp
new file mode 100644
index 0000000..f302210
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_green_round.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_green.webp b/app/src/main/res/mipmap-xxxhdpi/ic_green.webp
new file mode 100644
index 0000000..56605e7
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_green.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_green_foreground.webp b/app/src/main/res/mipmap-xxxhdpi/ic_green_foreground.webp
new file mode 100644
index 0000000..40f3ad3
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_green_foreground.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_green_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_green_round.webp
new file mode 100644
index 0000000..a17a43d
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_green_round.webp differ
diff --git a/app/src/main/res/raw/beep.mp3 b/app/src/main/res/raw/beep.mp3
new file mode 100644
index 0000000..9227bdb
Binary files /dev/null and b/app/src/main/res/raw/beep.mp3 differ
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..bdb0c2d
--- /dev/null
+++ b/app/src/main/res/values-night/themes.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml
new file mode 100644
index 0000000..6376dda
--- /dev/null
+++ b/app/src/main/res/values-sv/strings.xml
@@ -0,0 +1,47 @@
+
+
+ OpenC25k
+ Vecka
+ Dag
+ Ange volym
+ 0
+ Uppvärmning💪
+ Gå🚶
+ Jogga🏃💨
+ 🏁Du klarade det!🥳
+ Starta
+ Hoppa över
+ Pausa
+ Total kvarvarande tid:
+ Ljud
+ Testa volym
+ Vibrera
+ Kryssruta
+ Snabb uppvärmningspromenad på fem minuter. Sedan, alternera 60 sekunder av jogging och 90 sekunder av gående i sammanlagt 20 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, alternera 60 sekunder av jogging och 90 sekunder av gående i sammanlagt 20 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, alternera 60 sekunder av jogging och 90 sekunder av gående i sammanlagt 20 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, alternera 90 sekunder av jogging och 2 minuter av gående i sammanlagt 20 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, alternera 90 sekunder av jogging och 2 minuter av gående i sammanlagt 20 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, alternera 90 sekunder av jogging och 2 minuter av gående i sammanlagt 20 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan gör två repetitioner av följande:\n\nJogga 90 sekunder\n\nGå 90 sekunder\n\nJogga 3 minuter\n\nGå 3 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan gör två repetitioner av följande:\n\nJogga 90 sekunder\n\nGå 90 sekunder\n\nJogga 3 minuter\n\nGå 3 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan gör två repetitioner av följande:\n\nJogga 90 sekunder\n\nGå 90 sekunder\n\nJogga 3 minuter\n\nGå 3 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan:\n\nJogga 3 minuter\n\nGå 90 sekunder\n\nJogga 5 minuter\n\nGå 2½ minuter\n\nJogga 3 munter\n\nGå 90 sekunder\n\nJogga 5 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan:\n\nJogga 3 minuter\n\nGå 90 sekunder\n\nJogga 5 minuter\n\nGå 2½ minuter\n\nJogga 3 munter\n\nGå 90 sekunder\n\nJogga 5 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan:\n\nJogga 3 minuter\n\nGå 90 sekunder\n\nJogga 5 minuter\n\nGå 2½ minuter\n\nJogga 3 munter\n\nGå 90 sekunder\n\nJogga 5 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan:\n\nJogga 5 minuter\n\nGå 3 minuter\n\nJogga 5 minuter\n\nGå 3 minuter\n\nJogga 5 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan:\n\nJogga 8 minuter\n\nGå 5 minuter\n\nJogga 8 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 20 minuter utan att gå.
+ Snabb uppvärmningspromenad på fem minuter. Sedan:\n\nJogga 5 minuter\n\nGå 3 minuter\n\nJogga 8 minuter\n\nGå 3 minuter\n\nJogga 5 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan:\n\nJogga 10 minuter\n\nGå 3 minuter\n\nJogga 10 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 22 minuter utan att gå.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 25 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 25 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 25 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 28 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 28 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 28 minuter
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 30 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 30 minuter.
+ Snabb uppvärmningspromenad på fem minuter. Sedan, jogga 30 minuter.
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..475fb18
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,9 @@
+
+
+ @android:color/system_accent1_500
+ @android:color/system_accent1_800
+ @android:color/system_accent2_500
+ @android:color/system_accent2_800
+ @android:color/black
+ @android:color/white
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..4ab719d
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,65 @@
+
+
+
+
+ Week
+ Day
+
+
+ Set Volume
+ 0
+
+
+ Warmup💪
+ Walk🚶
+ Jog🏃💨
+ 🏁You did it!🥳
+ Start
+ Skip
+ Pause
+ Total time remaining:
+
+
+ Sound
+ Test Volume
+ Vibrate
+ Checkbox
+
+
+ Brisk five-minute warmup walk. Then alternate 60 seconds of jogging and 90 seconds of walking for a total of 20 minutes.
+ Brisk five-minute warmup walk. Then alternate 60 seconds of jogging and 90 seconds of walking for a total of 20 minutes.
+ Brisk five-minute warmup walk. Then alternate 60 seconds of jogging and 90 seconds of walking for a total of 20 minutes.
+
+ Brisk five-minute warmup walk. Then alternate 90 seconds of jogging and 2 minutes of walking for a total of 20 minutes.
+ Brisk five-minute warmup walk. Then alternate 90 seconds of jogging and 2 minutes of walking for a total of 20 minutes.
+ Brisk five-minute warmup walk. Then alternate 90 seconds of jogging and 2 minutes of walking for a total of 20 minutes.
+
+ Brisk five-minute warmup walk. Then do two repetitions of the following:\n\nJog 90 seconds\n\nWalk 90 seconds\n\nJog 3 minutes\n\nWalk 3 minutes
+ Brisk five-minute warmup walk. Then do two repetitions of the following:\n\nJog 90 seconds\n\nWalk 90 seconds\n\nJog 3 minutes\n\nWalk 3 minutes
+ Brisk five-minute warmup walk. Then do two repetitions of the following:\n\nJog 90 seconds\n\nWalk 90 seconds\n\nJog 3 minutes\n\nWalk 3 minutes
+
+ Brisk five-minute warmup walk. Then:\n\nJog 3 minutes\n\nWalk 90 seconds\n\nJog 5 minutes\n\nWalk 2½ minutes\n\nJog 3 minutes\n\nWalk 90 seconds\n\nJog 5 minutes
+ Brisk five-minute warmup walk. Then:\n\nJog 3 minutes\n\nWalk 90 seconds\n\nJog 5 minutes\n\nWalk 2½ minutes\n\nJog 3 minutes\n\nWalk 90 seconds\n\nJog 5 minutes
+ Brisk five-minute warmup walk. Then: Jog 3 minutes Walk 90 seconds Jog 5 minutes Walk 2½ minutes Jog 3 minutes Walk 90 seconds Jog 5 minutes
+
+ Brisk five-minute warmup walk. Then:\n\nJog 5 minutes\n\nWalk 3 minutes\n\nJog 5 minutes\n\nWalk 3 minutes\n\nJog 5 minutes
+ Brisk five-minute warmup walk. Then:\n\nJog 8 minutes\n\nWalk 5 minutes\n\nJog 8 minutes
+ Brisk five-minute warmup walk. Then, jog 20 minutes with no walking.
+
+ Brisk five-minute warmup walk. Then:\n\nJog 5 minutes\n\nWalk 3 minutes\n\nJog 8 minutes\n\nWalk 3 minutes\n\nJog 5 minutes
+ Brisk five-minute warmup walk. Then:\n\nJog 10 minutes\n\nWalk 3 minutes\n\nJog 10 minutes
+ Brisk five-minute warmup walk. Then, jog 22 minutes with no walking.
+
+ Brisk five-minute warmup walk. Then, jog 25 minutes
+ Brisk five-minute warmup walk. Then, jog 25 minutes.
+ Brisk five-minute warmup walk. Then, jog 25 minutes.
+
+ Brisk five-minute warmup walk. Then, jog 28 minutes.
+ Brisk five-minute warmup walk. Then, jog 28 minutes.
+ Brisk five-minute warmup walk. Then, jog 28 minutes.
+
+ Brisk five-minute warmup walk. Then, jog 30 minutes.
+ Brisk five-minute warmup walk. Then, jog 30 minutes.
+ Brisk five-minute warmup walk. Then, jog 30 minutes.
+ OpenC25k
+
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..7f1e0f4
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 0000000..fa0f996
--- /dev/null
+++ b/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 0000000..16a9cfd
--- /dev/null
+++ b/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/beeplink.txt b/beeplink.txt
new file mode 100644
index 0000000..b7a7799
--- /dev/null
+++ b/beeplink.txt
@@ -0,0 +1 @@
+https://archive.org/details/ondapevalery_outlook_Beep
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..6d9d338
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,5 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ id("com.android.application") version "8.1.1" apply false
+ id("org.jetbrains.kotlin.android") version "1.9.0" apply false
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..3c5031e
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..e708b1c
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..8d8cd0a
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sun Aug 27 17:10:12 CEST 2023
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..4f906e0
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..107acd3
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..cdf87e9
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,17 @@
+pluginManagement {
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.name = "OpenC25k"
+include(":app")