From 9694648b40d503e52f69b383391ac7555c410c01 Mon Sep 17 00:00:00 2001 From: lh <1209405678@qq.com> Date: Mon, 2 Apr 2018 10:44:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=B5=E5=8C=96=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 2 + .../ytzh/work/Hatchery/HatcheryActivity.java | 45 +++++++++++++ .../ytzh/work/Hatchery/HatcheryAdapter.java | 63 +++++++++++++++++++ .../ytzh/work/Hatchery/HatcheryBean.java | 31 +++++++++ .../com/qhclh/ytzh/work/WorkFragment.java | 13 ++++ app/src/main/res/layout/act_hatchery.xml | 18 ++++++ app/src/main/res/layout/item_hatchery.xml | 25 ++++++++ 7 files changed, 197 insertions(+) create mode 100644 app/src/main/java/com/qhclh/ytzh/work/Hatchery/HatcheryActivity.java create mode 100644 app/src/main/java/com/qhclh/ytzh/work/Hatchery/HatcheryAdapter.java create mode 100644 app/src/main/java/com/qhclh/ytzh/work/Hatchery/HatcheryBean.java create mode 100644 app/src/main/res/layout/act_hatchery.xml create mode 100644 app/src/main/res/layout/item_hatchery.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4852924..53bc35e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -167,6 +167,8 @@ + list; + + public HatcheryAdapter(Context context, List list) { + this.context = context; + this.list = list; + } + + @Override + public int getCount() { + return list.size(); + } + + @Override + public Object getItem(int i) { + return list.get(i); + } + + @Override + public long getItemId(int i) { + return list.get(i).getId(); + } + + @Override + public View getView(int i, View view, ViewGroup viewGroup) { + ViewHolder holder; + HatcheryBean message = list.get(i); + if (view == null) { + holder = new ViewHolder(); + view = LayoutInflater.from(context).inflate(R.layout.item_hatchery, viewGroup,false); + holder.item_hatchery_name = view.findViewById(R.id.item_hatchery_name); + + view.setTag(holder); + }else { + holder = (ViewHolder) view.getTag(); + } + + holder.item_hatchery_name.setText(message.getName()); + return view; + } + + private class ViewHolder { + TextView item_hatchery_name; + } +} diff --git a/app/src/main/java/com/qhclh/ytzh/work/Hatchery/HatcheryBean.java b/app/src/main/java/com/qhclh/ytzh/work/Hatchery/HatcheryBean.java new file mode 100644 index 0000000..3aede72 --- /dev/null +++ b/app/src/main/java/com/qhclh/ytzh/work/Hatchery/HatcheryBean.java @@ -0,0 +1,31 @@ +package com.qhclh.ytzh.work.Hatchery; + +/** + * Created by 青花瓷 on 2018/4/2. + */ + +public class HatcheryBean { + private long id; + private String name; + + public HatcheryBean(long id, String name) { + this.id = id; + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/app/src/main/java/com/qhclh/ytzh/work/WorkFragment.java b/app/src/main/java/com/qhclh/ytzh/work/WorkFragment.java index 1de7f59..03321e7 100644 --- a/app/src/main/java/com/qhclh/ytzh/work/WorkFragment.java +++ b/app/src/main/java/com/qhclh/ytzh/work/WorkFragment.java @@ -15,6 +15,7 @@ import com.qhclh.ytzh.home.MainActivity; import com.qhclh.ytzh.index.WorkEvent; import com.qhclh.ytzh.utils.GlideImageLoader; import com.qhclh.ytzh.utils.RecyclerViewUtil; +import com.qhclh.ytzh.work.Hatchery.HatcheryActivity; import com.qhclh.ytzh.work.Poultrydailyreport.PoultryDailyReportActivity; import com.qhclh.ytzh.work.breedpoultry.DatanalysisActivity; import com.qhclh.ytzh.work.carsmannage.CarsManageActivity; @@ -139,6 +140,10 @@ public class WorkFragment extends BaseFragment { ///< 过磅单录入 startActivity(new Intent(getActivity(), WeightListActivity.class)); } + if (x == 11) { + ///< 孵化场 + startActivity(new Intent(getActivity(), HatcheryActivity.class)); + } @@ -190,6 +195,10 @@ public class WorkFragment extends BaseFragment { ///< 过磅单录入 workBeanList.add(new WorkBean(R.drawable.guobangdan, getString(R.string.guobandanluru), 10)); } + if (MainActivity.workList.contains("011")) { + ///< 孵化场 + workBeanList.add(new WorkBean(R.drawable.guobangdan, "孵化场", 11)); + } @@ -265,6 +274,10 @@ public class WorkFragment extends BaseFragment { ///< 过磅单录入 workBeanList.add(new WorkBean(R.drawable.guobangdan, getString(R.string.guobandanluru), 10)); } + if (event.getWorkList().contains("011")) { + ///< 孵化场 + workBeanList.add(new WorkBean(R.drawable.guobangdan, "孵化场", 11)); + } if (event.getWorkList().contains("007")) { work_iv.setVisibility(View.VISIBLE); } else { diff --git a/app/src/main/res/layout/act_hatchery.xml b/app/src/main/res/layout/act_hatchery.xml new file mode 100644 index 0000000..17e9f7e --- /dev/null +++ b/app/src/main/res/layout/act_hatchery.xml @@ -0,0 +1,18 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_hatchery.xml b/app/src/main/res/layout/item_hatchery.xml new file mode 100644 index 0000000..bf22950 --- /dev/null +++ b/app/src/main/res/layout/item_hatchery.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file