Merge pull request #179 from spk/last-save-ext

Add lastSaveExtension to config
This commit is contained in:
Tibor Kaputa 2020-03-15 21:33:30 +01:00 committed by GitHub
commit 5317bd5a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
setBackgroundColor(config.canvasBackgroundColor) setBackgroundColor(config.canvasBackgroundColor)
setColor(config.brushColor) setColor(config.brushColor)
defaultPath = config.lastSaveFolder defaultPath = config.lastSaveFolder
defaultExtension = config.lastSaveExtension
brushSize = config.brushSize brushSize = config.brushSize
updateBrushSize() updateBrushSize()
@ -395,6 +396,7 @@ class MainActivity : SimpleActivity(), CanvasListener {
defaultFilename = filename defaultFilename = filename
defaultExtension = extension defaultExtension = extension
config.lastSaveFolder = defaultPath config.lastSaveFolder = defaultPath
config.lastSaveExtension = defaultExtension
} }
} }

View File

@ -30,6 +30,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getString(LAST_SAVE_FOLDER, "")!! get() = prefs.getString(LAST_SAVE_FOLDER, "")!!
set(lastSaveFolder) = prefs.edit().putString(LAST_SAVE_FOLDER, lastSaveFolder).apply() set(lastSaveFolder) = prefs.edit().putString(LAST_SAVE_FOLDER, lastSaveFolder).apply()
var lastSaveExtension: String
get() = prefs.getString(LAST_SAVE_EXTENSION, "")!!
set(lastSaveExtension) = prefs.edit().putString(LAST_SAVE_EXTENSION, lastSaveExtension).apply()
var allowZoomingCanvas: Boolean var allowZoomingCanvas: Boolean
get() = prefs.getBoolean(ALLOW_ZOOMING_CANVAS, false) get() = prefs.getBoolean(ALLOW_ZOOMING_CANVAS, false)
set(allowZoomingCanvas) = prefs.edit().putBoolean(ALLOW_ZOOMING_CANVAS, allowZoomingCanvas).apply() 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 SHOW_BRUSH_SIZE = "show_brush_size"
const val BRUSH_SIZE = "brush_size_2" const val BRUSH_SIZE = "brush_size_2"
const val LAST_SAVE_FOLDER = "last_save_folder" const val LAST_SAVE_FOLDER = "last_save_folder"
const val LAST_SAVE_EXTENSION = "last_save_extension"
const val ALLOW_ZOOMING_CANVAS = "allow_zooming_canvas" const val ALLOW_ZOOMING_CANVAS = "allow_zooming_canvas"
const val FORCE_PORTRAIT_MODE = "force_portrait_mode" const val FORCE_PORTRAIT_MODE = "force_portrait_mode"