| @ -0,0 +1,45 @@ | |||
| package com.qhclh.ytzh.work.Hatchery; | |||
| import android.support.v7.widget.Toolbar; | |||
| import android.view.View; | |||
| import android.widget.ListView; | |||
| import com.qhclh.ytzh.R; | |||
| import com.qhclh.ytzh.base.BaseActivity; | |||
| import butterknife.BindView; | |||
| /** | |||
| * Created by 青花瓷 on 2018/4/2. | |||
| */ | |||
| public class HatcheryActivity extends BaseActivity { | |||
| @BindView(R.id.toolbar) | |||
| Toolbar mToolbar; | |||
| @BindView(R.id.lv_hatchery) | |||
| ListView lv_hatchery; | |||
| @Override | |||
| protected int setLayoutId() { | |||
| return R.layout.act_hatchery; | |||
| } | |||
| @Override | |||
| protected void initView() { | |||
| initToolbar(mToolbar, "孵化日报", new View.OnClickListener() { | |||
| @Override | |||
| public void onClick(View view) { | |||
| finish(); | |||
| } | |||
| }); | |||
| } | |||
| @Override | |||
| protected void initData() { | |||
| } | |||
| @Override | |||
| protected void initOper() { | |||
| } | |||
| } | |||
| @ -0,0 +1,63 @@ | |||
| package com.qhclh.ytzh.work.Hatchery; | |||
| import android.content.Context; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.BaseAdapter; | |||
| import android.widget.TextView; | |||
| import com.qhclh.ytzh.R; | |||
| import java.util.List; | |||
| /** | |||
| * Created by 青花瓷 on 2018/4/2. | |||
| */ | |||
| public class HatcheryAdapter extends BaseAdapter { | |||
| private Context context; | |||
| private List<HatcheryBean> list; | |||
| public HatcheryAdapter(Context context, List<HatcheryBean> 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; | |||
| } | |||
| } | |||
| @ -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; | |||
| } | |||
| } | |||
| @ -0,0 +1,18 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:orientation="vertical" | |||
| android:background="@color/greyf4f4f4" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent"> | |||
| <include layout="@layout/include_tool_bar"></include> | |||
| <ListView | |||
| android:id="@+id/lv_hatchery" | |||
| android:scrollbars="none" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content"> | |||
| </ListView> | |||
| </LinearLayout> | |||
| @ -0,0 +1,25 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:background="@color/white" | |||
| android:orientation="horizontal" | |||
| android:paddingBottom="@dimen/dp_5" | |||
| android:paddingLeft="@dimen/dp_10" | |||
| android:paddingRight="@dimen/dp_10" | |||
| android:paddingTop="@dimen/dp_5"> | |||
| <TextView | |||
| android:id="@+id/item_hatchery_name" | |||
| android:layout_width="0dp" | |||
| android:layout_height="wrap_content" | |||
| android:layout_weight="1" | |||
| android:textSize="@dimen/text_size_16" /> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="center_vertical" | |||
| android:src="@drawable/more_icon" /> | |||
| </LinearLayout> | |||