package com.doumee.lib_coremodel.binding.viewadapter.textview;
|
|
import android.graphics.Color;
|
import android.widget.TextView;
|
|
import androidx.core.content.ContextCompat;
|
import androidx.databinding.BindingAdapter;
|
|
public class TextViewAdapter {
|
@BindingAdapter("textColorSelect")
|
public static void bindTextColor(TextView textView,int textColorResource) {
|
textView.setTextColor(ContextCompat.getColor(textView.getContext(), textColorResource));
|
}
|
|
@BindingAdapter("textColorSelect")
|
public static void bindTextColor(TextView textView,String text) {
|
textView.setTextColor(Color.parseColor(text));
|
}
|
|
@BindingAdapter("textColorHintSelect")
|
public static void bindTextColorHint(TextView textView,int textColorResource) {
|
textView.setHintTextColor(ContextCompat.getColor(textView.getContext(), textColorResource));
|
}
|
|
@BindingAdapter("textColorHintSelect")
|
public static void bindTextColorHint(TextView textView,String text) {
|
textView.setHintTextColor(Color.parseColor(text));
|
}
|
|
@BindingAdapter("textStyleSelect")
|
public static void bindTextStyle(TextView textView,boolean isBold) {
|
textView.getPaint().setFakeBoldText(isBold);
|
}
|
}
|