|
@@ -7,6 +7,7 @@ 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
|
|
|
|
|
|
/**
|
|
|
* 文本的设置
|
|
@@ -65,23 +66,33 @@ fun isCenterLine(textView: TextView, isUnderline: Boolean) {
|
|
|
/**
|
|
|
* 设置字体
|
|
|
*/
|
|
|
+@BindingAdapter("typefaceLight")
|
|
|
+fun typefaceLight(textView: TextView, boolean: Boolean) {
|
|
|
+ textView.typeface = TypefaceUtil.getLight()
|
|
|
+}
|
|
|
+
|
|
|
+@BindingAdapter("typefaceRegular")
|
|
|
+fun typefaceRegular(textView: TextView, boolean: Boolean) {
|
|
|
+ textView.typeface = TypefaceUtil.getRegular()
|
|
|
+}
|
|
|
+
|
|
|
@BindingAdapter("typefaceMedium")
|
|
|
fun typefaceMedium(textView: TextView, boolean: Boolean) {
|
|
|
-// textView.typeface = TypefaceUtil.getSFMedium(textView.context)
|
|
|
+ textView.typeface = TypefaceUtil.getMedium()
|
|
|
}
|
|
|
|
|
|
@BindingAdapter("typefaceBold")
|
|
|
fun typefaceSFBold(textView: TextView, boolean: Boolean) {
|
|
|
-// textView.typeface = TypefaceUtil.getSFBold(textView.context)
|
|
|
+ textView.typeface = TypefaceUtil.getBold()
|
|
|
}
|
|
|
|
|
|
@BindingAdapter("typefaceMediumOrBold")
|
|
|
fun typefaceMediumOrBold(textView: TextView, boolean: Boolean) {
|
|
|
-// if (boolean) { //true为粗体
|
|
|
-// textView.typeface = TypefaceUtil.getSFBold(textView.context)
|
|
|
-// } else {
|
|
|
-// textView.typeface = TypefaceUtil.getSFMedium(textView.context)
|
|
|
-// }
|
|
|
+ if (boolean) { //true为粗体
|
|
|
+ textView.typeface = TypefaceUtil.getBold()
|
|
|
+ } else {
|
|
|
+ textView.typeface = TypefaceUtil.getMedium()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|