#1013 - Add option to use system font

This commit is contained in:
Moez Bhatti
2018-04-18 18:18:28 -04:00
parent b0ee5a03bb
commit 597de70748
11 changed files with 79 additions and 25 deletions
@@ -57,11 +57,13 @@ class PlusActivity : QkThemedActivity<PlusViewModel>(), PlusView {
free.setVisible(false)
fontProvider.getLato { lato ->
val typeface = Typeface.create(lato, Typeface.BOLD)
collapsingToolbar.setCollapsedTitleTypeface(typeface)
collapsingToolbar.setExpandedTitleTypeface(typeface)
}
fontProvider.typeface
.autoDisposable(scope())
.subscribe { lato ->
val typeface = Typeface.create(lato.value, Typeface.BOLD)
collapsingToolbar.setCollapsedTitleTypeface(typeface)
collapsingToolbar.setExpandedTitleTypeface(typeface)
}
colors.textPrimary
.autoDisposable(scope())
@@ -131,6 +131,7 @@ class SettingsActivity : QkThemedActivity<SettingsViewModel>(), SettingsView {
qkreplyTapDismiss.checkbox.isChecked = state.qkReplyTapDismiss
textSize.summary = state.textSizeSummary
systemFont.checkbox.isChecked = state.systemFontEnabled
unicode.checkbox.isChecked = state.stripUnicodeEnabled
@@ -37,6 +37,7 @@ data class SettingsState(
val qkReplyEnabled: Boolean = Build.VERSION.SDK_INT < Build.VERSION_CODES.N,
val qkReplyTapDismiss: Boolean = true,
val textSizeSummary: String = "",
val systemFontEnabled: Boolean = false,
val splitSmsEnabled: Boolean = false,
val stripUnicodeEnabled: Boolean = false,
val maxMmsSizeSummary: String = "100KB",
@@ -94,6 +94,9 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
disposables += prefs.textSize.asObservable()
.subscribe { textSize -> newState { it.copy(textSizeSummary = textSizeLabels[textSize]) } }
disposables += prefs.systemFont.asObservable()
.subscribe { enabled -> newState { it.copy(systemFontEnabled = enabled) } }
disposables += prefs.unicode.asObservable()
.subscribe { enabled -> newState { it.copy(stripUnicodeEnabled = enabled) } }
@@ -149,6 +152,8 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
R.id.textSize -> view.showTextSizePicker()
R.id.systemFont -> prefs.systemFont.set(!prefs.systemFont.get())
R.id.unicode -> prefs.unicode.set(!prefs.unicode.get())
R.id.mmsSize -> view.showMmsSizePicker()