#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
@@ -73,7 +73,6 @@ class QkEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet
init {
if (!isInEditMode) {
appComponent.inject(this)
fontProvider.getLato { setTypeface(it, typeface?.style ?: Typeface.NORMAL) }
context.obtainStyledAttributes(attrs, R.styleable.QkEditText)?.run {
val colorAttr = getInt(R.styleable.QkEditText_textColor, -1)
@@ -118,6 +117,10 @@ class QkEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet
super.onAttachedToWindow()
if (isInEditMode) return
fontProvider.typeface
.autoDisposable(scope())
.subscribe { setTypeface(it.value, typeface?.style ?: Typeface.NORMAL) }
textColorObservable
?.autoDisposable(scope())
?.subscribe { color -> setTextColor(color) }
@@ -75,7 +75,6 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
init {
if (!isInEditMode) {
appComponent.inject(this)
fontProvider.getLato { setTypeface(it, typeface?.style ?: Typeface.NORMAL) }
}
context.obtainStyledAttributes(attrs, R.styleable.QkTextView)?.run {
@@ -143,6 +142,10 @@ open class QkTextView @JvmOverloads constructor(context: Context, attrs: Attribu
updateSubscription()
fontProvider.typeface
.autoDisposable(scope())
.subscribe { setTypeface(it.value, typeface?.style ?: Typeface.NORMAL) }
Observables
.combineLatest(prefs.textSize.asObservable(), textSizeAttrSubject, { textSizePref, textSizeAttr ->
when (textSizeAttr) {