Merge branch '2.0' of https://git.oschina.net/dreamhua/GH-ASSISTv1.45 into 2.0
This commit is contained in:
@ -247,20 +247,17 @@ public class NewsSearchActivity extends BaseActivity {
|
||||
}else {
|
||||
LinearLayout linearLayout = new LinearLayout(getApplicationContext());
|
||||
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||
linearLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
linearLayout.setBackgroundResource(R.drawable.cardview_item_style);
|
||||
|
||||
TextView tvType = new TextView(getApplicationContext());
|
||||
tvType.setTextSize(12);
|
||||
tvType.setPadding(DisplayUtils.dip2px(NewsSearchActivity.this,1), 0, DisplayUtils.dip2px(NewsSearchActivity.this,1), 0);
|
||||
|
||||
TextView textView = new TextView(getApplicationContext());
|
||||
textView.setPadding(DisplayUtils.dip2px(NewsSearchActivity.this,10),DisplayUtils.dip2px(NewsSearchActivity.this,10)
|
||||
,0, DisplayUtils.dip2px(NewsSearchActivity.this,10));
|
||||
textView.setTextColor(Color.parseColor("#3a3a3a"));
|
||||
textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
textView.setSingleLine();
|
||||
textView.setTextSize(15);
|
||||
|
||||
linearLayout.addView(tvType);
|
||||
linearLayout.addView(textView);
|
||||
|
||||
return new ViewHolder(linearLayout);
|
||||
@ -271,21 +268,8 @@ public class NewsSearchActivity extends BaseActivity {
|
||||
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof ViewHolder){
|
||||
ViewHolder viewHolder = (ViewHolder) holder;
|
||||
|
||||
if ("活动".equals(newsEntities.get(position).getType())){
|
||||
viewHolder.tvType.setTextColor(Color.WHITE);
|
||||
viewHolder.tvType.setBackgroundResource(R.drawable.textview_orange_style);
|
||||
} else if ("公告".equals(newsEntities.get(position).getType())){
|
||||
viewHolder.tvType.setTextColor(Color.WHITE);
|
||||
viewHolder.tvType.setBackgroundResource(R.drawable.textview_red_style);
|
||||
} else {
|
||||
viewHolder.tvType.setTextColor(Color.WHITE);
|
||||
viewHolder.tvType.setBackgroundResource(R.drawable.textview_blue_style);
|
||||
}
|
||||
viewHolder.tvType.setText(newsEntities.get(position).getType());
|
||||
|
||||
viewHolder.tvTitle.setText(newsEntities.get(position).getTitle());
|
||||
viewHolder.tvTitle.setOnClickListener(new View.OnClickListener() {
|
||||
viewHolder.linearLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getApplicationContext(),NewsDetailActivity.class);
|
||||
@ -332,13 +316,11 @@ public class NewsSearchActivity extends BaseActivity {
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||
LinearLayout linearLayout;
|
||||
TextView tvType;
|
||||
TextView tvTitle;
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
linearLayout = (LinearLayout) itemView;
|
||||
tvType = (TextView) linearLayout.getChildAt(0);
|
||||
tvTitle = (TextView) linearLayout.getChildAt(1);
|
||||
tvTitle = (TextView) linearLayout.getChildAt(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user