本文整理汇总了Java中com.chad.library.adapter.base.BaseViewHolder.setTextColor方法的典型用法代码示例。如果您正苦于以下问题:Java BaseViewHolder.setTextColor方法的具体用法?Java BaseViewHolder.setTextColor怎么用?Java BaseViewHolder.setTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.chad.library.adapter.base.BaseViewHolder
的用法示例。
在下文中一共展示了BaseViewHolder.setTextColor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder helper, ZhihuDailyItemBean item) {
if (DBUtils.getDB(mContext).isRead(DBConfig.TABLE_ZHIHU, item.getId(), ItemState
.STATE_IS_READ)) {
helper.setTextColor(R.id.tv_item_title, Color.GRAY);
} else {
if (SpUtils.getNightModel(mContext)) {
helper.setTextColor(R.id.tv_item_title, Color.WHITE);
} else {
helper.setTextColor(R.id.tv_item_title, Color.BLACK);
}
}
helper.setText(R.id.tv_item_title, item.getTitle());
Glide.with(mContext).load(item.getImages()[0]).crossFade().into((ImageView) helper.getView(R
.id.iv_item_image));
}
示例2: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, WeixinChoiceItemBean item) {
if (DBUtils.getDB(mContext).isRead(DBConfig.TABLE_WEIXIN, item.getId(), ItemState
.STATE_IS_READ)) {
helper.setTextColor(R.id.tv_item_title, Color.GRAY);
} else {
if (SpUtils.getNightModel(mContext)) {
helper.setTextColor(R.id.tv_item_title, Color.WHITE);
} else {
helper.setTextColor(R.id.tv_item_title, Color.BLACK);
}
}
helper.setText(R.id.tv_item_title, item.getTitle());
helper.setText(R.id.tv_item_who, item.getSource());
Glide.with(mContext).load(item.getFirstImg()).crossFade().into((ImageView) helper.getView(R
.id.iv_item_image));
}
示例3: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, WangyiNewsItemBean item) {
if (DBUtils.getDB(mContext).isRead(DBConfig.TABLE_WANGYI, item.getDocid(), ItemState
.STATE_IS_READ)) {
helper.setTextColor(R.id.tv_item_title, Color.GRAY);
} else {
if (SpUtils.getNightModel(mContext)) {
helper.setTextColor(R.id.tv_item_title, Color.WHITE);
} else {
helper.setTextColor(R.id.tv_item_title, Color.BLACK);
}
}
helper.setText(R.id.tv_item_title, item.getTitle());
helper.setText(R.id.tv_item_who, item.getSource());
helper.setText(R.id.tv_item_time, item.getPtime());
Glide.with(mContext).load(item.getImgsrc()).crossFade().into((ImageView) helper.getView(R
.id.iv_item_image));
}
示例4: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder viewHolder, Book item) {
viewHolder.setText(R.id.tv_book_bookName,item.getName()+" / "+item.getAuthor())
.setText(R.id.tv_book_barId,""+item.getBarId())
.setText(R.id.tv_book_borrowedTime,""+item.getBorrowedTime())
.setText(R.id.tv_book_returnTime, item.getReturnTime())
.setText(R.id.tv_book_location, item.getLocation())
.addOnClickListener(R.id.tv_book_renew)
;
//当前借阅的情况下考虑显示续借按钮和过期书籍的红色字体显示
if(doWhat == BookActivity.doCurrentBook){
if(curTime > TimeUtils.timeString2TimeStamp(item.getReturnTime()) ){ //过期书籍
viewHolder.setTextColor(R.id.tv_book_returnTime, mContext.getResources().getColor(R.color.goal_item_failed_color));
}else{
viewHolder.setVisible(R.id.tv_book_renew,item.getRenewTimes() == 0); //当前借阅且是未到期情况下 续借按钮可见
viewHolder.setTextColor(R.id.tv_book_returnTime, mContext.getResources().getColor(R.color.normal_item_text_color)); //恢复颜色,不然会显示bug,这个adapter框架的问题
}
}else{
viewHolder.setVisible(R.id.tv_book_renew,false); //BaseQuickAdapter的bug,还是得手动设置
}
}
示例5: initTitleColor
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void initTitleColor(BaseViewHolder helper, GankIoCustomItemBean item) {
if (DBUtils.getDB(mContext).isRead(DBConfig.TABLE_GANKIO_CUSTOM, item.getType() + item
.get_id(), ItemState.STATE_IS_READ)) {
helper.setTextColor(R.id.tv_item_title, Color.GRAY);
} else {
if (SpUtils.getNightModel(mContext)) {
helper.setTextColor(R.id.tv_item_title, Color.WHITE);
} else {
helper.setTextColor(R.id.tv_item_title, Color.BLACK);
}
}
}
示例6: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder viewHolder, CardConsumeItem item) {
viewHolder.setText(R.id.tv_item_card_shop,item.getShop())
.setText(R.id.tv_item_card_time,item.getTime())
.setText(R.id.tv_item_card_cash,""+item.getCash())
.setText(R.id.tv_item_card_amount,""+item.getChange());
if(item.getChange().charAt(0) != '-'){
viewHolder.setTextColor(R.id.tv_item_card_amount, mContext.getResources().getColor(R.color.goal_item_passed_color));
}else{
viewHolder.setTextColor(R.id.tv_item_card_amount, mContext.getResources().getColor(R.color.goal_item_failed_color));
}
}
示例7: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(final BaseViewHolder viewHolder, SearchBookStoreItem item) {
viewHolder.setText(R.id.tv_search_book_store_barId, item.getBarId())
.setText(R.id.tv_search_book_location, "" + item.getLocation())
.setText(R.id.tv_search_book_volume, "" + item.getVolume())
.setText(R.id.tv_search_book_state, item.getState())
.setText(R.id.tv_search_book_store_serial, item.getSerial())
;
if(item.getState().equals("可借")){
viewHolder.setTextColor(R.id.tv_search_book_state, mContext.getResources().getColor(R.color.goal_item_passed_color));
}
}
示例8: colorTextViewByScore
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
private void colorTextViewByScore(BaseViewHolder viewHolder,int textViewId, int score) {
if( score < 60) {
viewHolder.setTextColor(textViewId, mContext.getResources().getColor(R.color.goal_item_failed_color));
// if(textViewId == R.id.tv_score){ //给标题加红的话,下拉上滑后就乱标红色了,框架的复用item有问题
// viewHolder.setTextColor(R.id.tv_course_name, mContext.getResources().getColor(R.color.goal_item_failed_color));
// }else{
// viewHolder.setTextColor(R.id.tv_course_name, mContext.getResources().getColor(R.color.normal_item_passed_text_color));
// }
}else{
viewHolder.setTextColor(textViewId, mContext.getResources().getColor(R.color.goal_item_passed_color));
}
}
示例9: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, String item) {
helper.setText(R.id.tv_history_item, item);
helper.setTextColor(R.id.tv_history_item, historyTextColor);
ImageView iconImageView = helper.getView(R.id.right_icon);
iconImageView.setImageResource(historyIcon);
}
示例10: convert
import com.chad.library.adapter.base.BaseViewHolder; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, CallRecord item) {
helper.setText(R.id.tv_time,item.getTime());
helper.setText(R.id.tv_date,item.getData());
String mode="";
String state="";
if (item.getMode()==0){
mode="视频通话";
}else if (item.getMode()==1){
mode="视频优先通话";
}else if (item.getMode()==2){
mode="音频通话";
}
if (item.getState()==0){
helper.setTextColor(R.id.tv_userid, Color.parseColor("#000000"));
state="已接通话";
}else if (item.getState()==1){
helper.setTextColor(R.id.tv_userid, Color.parseColor("#FF0000"));
state="未接通话";
}else if (item.getState()==2){
helper.setTextColor(R.id.tv_userid, Color.parseColor("#000000"));
state="拒接通话";
}else if (item.getState()==3){
helper.setTextColor(R.id.tv_userid, Color.parseColor("#000000"));
state="已拨通话";
}
helper.setText(R.id.tv_userid,item.getUserid());
helper.setText(R.id.tv_mode,mode+" - "+state);
helper.setText(R.id.tv_time,"时长 "+item.getTime());
}