Add lastSaveExtension to config

This allow to keep the preferred user file extension like save folder
This commit is contained in:
Laurent Arnoud 2020-03-15 16:42:56 +01:00
parent 0be3aa0b1f
commit 9d22838ae6
No known key found for this signature in database
GPG Key ID: A79DAB2374F95DD5
3 changed files with 7 additions and 0 deletions

View File

@ -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
}
}

View File

@ -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()

View File

@ -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"