From b7f641515a48b303e8bd2728de2d42a77eb37d36 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 6 Apr 2022 21:27:43 -0700 Subject: [PATCH] Rename DIALOG_EMPTY_RECORDING -> DIALOG_RESUME_EMPTY_RECORDING. --- app/src/main/java/org/y20k/trackbook/Keys.kt | 2 +- app/src/main/java/org/y20k/trackbook/MapFragment.kt | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/y20k/trackbook/Keys.kt b/app/src/main/java/org/y20k/trackbook/Keys.kt index d01f216..d56d173 100644 --- a/app/src/main/java/org/y20k/trackbook/Keys.kt +++ b/app/src/main/java/org/y20k/trackbook/Keys.kt @@ -70,7 +70,7 @@ object Keys { const val STATE_THEME_DARK_MODE: String = "stateDarkMode" // dialog types - const val DIALOG_EMPTY_RECORDING: Int = 0 + const val DIALOG_RESUME_EMPTY_RECORDING: Int = 0 const val DIALOG_DELETE_TRACK: Int = 1 const val DIALOG_DELETE_NON_STARRED: Int = 2 const val DIALOG_DELETE_CURRENT_RECORDING: Int = 3 diff --git a/app/src/main/java/org/y20k/trackbook/MapFragment.kt b/app/src/main/java/org/y20k/trackbook/MapFragment.kt index 8412dea..4f4f64e 100644 --- a/app/src/main/java/org/y20k/trackbook/MapFragment.kt +++ b/app/src/main/java/org/y20k/trackbook/MapFragment.kt @@ -185,7 +185,7 @@ class MapFragment : Fragment(), YesNoDialog.YesNoDialogListener, MapOverlayHelpe override fun onYesNoDialog(type: Int, dialogResult: Boolean, payload: Int, payloadString: String) { super.onYesNoDialog(type, dialogResult, payload, payloadString) when (type) { - Keys.DIALOG_EMPTY_RECORDING -> { + Keys.DIALOG_RESUME_EMPTY_RECORDING -> { when (dialogResult) { // user tapped resume true -> { @@ -276,9 +276,12 @@ class MapFragment : Fragment(), YesNoDialog.YesNoDialogListener, MapOverlayHelpe /* Saves track - shows dialog, if recording is still empty */ private fun saveTrack() { - if (track.wayPoints.isEmpty()) { - YesNoDialog(this as YesNoDialog.YesNoDialogListener).show(context = activity as Context, type = Keys.DIALOG_EMPTY_RECORDING, message = R.string.dialog_error_empty_recording_message, yesButton = R.string.dialog_error_empty_recording_button_resume) - } else { + if (track.wayPoints.isEmpty()) + { + YesNoDialog(this as YesNoDialog.YesNoDialogListener).show(context = activity as Context, type = Keys.DIALOG_RESUME_EMPTY_RECORDING, message = R.string.dialog_error_empty_recording_message, yesButton = R.string.dialog_error_empty_recording_button_resume) + } + else + { CoroutineScope(IO).launch { // step 1: create and store filenames for json and gpx files track.trackUriString = FileHelper.getTrackFileUri(activity as Context, track).toString()