字体修改

This commit is contained in:
itgaojian163 2020-07-20 16:36:47 +08:00
parent 098ce9ceb2
commit 3a8c848ddd
18 changed files with 74 additions and 24 deletions

View File

@ -8,6 +8,7 @@ import android.util.TypedValue;
import android.widget.TextView;
import com.sucstepsoft.cm_utils.R;
import com.sucstepsoft.cm_utils.utils.LogUtils;
import androidx.annotation.Nullable;
@ -32,12 +33,22 @@ public class TypeFaceTextView extends androidx.appcompat.widget.AppCompatTextVie
public TypeFaceTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TypeFaceTextView, defStyleAttr, 0);
int type = a.getInteger(R.styleable.TypeFaceTextView_text_type_cus, 1);
int type = a.getInteger(R.styleable.TypeFaceTextView_text_type_cus, 0);
if (type == 1) {
mTypeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/zhangti.TTF");
} else {
mTypeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/STSONG.TTF");
mTypeface = Typeface.DEFAULT;
}
setTypeface(mTypeface);
}
public void setTypeFaceType(int type) {
if (type == 1) {
mTypeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/zhangti.TTF");
} else {
mTypeface = Typeface.DEFAULT;
}
setTypeface(mTypeface);
postInvalidate();
}
}

View File

@ -11,21 +11,22 @@
<ImageView
android:id="@+id/iv_Left"
android:layout_width="wrap_content"
android:visibility="invisible"
android:layout_height="wrap_content"
android:src="@drawable/ic_tab_icon_left" />
android:src="@drawable/ic_tab_icon_left"
android:visibility="invisible" />
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:id="@+id/tv_tab_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
app:text_type_cus="1"
tools:text="新闻" />
<ImageView
android:id="@+id/iv_right"
android:layout_width="wrap_content"
android:visibility="invisible"
android:layout_height="wrap_content"
android:src="@drawable/ic_tab_icon_right" />
android:src="@drawable/ic_tab_icon_right"
android:visibility="invisible" />
</LinearLayout>

View File

@ -26,6 +26,7 @@
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:text_type_cus="1"
android:padding="10dp"
android:textColor="#242424"
android:textSize="18sp"
@ -124,6 +125,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_weight="1"
app:text_type_cus="1"
android:text="活动详情"
android:textColor="#242424"
android:textSize="16sp" />
@ -178,6 +180,7 @@
android:layout_marginLeft="3dp"
android:layout_weight="1"
android:text="活动单位"
app:text_type_cus="1"
android:textColor="#242424"
android:textSize="16sp" />
</LinearLayout>
@ -239,6 +242,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_weight="1"
app:text_type_cus="1"
android:text="活动须知"
android:textColor="#242424"
android:textSize="16sp" />

View File

@ -155,13 +155,14 @@ public class VolunteerMineTeamActivity extends BaseActivity {
// mAdapter.addTeamMemberListener(rowsBean -> showMembers(rowsBean));
getMineTeamList(mCurrentPage);
} else {
refreshView(STATE_LOAD_EMPTY);
ToastUtils.showShort("你暂时还不是一名志愿者");
}
}
@Override
public void onError(Throwable e) {
refreshView(STATE_LOAD_ERROR);
}
@Override

View File

@ -16,7 +16,7 @@
android:layout_width="match_parent"
android:layout_height="220dp"
android:scaleType="fitXY"
tools:src="@drawable/bg_splash" />
tools:src="@drawable/ic_img_default" />
<ImageView
android:layout_width="@dimen/dkplayer_play_btn_size"
@ -66,6 +66,7 @@
android:layout_margin="15dp"
android:textColor="@color/black"
android:textSize="16sp"
app:text_type_cus="1"
tools:text="直播名称" />
<View
@ -155,7 +156,8 @@
android:layout_weight="1"
android:text="直播介绍"
android:textColor="#242424"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
</LinearLayout>

View File

@ -33,6 +33,7 @@
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:text_type_cus="1"
android:padding="10dp"
android:textColor="@color/black"
android:textSize="18sp" />
@ -289,6 +290,7 @@
android:layout_marginLeft="3dp"
android:layout_weight="1"
android:text="相关描述"
app:text_type_cus="1"
android:textColor="#242424"
android:textSize="16sp" />
</LinearLayout>
@ -318,6 +320,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
app:text_type_cus="1"
android:layout_weight="1"
android:text="相关继承人"
android:textColor="#242424"

View File

@ -41,6 +41,7 @@
android:layout_margin="15dp"
android:textColor="@color/black"
android:textSize="16sp"
app:text_type_cus="1"
tools:text="直播名称" />
<View
@ -130,7 +131,8 @@
android:layout_weight="1"
android:text="直播介绍"
android:textColor="#242424"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
</LinearLayout>

View File

@ -36,6 +36,7 @@
android:padding="10dp"
android:textColor="#242424"
android:textSize="18sp"
app:text_type_cus="1"
tools:text="活动标题活动标题活动标题活动标题活动标题" />
<TextView
@ -349,7 +350,8 @@
android:layout_weight="1"
android:text="活动详情"
android:textColor="#242424"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:id="@+id/tv_activity_log"
@ -360,7 +362,8 @@
android:focusable="true"
android:text="[活动日志]"
android:textColor="@color/text_blue"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
</LinearLayout>
<LinearLayout

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -27,5 +28,6 @@
android:maxLines="2"
android:textColor="@color/app_title"
android:textSize="10sp"
app:text_type_cus="1"
tools:text="非物质文化遗产数据库" />
</LinearLayout>

