package com.application.zhangshi_app_android.other;
|
|
import android.content.Context;
|
import android.content.res.ColorStateList;
|
import android.graphics.Typeface;
|
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 Typeface getTitleTypeface(Context context, int style) {
|
return Typeface.createFromAsset(context.getAssets(), "roboto_regular.ttf");
|
}
|
|
@Override
|
public Typeface getLeftTitleTypeface(Context context, int style) {
|
return Typeface.createFromAsset(context.getAssets(), "roboto_regular.ttf");
|
}
|
|
@Override
|
public Typeface getRightTitleTypeface(Context context, int style) {
|
return Typeface.createFromAsset(context.getAssets(), "roboto_regular.ttf");
|
}
|
|
@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());
|
}
|
|
|
|
}
|