From 9d22838ae6edc6615dd3beff3c72fa115354251c Mon Sep 17 00:00:00 2001 From: Laurent Arnoud Date: Sun, 15 Mar 2020 16:42:56 +0100 Subject: [PATCH] Add lastSaveExtension to config This allow to keep the preferred user file extension like save folder --- .../com/simplemobiletools/draw/pro/activities/MainActivity.kt | 2 ++ .../kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt | 4 ++++ .../com/simplemobiletools/draw/pro/helpers/Constants.kt | 1 + 3 files changed, 7 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt index e6abb34..6508ef9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/pro/activities/MainActivity.kt @@ -73,6 +73,7 @@ class MainActivity : SimpleActivity(), CanvasListener { setBackgroundColor(config.canvasBackgroundColor) setColor(config.brushColor) defaultPath = config.lastSaveFolder + defaultExtension = config.lastSaveExtension brushSize = config.brushSize updateBrushSize() @@ -395,6 +396,7 @@ class MainActivity : SimpleActivity(), CanvasListener { defaultFilename = filename defaultExtension = extension config.lastSaveFolder = defaultPath + config.lastSaveExtension = defaultExtension } } diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt index 2b513fa..9323e94 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Config.kt @@ -30,6 +30,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getString(LAST_SAVE_FOLDER, "")!! set(lastSaveFolder) = prefs.edit().putString(LAST_SAVE_FOLDER, lastSaveFolder).apply() + var lastSaveExtension: String + get() = prefs.getString(LAST_SAVE_EXT, "")!! + set(lastSaveExtension) = prefs.edit().putString(LAST_SAVE_EXT, lastSaveExtension).apply() + var allowZoomingCanvas: Boolean get() = prefs.getBoolean(ALLOW_ZOOMING_CANVAS, false) set(allowZoomingCanvas) = prefs.edit().putBoolean(ALLOW_ZOOMING_CANVAS, allowZoomingCanvas).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Constants.kt index 5bb3c8c..7768a3e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/Constants.kt @@ -5,6 +5,7 @@ const val CANVAS_BACKGROUND_COLOR = "canvas_background_color" const val SHOW_BRUSH_SIZE = "show_brush_size" const val BRUSH_SIZE = "brush_size_2" const val LAST_SAVE_FOLDER = "last_save_folder" +const val LAST_SAVE_EXT = "last_save_ext" const val ALLOW_ZOOMING_CANVAS = "allow_zooming_canvas" const val FORCE_PORTRAIT_MODE = "force_portrait_mode"