View File

@ -98,7 +98,9 @@ public class MainActivity extends BaseActivity {
mVpContent.setAdapter(new MyFragmentPageAdapter(this));
mVpContent.setUserInputEnabled(false);
mBnv.setTypeface(Typeface.createFromAsset(mActivity.getAssets(), "fonts/zhangti.TTF"));
//TODO 系统字体
// mBnv.setTypeface(Typeface.createFromAsset(mActivity.getAssets(), "fonts/zhangti.TTF"));
mBnv.setTypeface(Typeface.DEFAULT);
mBnv.setOnNavigationItemSelectedListener(item -> {
int itemId = item.getItemId();
if (itemId == R.id.tab_home) {

View File

@ -46,7 +46,7 @@ public class MainFuncAdapter extends BaseRecyclerAdapter<MainFuncBean, MainFuncH
@Override
public void bindHolder(MainFuncHolder mainFuncHolder, int i) {
mainFuncHolder.mTvName.setTypeFaceType(1);
Glide.with(mContext)
.load(mData.get(i).getIconRes())
.into(mainFuncHolder.mIvIcon);

View File

@ -4,6 +4,7 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
import com.tengshisoft.mudulemain.R;
import androidx.annotation.NonNull;
@ -17,7 +18,7 @@ import androidx.recyclerview.widget.RecyclerView;
*/
public class MainFuncHolder extends RecyclerView.ViewHolder {
public ImageView mIvIcon;
public TextView mTvName;
public TypeFaceTextView mTvName;
public MainFuncHolder(@NonNull View itemView) {
super(itemView);

View File

@ -76,7 +76,8 @@
android:padding="8dp"
android:text="精彩推荐"
android:textColor="@color/app_title_9f_no"
android:textSize="14sp" />
android:textSize="14sp"
app:text_type_cus="1" />
<ImageView
android:id="@+id/iv_right"
@ -137,7 +138,8 @@
android:padding="8dp"
android:text="文化动态"
android:textColor="@color/app_title_9f_no"
android:textSize="14sp" />
android:textSize="14sp"
app:text_type_cus="1" />
<ImageView
android:layout_width="wrap_content"
@ -198,7 +200,8 @@
android:padding="8dp"
android:text="直播专区"
android:textColor="@color/app_title_9f_no"
android:textSize="14sp" />
android:textSize="14sp"
app:text_type_cus="1" />
<ImageView
android:layout_width="wrap_content"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -47,7 +48,8 @@
android:gravity="center_horizontal"
android:text="用户昵称"
android:textColor="#242424"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
<TextView
android:layout_width="match_parent"
@ -84,7 +86,8 @@
android:layout_marginLeft="4dp"
android:text="常用功能"
android:textColor="#242424"
android:textSize="18sp" />
android:textSize="18sp"
app:text_type_cus="1" />
</LinearLayout>
<LinearLayout
@ -109,7 +112,7 @@
android:layout_height="90dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="130dp"
tools:background="@drawable/bg_splash" />
tools:background="@drawable/ic_img_default" />
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View File

@ -1,6 +1,7 @@
package com.tengshisoft.moduleplace.fragment;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -128,6 +129,10 @@ public class PlaceMainfragment extends BaseFragment {
}
getPlaceListByOrder(mCurrentPage, mCurrentType);
});
mRbDefault.setTypeface(Typeface.createFromAsset(mActivity.getAssets(), "fonts/zhangti.TTF"));
mRbDis.setTypeface(Typeface.createFromAsset(mActivity.getAssets(), "fonts/zhangti.TTF"));
mRbMoods.setTypeface(Typeface.createFromAsset(mActivity.getAssets(), "fonts/zhangti.TTF"));
mRbNews.setTypeface(Typeface.createFromAsset(mActivity.getAssets(), "fonts/zhangti.TTF"));
mCurrentPage = 1;
mSrlPlaceContent.setOnRefreshListener(refreshLayout -> refreshData());
getPlaceListByOrder(mCurrentPage, mCurrentType);

View File

@ -51,6 +51,7 @@
android:singleLine="true"
android:textColor="@color/black"
android:textSize="14sp"
app:text_type_cus="1"
tools:text="场馆名称场馆名称场馆名称场馆名称场馆名称场馆名称场馆名称场馆名称场馆名称" />
<me.zhanghai.android.materialratingbar.MaterialRatingBar
@ -241,7 +242,8 @@
android:layout_weight="1"
android:text="场馆服务"
android:textColor="#242424"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
</LinearLayout>
<TextView
@ -251,6 +253,7 @@
android:layout_margin="8dp"
android:textSize="13sp"
tools:text="地板 灯光\n照明 休息区" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
@ -283,7 +286,8 @@
android:layout_weight="1"
android:text="场馆其他服务"
android:textColor="#242424"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
</LinearLayout>
<TextView
@ -325,7 +329,8 @@
android:layout_weight="1"
android:text="场馆简介"
android:textColor="#242424"
android:textSize="16sp" />
android:textSize="16sp"
app:text_type_cus="1" />
</LinearLayout>
<TextView

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -26,5 +27,6 @@
android:singleLine="true"
android:textColor="#242424"
android:textSize="10sp"
app:text_type_cus="1"
tools:text="基层文化中心" />
</LinearLayout>