Skip to content

Commit 63968c7

Browse files
authored
feat: add font customization (#297)
1 parent 3f41450 commit 63968c7

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- Added support for custom fonts
10+
811
### Changed
912
- Disabled touch outside the checklist dialog to prevent loss of content ([#291])
1013

app/src/main/kotlin/org/fossify/notes/activities/MainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import org.fossify.commons.dialogs.SecurityDialog
4141
import org.fossify.commons.extensions.appLaunched
4242
import org.fossify.commons.extensions.appLockManager
4343
import org.fossify.commons.extensions.applyColorFilter
44+
import org.fossify.commons.extensions.applyFontToViewRecursively
4445
import org.fossify.commons.extensions.baseConfig
4546
import org.fossify.commons.extensions.beVisibleIf
4647
import org.fossify.commons.extensions.checkWhatsNew
@@ -218,6 +219,7 @@ class MainActivity : SimpleActivity() {
218219
setNonPrimaryAlpha(0.4f)
219220
setTextColor(getProperPrimaryColor())
220221
tabIndicatorColor = getProperPrimaryColor()
222+
applyFontToViewRecursively(this)
221223
}
222224
updateTextColors(binding.viewPager)
223225

app/src/main/kotlin/org/fossify/notes/fragments/TextFragment.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.core.view.ViewCompat
2121
import androidx.core.view.WindowInsetsCompat
2222
import androidx.viewbinding.ViewBinding
2323
import org.fossify.commons.extensions.*
24+
import org.fossify.commons.helpers.FontHelper
2425
import org.fossify.commons.views.MyEditText
2526
import org.fossify.notes.R
2627
import org.fossify.notes.activities.MainActivity
@@ -144,7 +145,7 @@ class TextFragment : NoteFragment() {
144145
private fun setupFragment() {
145146
val config = config ?: return
146147
noteEditText.apply {
147-
typeface = if (config.monospacedFont) Typeface.MONOSPACE else Typeface.DEFAULT
148+
typeface = if (config.monospacedFont) Typeface.MONOSPACE else FontHelper.getTypeface(context)
148149

149150
val fileContents = note!!.getNoteStoredValue(context)
150151
if (fileContents == null) {

0 commit comments

Comments
 (0)