|
|
|
@ -2,6 +2,7 @@ package com.qhclh.ytzh.index; |
|
|
|
|
|
|
|
import android.content.Intent; |
|
|
|
import android.support.v7.widget.Toolbar; |
|
|
|
import android.view.LayoutInflater; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.ImageView; |
|
|
|
import android.widget.LinearLayout; |
|
|
|
@ -27,67 +28,15 @@ import butterknife.OnClick; |
|
|
|
public class JPInfoActivity extends BaseActivity { |
|
|
|
@BindView(R.id.toolbar) |
|
|
|
Toolbar mToolbar; |
|
|
|
@BindView(R.id.system_pic) |
|
|
|
ImageView system_pic; |
|
|
|
@BindView(R.id.system_title) |
|
|
|
TextView system_title; |
|
|
|
@BindView(R.id.system_content) |
|
|
|
TextView system_content; |
|
|
|
@BindView(R.id.system_time) |
|
|
|
TextView system_time; |
|
|
|
@BindView(R.id.system_red) |
|
|
|
TextView system_red; |
|
|
|
|
|
|
|
@BindView(R.id.warninginfo_pic) |
|
|
|
ImageView warninginfo_pic; |
|
|
|
@BindView(R.id.warninginfo_title) |
|
|
|
TextView warninginfo_title; |
|
|
|
@BindView(R.id.warninginfo_content) |
|
|
|
TextView warninginfo_content; |
|
|
|
@BindView(R.id.warninginfo_time) |
|
|
|
TextView warninginfo_time; |
|
|
|
@BindView(R.id.warninginfo_red) |
|
|
|
TextView warninginfo_red; |
|
|
|
|
|
|
|
@BindView(R.id.chickscan_pic) |
|
|
|
ImageView chickscan_pic; |
|
|
|
@BindView(R.id.chickscan_title) |
|
|
|
TextView chickscan_title; |
|
|
|
@BindView(R.id.chickscan_content) |
|
|
|
TextView chickscan_content; |
|
|
|
@BindView(R.id.chickscan_time) |
|
|
|
TextView chickscan_time; |
|
|
|
@BindView(R.id.chickscan_red) |
|
|
|
TextView chickscan_red; |
|
|
|
|
|
|
|
@BindView(R.id.killc_pic) |
|
|
|
ImageView killc_pic; |
|
|
|
@BindView(R.id.killc_title) |
|
|
|
TextView killc_title; |
|
|
|
@BindView(R.id.killc_content) |
|
|
|
TextView killc_content; |
|
|
|
@BindView(R.id.killc_time) |
|
|
|
TextView killc_time; |
|
|
|
@BindView(R.id.killc_red) |
|
|
|
TextView killc_red; |
|
|
|
|
|
|
|
@BindView(R.id.system_ll) |
|
|
|
LinearLayout system_ll; |
|
|
|
@BindView(R.id.warninginfo_ll) |
|
|
|
LinearLayout warninginfo_ll; |
|
|
|
@BindView(R.id.chickscan_ll) |
|
|
|
LinearLayout chickscan_ll; |
|
|
|
@BindView(R.id.killc_ll) |
|
|
|
LinearLayout killc_ll; |
|
|
|
|
|
|
|
private List<NewsBean> newsBeanListsystem; |
|
|
|
private List<NewsBean> newsBeanListwarning; |
|
|
|
private List<NewsBean> newsBeanListchick; |
|
|
|
private List<NewsBean> newsBeanListkillc; |
|
|
|
|
|
|
|
@BindView(R.id.jpcontent) |
|
|
|
LinearLayout jpcontent; |
|
|
|
|
|
|
|
@Override |
|
|
|
protected int setLayoutId() { |
|
|
|
return R.layout.act_jpinfo; |
|
|
|
return R.layout.act_jpinfos; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -110,102 +59,41 @@ public class JPInfoActivity extends BaseActivity { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private ImageView system_pic; |
|
|
|
private TextView system_title; |
|
|
|
private TextView system_content; |
|
|
|
private TextView system_time; |
|
|
|
private TextView system_red; |
|
|
|
|
|
|
|
private LinearLayout system_ll; |
|
|
|
@Override |
|
|
|
protected void onResume() { |
|
|
|
super.onResume(); |
|
|
|
newsBeanListsystem = DataSupport.select("id", "url", "title", "content", "time", "type","red").where("type = ?","01").order("time desc").find(NewsBean.class); |
|
|
|
newsBeanListwarning = DataSupport.select("id", "url", "title", "content", "time", "type","red").where("type = ?","02").order("time desc").find(NewsBean.class); |
|
|
|
newsBeanListchick = DataSupport.select("id", "url", "title", "content", "time", "type","red").where("type = ?","03").order("time desc").find(NewsBean.class); |
|
|
|
newsBeanListkillc = DataSupport.select("id", "url", "title", "content", "time", "type","red").where("type = ?","04").order("time desc").find(NewsBean.class); |
|
|
|
// System.out.println("aaa11++++++"+newsBeanListsystem.toString()); |
|
|
|
// System.out.println("aaa22++++++"+newsBeanListwarning.toString()); |
|
|
|
// System.out.println("aaa33++++++"+newsBeanListchick.toString()); |
|
|
|
// System.out.println("aaa44++++++"+newsBeanListkillc.toString()); |
|
|
|
if (newsBeanListsystem!=null && newsBeanListsystem.size()>0) { |
|
|
|
Glide.with(this).load(newsBeanListsystem.get(0).getUrl()).placeholder(R.mipmap.ic_launcher_round).error(R.mipmap.ic_launcher_round).into(system_pic); |
|
|
|
system_title.setText("系统提示"); |
|
|
|
system_content.setText(newsBeanListsystem.get(0).getContent()); |
|
|
|
system_time.setText(newsBeanListsystem.get(0).getTime()); |
|
|
|
if (newsBeanListsystem.get(0).getRed() == 1) { |
|
|
|
system_red.setVisibility(View.VISIBLE); |
|
|
|
}else { |
|
|
|
system_red.setVisibility(View.INVISIBLE); |
|
|
|
} |
|
|
|
}else { |
|
|
|
system_ll.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
|
|
|
|
if (newsBeanListwarning!=null && newsBeanListwarning.size()>0) { |
|
|
|
Glide.with(this).load(newsBeanListwarning.get(0).getUrl()).placeholder(R.mipmap.ic_launcher_round).error(R.mipmap.ic_launcher_round).into(warninginfo_pic); |
|
|
|
warninginfo_title.setText("预警提示"); |
|
|
|
warninginfo_content.setText(newsBeanListwarning.get(0).getContent()); |
|
|
|
warninginfo_time.setText(newsBeanListwarning.get(0).getTime()); |
|
|
|
if (newsBeanListwarning.get(0).getRed() == 1) { |
|
|
|
warninginfo_red.setVisibility(View.VISIBLE); |
|
|
|
}else { |
|
|
|
warninginfo_red.setVisibility(View.INVISIBLE); |
|
|
|
} |
|
|
|
}else { |
|
|
|
warninginfo_ll.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
|
|
|
|
if (newsBeanListchick!=null && newsBeanListchick.size()>0) { |
|
|
|
Glide.with(this).load(newsBeanListchick.get(0).getUrl()).placeholder(R.mipmap.ic_launcher_round).error(R.mipmap.ic_launcher_round).into(chickscan_pic); |
|
|
|
chickscan_title.setText("鸡苗扫码推送"); |
|
|
|
chickscan_content.setText(newsBeanListchick.get(0).getContent()); |
|
|
|
chickscan_time.setText(newsBeanListchick.get(0).getTime()); |
|
|
|
if (newsBeanListchick.get(0).getRed() == 1) { |
|
|
|
chickscan_red.setVisibility(View.VISIBLE); |
|
|
|
}else { |
|
|
|
chickscan_red.setVisibility(View.INVISIBLE); |
|
|
|
} |
|
|
|
}else { |
|
|
|
chickscan_ll.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
newsBeanListsystem = DataSupport.select("id", "url", "title", "content", "time", "type","red").order("time desc").find(NewsBean.class); |
|
|
|
|
|
|
|
if (newsBeanListkillc!=null && newsBeanListkillc.size()>0) { |
|
|
|
Glide.with(this).load(newsBeanListkillc.get(0).getUrl()).placeholder(R.mipmap.ic_launcher_round).error(R.mipmap.ic_launcher_round).into(killc_pic); |
|
|
|
killc_title.setText("屠宰单"); |
|
|
|
killc_content.setText(newsBeanListkillc.get(0).getContent()); |
|
|
|
killc_time.setText(newsBeanListkillc.get(0).getTime()); |
|
|
|
if (newsBeanListkillc.get(0).getRed() == 1) { |
|
|
|
killc_red.setVisibility(View.VISIBLE); |
|
|
|
}else { |
|
|
|
killc_red.setVisibility(View.INVISIBLE); |
|
|
|
System.out.println("aaa++++++++++"+newsBeanListsystem.toString()); |
|
|
|
if (newsBeanListsystem!=null && newsBeanListsystem.size()>0) { |
|
|
|
for (int i=0;i<newsBeanListsystem.size();i++) { |
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.view_jp, null); |
|
|
|
system_pic = view.findViewById(R.id.system_pic); |
|
|
|
system_title = view.findViewById(R.id.system_title); |
|
|
|
system_content = view.findViewById(R.id.system_content); |
|
|
|
system_time = view.findViewById(R.id.system_time); |
|
|
|
system_red = view.findViewById(R.id.system_red); |
|
|
|
system_ll = view.findViewById(R.id.system_ll); |
|
|
|
|
|
|
|
// Glide.with(this).load(newsBeanListsystem.get(0).getUrl()).placeholder(R.mipmap.ic_launcher_round).error(R.mipmap.ic_launcher_round).into(system_pic); |
|
|
|
system_title.setText(newsBeanListsystem.get(i).getTitle()); |
|
|
|
system_content.setText(newsBeanListsystem.get(i).getContent()); |
|
|
|
system_time.setText(newsBeanListsystem.get(i).getTime()); |
|
|
|
if (newsBeanListsystem.get(i).getRed() == 1) { |
|
|
|
system_red.setVisibility(View.VISIBLE); |
|
|
|
} else { |
|
|
|
system_red.setVisibility(View.INVISIBLE); |
|
|
|
} |
|
|
|
jpcontent.addView(view); |
|
|
|
} |
|
|
|
}else { |
|
|
|
killc_ll.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private Intent intent; |
|
|
|
@OnClick({R.id.system_ll, R.id.warninginfo_ll, R.id.chickscan_ll,R.id.killc_ll}) |
|
|
|
public void onClick(View view) { |
|
|
|
intent = new Intent(JPInfoActivity.this, WarningActivity.class); |
|
|
|
switch (view.getId()) { |
|
|
|
|
|
|
|
///< 系统消息 |
|
|
|
case R.id.system_ll: { |
|
|
|
intent.putExtra("type","01"); |
|
|
|
break; |
|
|
|
} |
|
|
|
///< 预警消息 |
|
|
|
case R.id.warninginfo_ll: { |
|
|
|
intent.putExtra("type","02"); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
///< 扫描消息 |
|
|
|
case R.id.chickscan_ll: { |
|
|
|
intent.putExtra("type","03"); |
|
|
|
break; |
|
|
|
} |
|
|
|
///< 屠宰消息 |
|
|
|
case R.id.killc_ll: { |
|
|
|
intent.putExtra("type","04"); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
} |