Commit 4b2dde41 by 徐丛奇

qqqqqqqqqq

parents c446de52 d6a8e6c3
package com.oo.eye.activity;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
......@@ -9,15 +11,19 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.app.baselibrary.commonUtil.CheckUtil;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
import com.oo.eye.adapter.PopuAdapter;
import com.oo.eye.adapter.SinglePeopleAdapter;
import com.oo.eye.bean.StudentBean;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import retrofit2.http.HEAD;
/**
* Date : 2018/8/28.
......@@ -32,17 +38,10 @@ public class SinglePeopleTestActivity extends BaseActivity {
@BindView(R.id.selete_area_lay)
LinearLayout mSeleteAreaLay;
@BindView(R.id.test_order)
TextView mOrderText;
@BindView(R.id.test_group)
TextView mGroupText;
@BindView(R.id.test_name)
TextView mNameText;
@BindView(R.id.test_birthday)
TextView mBirthdayText;
private StudentBean mStudentBean;
@BindView(R.id.recycle_view)
RecyclerView mRecycleView;
private List<StudentBean> mStudentBeans;
private SinglePeopleAdapter mPeopleAdapter;
@Override
protected int getLayoutId() {
return R.layout.activity_singletest;
......@@ -50,19 +49,18 @@ public class SinglePeopleTestActivity extends BaseActivity {
@Override
protected void init() {
mStudentBean = new StudentBean();
mStudentBean.setRealname("范特西");
mStudentBean.setNumber("20160101");
mStudentBean.setClasses("动车组");
mStudentBean.setBirthday("20110101");
updateData();
}
private void updateData(){
mOrderText.setText(mStudentBean.getNumber());
mGroupText.setText(mStudentBean.getClasses());
mNameText.setText(mStudentBean.getRealname());
mBirthdayText.setText(mStudentBean.getBirthday());
mRecycleView.setLayoutManager(new LinearLayoutManager(this));
mStudentBeans = new ArrayList<>();
for (int i = 0; i < 10; i++) {
StudentBean mStudentBean = new StudentBean();
mStudentBean.setRealname("范特西"+i);
mStudentBean.setNumber("20160101"+i);
mStudentBean.setClasses("动车组"+i);
mStudentBean.setBirthday("20110101"+i);
mStudentBeans.add(mStudentBean);
}
mPeopleAdapter = new SinglePeopleAdapter(mStudentBeans, this);
mRecycleView.setAdapter(mPeopleAdapter);
}
@OnClick({R.id.selete_area_lay, R.id.do_search, R.id.begin_test})
......@@ -74,10 +72,13 @@ public class SinglePeopleTestActivity extends BaseActivity {
case R.id.do_search:
break;
case R.id.begin_test:
ArrayList<StudentBean> list = new ArrayList<>();
list.add(mStudentBean);
EyeConfig.getInstance().setStudents(list);
startActivity(BeforeEyeTestActivity.class);
StudentBean bean = mPeopleAdapter.getLastSelectBean();
if(!CheckUtil.isNull(bean)) {
ArrayList<StudentBean> list = new ArrayList<>();
list.add(bean);
EyeConfig.getInstance().setStudents(list);
startActivity(BeforeEyeTestActivity.class);
}
break;
}
}
......@@ -92,7 +93,7 @@ public class SinglePeopleTestActivity extends BaseActivity {
ColorDrawable cd = new ColorDrawable(0x00ffffff);// 背景颜色全透明
popupWindow.setBackgroundDrawable(cd);
ListView listView = (ListView) conview.findViewById(R.id.list_view);
listView.setAdapter(new PopuAdapter(this,null));
listView.setAdapter(new PopuAdapter(this, null));
int[] location = new int[2];
mSeleteAreaLay.getLocationOnScreen(location);
// popupWindow.setAnimationStyle(R.style.style_pop_animation);// 动画效果必须放在showAsDropDown()方法上边,否则无效
......
package com.oo.eye.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.app.baselibrary.commonUtil.CheckUtil;
import com.app.baselibrary.recycler.adapter.BaseRecyclerViewAdapter;
import com.app.baselibrary.recycler.itemholder.ItemViewHolder;
import com.oo.eye.R;
import com.oo.eye.bean.StudentBean;
import java.util.List;
/**
* Date : 2018/8/28.
* Author: cxh
*/
public class SinglePeopleAdapter extends BaseRecyclerViewAdapter<StudentBean, ItemViewHolder> {
private final LayoutInflater mInflater;
private StudentBean lastSelectBean;
public SinglePeopleAdapter(List<StudentBean> list, Context context) {
super(list, context);
if(!CheckUtil.isEmpty(mList)){
lastSelectBean = mList.get(0);
lastSelectBean.setChick(true);
}
mInflater = LayoutInflater.from(mContext);
}
public StudentBean getLastSelectBean() {
return lastSelectBean;
}
@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ItemViewHolder(mInflater.inflate(R.layout.item_single_people, parent, false));
}
@Override
public void onBindViewHolder(ItemViewHolder holder, final int position) {
final StudentBean studentBean = mList.get(position);
TextView orderText = (TextView) holder.itemView.findViewById(R.id.test_order);
orderText.setText(studentBean.getNumber());
TextView groupText = (TextView) holder.itemView.findViewById(R.id.test_group);
groupText.setText(studentBean.getClasses());
TextView nameText = (TextView) holder.itemView.findViewById(R.id.test_name);
nameText.setText(studentBean.getRealname());
TextView birthdayText = (TextView) holder.itemView.findViewById(R.id.test_birthday);
birthdayText.setText(studentBean.getBirthday());
ImageView imageView = (ImageView) holder.itemView.findViewById(R.id.chick_iv);
imageView.setImageResource(studentBean.isChick() ? R.drawable.select1_sel : R.drawable.select1_nor);
holder.itemView.findViewById(R.id.choice_lay).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StudentBean bean = null;
for (int i = 0; i < mList.size(); i++) {
if (position == i) {
bean = mList.get(i);
bean.setChick(true);
}
}
if(!bean.getNumber().equals(lastSelectBean.getNumber())) {
lastSelectBean.setChick(false);
lastSelectBean = bean;
}
notifyDataSetChanged();
}
});
}
@Override
public int getItemCount () {
return 10;
}
}
......@@ -103,9 +103,8 @@
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_20">
<RelativeLayout
android:layout_width="@dimen/item_dimen_5"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -114,6 +113,26 @@
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@color/line_color"></View>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="选择"
android:layout_centerInParent="true"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18"
android:textStyle="bold" />
<View
android:layout_alignParentRight="true"
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
......@@ -197,21 +216,6 @@
android:background="@color/line_color"></View>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ddd"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="vertical">
<include
layout="@layout/include_people"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></include>
</LinearLayout>
<TextView
android:id="@+id/begin_test"
android:layout_width="100dip"
......@@ -224,4 +228,11 @@
android:text="开始测试"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycle_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/begin_test"
android:layout_below="@+id/ddd"></android.support.v7.widget.RecyclerView>
</RelativeLayout>
\ No newline at end of file
<?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:layout_centerHorizontal="true"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/choice_lay"
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
<View
android:layout_width="1px"
android:layout_height="match_parent"
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/select1_nor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/item_dimen_5"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="@color/line_color"></View>
<TextView
android:id="@+id/test_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="2016010101"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/item_dimen_2"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/test_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="A组"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/item_dimen_3"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/test_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="欧晓迪"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@color/line_color"></View>
</RelativeLayout>
<RelativeLayout
android:layout_width="@dimen/item_dimen_4"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/test_birthday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="20160101"
android:textColor="@color/text_color"
android:textSize="@dimen/sp_18" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@color/line_color"></View>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
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