mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-04-09 16:03:01 +02:00
remember the zoom level used at the file editor
This commit is contained in:
parent
23c786d3b9
commit
683845788a
@ -89,4 +89,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
var enableRootAccess: Boolean
|
var enableRootAccess: Boolean
|
||||||
get() = prefs.getBoolean(ENABLE_ROOT_ACCESS, false)
|
get() = prefs.getBoolean(ENABLE_ROOT_ACCESS, false)
|
||||||
set(enableRootAccess) = prefs.edit().putBoolean(ENABLE_ROOT_ACCESS, enableRootAccess).apply()
|
set(enableRootAccess) = prefs.edit().putBoolean(ENABLE_ROOT_ACCESS, enableRootAccess).apply()
|
||||||
|
|
||||||
|
var editorTextZoom: Float
|
||||||
|
get() = prefs.getFloat(EDITOR_TEXT_ZOOM, 0f)
|
||||||
|
set(editorTextZoom) = prefs.edit().putFloat(EDITOR_TEXT_ZOOM, editorTextZoom).apply()
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ const val SORT_FOLDER_PREFIX = "sort_folder_"
|
|||||||
const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
||||||
const val IS_ROOT_AVAILABLE = "is_root_available"
|
const val IS_ROOT_AVAILABLE = "is_root_available"
|
||||||
const val ENABLE_ROOT_ACCESS = "enable_root_access"
|
const val ENABLE_ROOT_ACCESS = "enable_root_access"
|
||||||
|
const val EDITOR_TEXT_ZOOM = "editor_text_zoom"
|
||||||
|
|
||||||
// open as
|
// open as
|
||||||
const val OPEN_AS_DEFAULT = 0
|
const val OPEN_AS_DEFAULT = 0
|
||||||
|
@ -9,6 +9,7 @@ import com.alexvasilkov.gestures.GestureController
|
|||||||
import com.alexvasilkov.gestures.State
|
import com.alexvasilkov.gestures.State
|
||||||
import com.alexvasilkov.gestures.views.interfaces.GestureView
|
import com.alexvasilkov.gestures.views.interfaces.GestureView
|
||||||
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||||
|
import com.simplemobiletools.commons.extensions.onGlobalLayout
|
||||||
import com.simplemobiletools.filemanager.pro.extensions.config
|
import com.simplemobiletools.filemanager.pro.extensions.config
|
||||||
|
|
||||||
// taken from
|
// taken from
|
||||||
@ -34,6 +35,14 @@ class GestureTextView @JvmOverloads constructor(context: Context, attrs: Attribu
|
|||||||
origSize = textSize
|
origSize = textSize
|
||||||
setTextColor(context.config.textColor)
|
setTextColor(context.config.textColor)
|
||||||
setLinkTextColor(context.getAdjustedPrimaryColor())
|
setLinkTextColor(context.getAdjustedPrimaryColor())
|
||||||
|
|
||||||
|
val storedTextZoom = context.config.editorTextZoom
|
||||||
|
if (storedTextZoom != 0f) {
|
||||||
|
onGlobalLayout {
|
||||||
|
controller.state.zoomTo(storedTextZoom, width / 2f, height / 2f)
|
||||||
|
controller.updateState()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getController() = controller
|
override fun getController() = controller
|
||||||
@ -67,6 +76,7 @@ class GestureTextView @JvmOverloads constructor(context: Context, attrs: Attribu
|
|||||||
if (!State.equals(this.size, size)) {
|
if (!State.equals(this.size, size)) {
|
||||||
this.size = size
|
this.size = size
|
||||||
super.setTextSize(TypedValue.COMPLEX_UNIT_PX, size)
|
super.setTextSize(TypedValue.COMPLEX_UNIT_PX, size)
|
||||||
|
context.config.editorTextZoom = state.zoom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user