rk
昨天 4a8ff39b0fab0627ef8f7459587d514cc01c3676
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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);
    }
}