remember the last used editor brush settings
This commit is contained in:
parent
2c37b23e1e
commit
9b27a8fd75
4 changed files with 37 additions and 2 deletions
|
@ -20,6 +20,7 @@ import com.simplemobiletools.gallery.pro.extensions.fixDateTaken
|
|||
import ly.img.android.pesdk.assets.filter.basic.FilterPackBasic
|
||||
import ly.img.android.pesdk.assets.font.basic.FontPackBasic
|
||||
import ly.img.android.pesdk.backend.model.config.CropAspectAsset
|
||||
import ly.img.android.pesdk.backend.model.state.BrushSettings
|
||||
import ly.img.android.pesdk.backend.model.state.EditorLoadSettings
|
||||
import ly.img.android.pesdk.backend.model.state.EditorSaveSettings
|
||||
import ly.img.android.pesdk.backend.model.state.manager.SettingsList
|
||||
|
@ -35,6 +36,7 @@ import kotlin.collections.set
|
|||
|
||||
class NewEditActivity : SimpleActivity() {
|
||||
private val PESDK_EDIT_IMAGE = 1
|
||||
private val SETTINGS_LIST = "SETTINGS_LIST"
|
||||
private val SOURCE_IMAGE_PATH = "SOURCE_IMAGE_PATH"
|
||||
private val RESULT_IMAGE_PATH = "RESULT_IMAGE_PATH"
|
||||
private var sourceFileLastModified = 0L
|
||||
|
@ -103,6 +105,14 @@ class NewEditActivity : SimpleActivity() {
|
|||
val source = extras?.getString(SOURCE_IMAGE_PATH, "") ?: ""
|
||||
imagePathFromEditor = extras?.getString(RESULT_IMAGE_PATH, "") ?: ""
|
||||
|
||||
val settings = extras?.getParcelable<SettingsList>(SETTINGS_LIST)
|
||||
if (settings != null) {
|
||||
val brush = settings.getSettingsModel(BrushSettings::class.java)
|
||||
config.editorBrushColor = brush.brushColor
|
||||
config.editorBrushHardness = brush.brushHardness
|
||||
config.editorBrushSize = brush.brushSize
|
||||
}
|
||||
|
||||
if (resultCode != Activity.RESULT_OK || source.isEmpty() || imagePathFromEditor.isEmpty() || source == imagePathFromEditor) {
|
||||
finish()
|
||||
} else {
|
||||
|
@ -194,6 +204,12 @@ class NewEditActivity : SimpleActivity() {
|
|||
FontPackBasic.getFontPack()
|
||||
)
|
||||
|
||||
settingsList.getSettingsModel(BrushSettings::class.java).apply {
|
||||
brushColor = config.editorBrushColor
|
||||
brushHardness = config.editorBrushHardness
|
||||
brushSize = config.editorBrushSize
|
||||
}
|
||||
|
||||
// do not use Text Design, it takes up too much space
|
||||
val tools = settingsList.getSettingsModel(UiConfigMainMenu::class.java).toolList
|
||||
val newTools = tools.filterNot {
|
||||
|
|
|
@ -693,6 +693,9 @@ class SettingsActivity : SimpleActivity() {
|
|||
put(LAST_EDITOR_BRUSH_SIZE, config.lastEditorBrushSize)
|
||||
put(LAST_CONFLICT_RESOLUTION, config.lastConflictResolution)
|
||||
put(LAST_CONFLICT_APPLY_TO_ALL, config.lastConflictApplyToAll)
|
||||
put(EDITOR_BRUSH_COLOR, config.editorBrushColor)
|
||||
put(EDITOR_BRUSH_HARDNESS, config.editorBrushHardness)
|
||||
put(EDITOR_BRUSH_SIZE, config.editorBrushSize)
|
||||
put(ALBUM_COVERS, config.albumCovers)
|
||||
}
|
||||
|
||||
|
@ -812,10 +815,11 @@ class SettingsActivity : SimpleActivity() {
|
|||
LAST_EDITOR_CROP_ASPECT_RATIO -> config.lastEditorCropAspectRatio = value.toInt()
|
||||
LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_X -> config.lastEditorCropOtherAspectRatioX = value.toString().toFloat()
|
||||
LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_Y -> config.lastEditorCropOtherAspectRatioY = value.toString().toFloat()
|
||||
LAST_EDITOR_DRAW_COLOR -> config.lastEditorDrawColor = value.toInt()
|
||||
LAST_EDITOR_BRUSH_SIZE -> config.lastEditorBrushSize = value.toInt()
|
||||
LAST_CONFLICT_RESOLUTION -> config.lastConflictResolution = value.toInt()
|
||||
LAST_CONFLICT_APPLY_TO_ALL -> config.lastConflictApplyToAll = value.toBoolean()
|
||||
EDITOR_BRUSH_COLOR -> config.editorBrushColor = value.toInt()
|
||||
EDITOR_BRUSH_HARDNESS -> config.editorBrushHardness = value.toString().toFloat()
|
||||
EDITOR_BRUSH_SIZE -> config.editorBrushSize = value.toString().toFloat()
|
||||
ALBUM_COVERS -> {
|
||||
val existingCovers = config.parseAlbumCovers()
|
||||
val existingCoverPaths = existingCovers.map { it.path }.toMutableList() as ArrayList<String>
|
||||
|
|
|
@ -490,4 +490,16 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var spamFoldersChecked: Boolean
|
||||
get() = prefs.getBoolean(SPAM_FOLDERS_CHECKED, false)
|
||||
set(spamFoldersChecked) = prefs.edit().putBoolean(SPAM_FOLDERS_CHECKED, spamFoldersChecked).apply()
|
||||
|
||||
var editorBrushColor: Int
|
||||
get() = prefs.getInt(EDITOR_BRUSH_COLOR, -1)
|
||||
set(editorBrushColor) = prefs.edit().putInt(EDITOR_BRUSH_COLOR, editorBrushColor).apply()
|
||||
|
||||
var editorBrushHardness: Float
|
||||
get() = prefs.getFloat(EDITOR_BRUSH_HARDNESS, 0.5f)
|
||||
set(editorBrushHardness) = prefs.edit().putFloat(EDITOR_BRUSH_HARDNESS, editorBrushHardness).apply()
|
||||
|
||||
var editorBrushSize: Float
|
||||
get() = prefs.getFloat(EDITOR_BRUSH_SIZE, 0.05f)
|
||||
set(editorBrushSize) = prefs.edit().putFloat(EDITOR_BRUSH_SIZE, editorBrushSize).apply()
|
||||
}
|
||||
|
|
|
@ -79,6 +79,9 @@ const val SHOW_NOTCH = "show_notch"
|
|||
const val FILE_LOADING_PRIORITY = "file_loading_priority"
|
||||
const val SPAM_FOLDERS_CHECKED = "spam_folders_checked"
|
||||
const val SHOW_THUMBNAIL_FILE_TYPES = "show_thumbnail_file_types"
|
||||
const val EDITOR_BRUSH_COLOR = "editor_brush_color"
|
||||
const val EDITOR_BRUSH_HARDNESS = "editor_brush_hardness"
|
||||
const val EDITOR_BRUSH_SIZE = "editor_brush_size"
|
||||
|
||||
// slideshow
|
||||
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||
|
|
Loading…
Reference in a new issue