diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt index 33c22c1a..1c73efce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Config.kt @@ -89,4 +89,8 @@ class Config(context: Context) : BaseConfig(context) { var enableRootAccess: Boolean get() = prefs.getBoolean(ENABLE_ROOT_ACCESS, false) 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() } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt index c3f2fc63..700bbb5a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/helpers/Constants.kt @@ -10,6 +10,7 @@ const val SORT_FOLDER_PREFIX = "sort_folder_" const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden" const val IS_ROOT_AVAILABLE = "is_root_available" const val ENABLE_ROOT_ACCESS = "enable_root_access" +const val EDITOR_TEXT_ZOOM = "editor_text_zoom" // open as const val OPEN_AS_DEFAULT = 0 diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/views/GestureTextView.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/views/GestureTextView.kt index 0baea957..ed4c4501 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/views/GestureTextView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/views/GestureTextView.kt @@ -9,6 +9,7 @@ import com.alexvasilkov.gestures.GestureController import com.alexvasilkov.gestures.State import com.alexvasilkov.gestures.views.interfaces.GestureView import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor +import com.simplemobiletools.commons.extensions.onGlobalLayout import com.simplemobiletools.filemanager.pro.extensions.config // taken from @@ -34,6 +35,14 @@ class GestureTextView @JvmOverloads constructor(context: Context, attrs: Attribu origSize = textSize setTextColor(context.config.textColor) 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 @@ -67,6 +76,7 @@ class GestureTextView @JvmOverloads constructor(context: Context, attrs: Attribu if (!State.equals(this.size, size)) { this.size = size super.setTextSize(TypedValue.COMPLEX_UNIT_PX, size) + context.config.editorTextZoom = state.zoom } } }