Linjiajia
2023-04-04 a1d1fb7c44e33c4baeb52964a027932018bc1325
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.application.zhangshi_app_android.other;
 
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import android.widget.TextView;
 
import androidx.appcompat.content.res.AppCompatResources;
 
import com.android.app_base.utils.ScreenSizeUtils;
import com.application.zhangshi_app_android.R;
import com.hjq.bar.style.CommonBarStyle;
 
/**
 * @author Ljj
 * @date 2023.03.30. 20:11
 * @desc TitleBar统一样式
 */
public class MyTitleBarStyle extends CommonBarStyle {
    @Override
    public TextView createLeftView(Context context) {
        return super.createLeftView(context);
    }
 
    @Override
    public Drawable getTitleBarBackground(Context context) {
        return new ColorDrawable(context.getColor(R.color.color_title_bar_background));
    }
 
    @Override
    public Drawable getLeftTitleBackground(Context context) {
        return null;
    }
 
    @Override
    public Drawable getRightTitleBackground(Context context) {
        return null;
    }
 
    @Override
    public Drawable getBackButtonDrawable(Context context) {
        return AppCompatResources.getDrawable(context,R.drawable.ic_menu);
    }
 
    @Override
    public ColorStateList getTitleColor(Context context) {
        return ColorStateList.valueOf(0xFFFFFFFF);
    }
 
    @Override
    public ColorStateList getLeftTitleColor(Context context) {
        return null;
    }
 
    @Override
    public ColorStateList getRightTitleColor(Context context) {
        return null;
    }
 
    @Override
    public Drawable getLineDrawable(Context context) {
        return null;
    }
 
    @Override
    public int getLeftHorizontalPadding(Context context) {
        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, context.getResources().getDisplayMetrics());
    }
 
    @Override
    public float getTitleSize(Context context) {
        return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, context.getResources().getDisplayMetrics());
    }
 
    @Override
    public int getLeftIconPadding(Context context) {
        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, context.getResources().getDisplayMetrics());
    }
 
}