|
@@ -1,13 +1,13 @@
|
|
|
package com.guadou.cs_cptservices.binding
|
|
|
|
|
|
import android.graphics.Paint
|
|
|
-import android.graphics.Typeface
|
|
|
import android.graphics.drawable.Drawable
|
|
|
import android.os.Build
|
|
|
import android.text.Html
|
|
|
import android.text.TextUtils
|
|
|
import android.widget.TextView
|
|
|
import androidx.databinding.BindingAdapter
|
|
|
+import com.guadou.lib_baselib.font_text_view.TypefaceUtil
|
|
|
|
|
|
/**
|
|
|
* 文本的设置
|
|
@@ -68,30 +68,30 @@ fun isCenterLine(textView: TextView, isUnderline: Boolean) {
|
|
|
*/
|
|
|
@BindingAdapter("typefaceLight")
|
|
|
fun typefaceLight(textView: TextView, boolean: Boolean) {
|
|
|
- textView.typeface = Typeface.create("sans-serif-light", Typeface.NORMAL)
|
|
|
+ textView.typeface = TypefaceUtil.getLight()
|
|
|
}
|
|
|
|
|
|
@BindingAdapter("typefaceRegular")
|
|
|
fun typefaceRegular(textView: TextView, boolean: Boolean) {
|
|
|
- textView.typeface = Typeface.create("sans-serif", Typeface.NORMAL)
|
|
|
+ textView.typeface = TypefaceUtil.getRegular()
|
|
|
}
|
|
|
|
|
|
@BindingAdapter("typefaceMedium")
|
|
|
fun typefaceMedium(textView: TextView, boolean: Boolean) {
|
|
|
- textView.typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL)
|
|
|
+ textView.typeface = TypefaceUtil.getMedium()
|
|
|
}
|
|
|
|
|
|
@BindingAdapter("typefaceBold")
|
|
|
fun typefaceSFBold(textView: TextView, boolean: Boolean) {
|
|
|
- textView.typeface = Typeface.create("sans-serif", Typeface.BOLD)
|
|
|
+ textView.typeface = TypefaceUtil.getBold()
|
|
|
}
|
|
|
|
|
|
@BindingAdapter("typefaceMediumOrBold")
|
|
|
fun typefaceMediumOrBold(textView: TextView, boolean: Boolean) {
|
|
|
if (boolean) { //true为粗体
|
|
|
- textView.typeface = Typeface.create("sans-serif", Typeface.BOLD)
|
|
|
+ textView.typeface = TypefaceUtil.getBold()
|
|
|
} else {
|
|
|
- textView.typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL)
|
|
|
+ textView.typeface = TypefaceUtil.getMedium()
|
|
|
}
|
|
|
}
|
|
|
|