Commit a3e0beeb by chengxiuhong

test main

parent 967134d7
......@@ -15,12 +15,15 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.recycler.listener.IRecycleViewOnItemClickListener;
import com.oo.eye.R;
import com.oo.eye.adapter.MorePeopleAdapter;
import com.oo.eye.adapter.PopuAdapter;
import com.oo.eye.bean.ChartsBean;
import com.oo.eye.bean.StudentBean;
import org.w3c.dom.ls.LSException;
import java.util.ArrayList;
import java.util.List;
......@@ -62,6 +65,8 @@ public class MorePeopleTestActivity extends BaseActivity {
LinearLayout mSeleteAreaLay;
@BindView(R.id.key_test)
EditText mKeyTest;
private List<StudentBean> mStudentBeans;
private MorePeopleAdapter mPeopleAdapter;
@Override
protected int getLayoutId() {
......@@ -71,12 +76,13 @@ public class MorePeopleTestActivity extends BaseActivity {
@Override
protected void init() {
mRecycleView.setLayoutManager(new LinearLayoutManager(this));
List<StudentBean> list = new ArrayList<>();
mStudentBeans = new ArrayList<>();
for (int i = 0; i < 10; i++) {
StudentBean chartsBean = new StudentBean();
list.add(chartsBean);
mStudentBeans.add(chartsBean);
}
mRecycleView.setAdapter(new MorePeopleAdapter(list, this));
mPeopleAdapter = new MorePeopleAdapter(mStudentBeans, this);
mRecycleView.setAdapter(mPeopleAdapter);
}
@Override
......@@ -86,7 +92,7 @@ public class MorePeopleTestActivity extends BaseActivity {
ButterKnife.bind(this);
}
@OnClick({R.id.selete_area_lay,R.id.selete_lay, R.id.selete1_lay, R.id.do_search, R.id.begin_test})
@OnClick({R.id.selete_area_lay, R.id.selete_lay, R.id.selete1_lay, R.id.do_search, R.id.begin_test})
public void onClick(View view) {
switch (view.getId()) {
case R.id.selete_area_lay:
......@@ -101,6 +107,13 @@ public class MorePeopleTestActivity extends BaseActivity {
case R.id.do_search:
break;
case R.id.begin_test:
List<StudentBean> beanList = new ArrayList<>();
List<StudentBean> list = mPeopleAdapter.getList();
for (StudentBean bean : list) {
if (bean.isChick()) {
beanList.add(bean);
}
}
Intent intent = new Intent(this, TestListActivity.class);
startActivity(intent);
break;
......
......@@ -5,6 +5,7 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.app.baselibrary.recycler.adapter.BaseRecyclerViewAdapter;
import com.app.baselibrary.recycler.itemholder.ItemViewHolder;
......@@ -12,6 +13,7 @@ import com.oo.eye.R;
import com.oo.eye.bean.ChartsBean;
import com.oo.eye.bean.StudentBean;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -21,9 +23,13 @@ import java.util.List;
public class MorePeopleAdapter extends BaseRecyclerViewAdapter<StudentBean, ItemViewHolder> {
private final LayoutInflater mInflater;
private List<StudentBean> mBeanList = new ArrayList<>();
public MorePeopleAdapter(List<StudentBean> list, Context context) {
super(list, context);
if (list != null) {
mBeanList = list;
}
mInflater = LayoutInflater.from(mContext);
}
......@@ -33,11 +39,15 @@ public class MorePeopleAdapter extends BaseRecyclerViewAdapter<StudentBean, Item
}
@Override
public void onBindViewHolder(ItemViewHolder holder, int position) {
public void onBindViewHolder(ItemViewHolder holder, final int position) {
final StudentBean studentBean = mBeanList.get(position);
ImageView imageView = (ImageView) holder.itemView.findViewById(R.id.chick_iv);
imageView.setImageResource(studentBean.isChick() ? R.drawable.select2_sel : R.drawable.select2_nor);
holder.itemView.findViewById(R.id.choice_lay).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
studentBean.setChick(!studentBean.isChick());
notifyDataSetChanged();
}
});
}
......
......@@ -20,6 +20,15 @@ public class StudentBean extends BaseBean {
private String url;
private String pid;
private int distance;//测量距离
private boolean isChick;
public boolean isChick() {
return isChick;
}
public void setChick(boolean chick) {
isChick = chick;
}
public String getSid() {
return sid;
......
......@@ -20,10 +20,11 @@
android:background="@color/line_color"></View>
<ImageView
android:id="@+id/chick_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/select2_sel" />
android:src="@drawable/select2_nor" />
</RelativeLayout>
<RelativeLayout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment