Commit 4e83b2ee by chengxiuhong

test main

parent a3e0beeb
......@@ -142,7 +142,7 @@ public class MorePeopleTestActivity extends BaseActivity {
ColorDrawable cd = new ColorDrawable(0x00ffffff);// 背景颜色全透明
popupWindow.setBackgroundDrawable(cd);
ListView listView = (ListView) conview.findViewById(R.id.list_view);
listView.setAdapter(new PopuAdapter(this));
listView.setAdapter(new PopuAdapter(this,null));
int[] location = new int[2];
view.getLocationOnScreen(location);
// popupWindow.setAnimationStyle(R.style.style_pop_animation);// 动画效果必须放在showAsDropDown()方法上边,否则无效
......
package com.oo.eye.activity;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.app.baselibrary.base.common.BaseActivity;
import com.oo.eye.EyeConfig;
import com.oo.eye.R;
import com.oo.eye.adapter.PopuAdapter;
import com.oo.eye.bean.StudentBean;
import java.util.ArrayList;
......@@ -22,6 +29,10 @@ import butterknife.OnClick;
public class SinglePeopleTestActivity extends BaseActivity {
@BindView(R.id.begin_test)
TextView mBeginTest;
@BindView(R.id.selete_area_tv)
TextView mSeleteAreaTv;
@BindView(R.id.selete_area_lay)
LinearLayout mSeleteAreaLay;
@Override
protected int getLayoutId() {
......@@ -39,13 +50,46 @@ public class SinglePeopleTestActivity extends BaseActivity {
ButterKnife.bind(this);
}
@OnClick(R.id.begin_test)
public void onClick() {
@OnClick({R.id.selete_area_lay, R.id.do_search, R.id.begin_test})
public void onClick(View view) {
switch (view.getId()) {
case R.id.selete_area_lay:
showPopWindow();
break;
case R.id.do_search:
break;
case R.id.begin_test:
ArrayList<StudentBean> list = new ArrayList<>();
StudentBean student = new StudentBean();
student.setRealname("游客");
list.add(student);
EyeConfig.getInstance().setStudents(list);
startActivity(BeforeEyeTestActivity.class);
break;
}
}
private void showPopWindow() {
try {
View conview = View.inflate(this, R.layout.popu_list, null);
PopupWindow popupWindow = new PopupWindow(conview, RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(true);
ColorDrawable cd = new ColorDrawable(0x00ffffff);// 背景颜色全透明
popupWindow.setBackgroundDrawable(cd);
ListView listView = (ListView) conview.findViewById(R.id.list_view);
listView.setAdapter(new PopuAdapter(this,null));
int[] location = new int[2];
mSeleteAreaLay.getLocationOnScreen(location);
// popupWindow.setAnimationStyle(R.style.style_pop_animation);// 动画效果必须放在showAsDropDown()方法上边,否则无效
conview.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int xoff = -(conview.getMeasuredWidth() / 2 - mSeleteAreaLay.getWidth() / 2);
popupWindow.showAsDropDown(mSeleteAreaLay, xoff, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
......@@ -142,7 +142,7 @@ public class TestResurtListActivity extends BaseActivity {
ColorDrawable cd = new ColorDrawable(0x00ffffff);// 背景颜色全透明
popupWindow.setBackgroundDrawable(cd);
ListView listView = (ListView) conview.findViewById(R.id.list_view);
listView.setAdapter(new PopuAdapter(this));
listView.setAdapter(new PopuAdapter(this,null));
int[] location = new int[2];
view.getLocationOnScreen(location);
// popupWindow.setAnimationStyle(R.style.style_pop_animation);// 动画效果必须放在showAsDropDown()方法上边,否则无效
......
......@@ -10,6 +10,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.oo.eye.R;
import com.oo.eye.bean.PopuBean;
import java.util.ArrayList;
import java.util.List;
/**
* Date : 2018/8/31.
......@@ -18,9 +22,15 @@ import com.oo.eye.R;
public class PopuAdapter extends BaseAdapter {
private Context mContext;
public PopuAdapter(Context context){
mContext=context;
private List<PopuBean> mBeanList = new ArrayList<>();
public PopuAdapter(Context context, List<PopuBean> beans) {
mContext = context;
if (beans != null) {
mBeanList = beans;
}
}
@Override
public int getCount() {
return 6;
......@@ -42,6 +52,13 @@ public class PopuAdapter extends BaseAdapter {
View view = inflater.inflate(R.layout.item_popu_more, null);
final TextView textView = (TextView) view.findViewById(R.id.name_tv);
ImageView imageView = (ImageView) view.findViewById(R.id.choice_tv);
// PopuBean bean=mBeanList.get(position);
// if (bean.isChick()){
// imageView.setVisibility(View.VISIBLE);
// imageView.setImageResource(R.drawable.selectitem);
// }else {
// imageView.setVisibility(View.INVISIBLE);
// }
// textView.setText(data[position]);
return view;
}
......
......@@ -3,6 +3,7 @@ package com.oo.eye.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;
import com.app.baselibrary.recycler.adapter.BaseRecyclerViewAdapter;
import com.app.baselibrary.recycler.itemholder.ItemViewHolder;
......@@ -17,8 +18,9 @@ import java.util.List;
* Author: cxh
*/
public class TestListAdapter extends BaseRecyclerViewAdapter<StudentBean,ItemViewHolder>{
public class TestListAdapter extends BaseRecyclerViewAdapter<StudentBean, ItemViewHolder> {
private final LayoutInflater mInflater;
public TestListAdapter(List<StudentBean> list, Context context) {
super(list, context);
mInflater = LayoutInflater.from(mContext);
......@@ -31,7 +33,8 @@ public class TestListAdapter extends BaseRecyclerViewAdapter<StudentBean,ItemVie
@Override
public void onBindViewHolder(ItemViewHolder holder, int position) {
TextView testOrder = (TextView) holder.itemView.findViewById(R.id.test_order);
testOrder.setText((position + 1) + "");
}
......
package com.oo.eye.bean;
import com.app.baselibrary.bean.BaseBean;
/**
* Date : 2018/9/4.
* Author: cxh
*/
public class PopuBean extends BaseBean {
private String name;
private boolean isChick;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isChick() {
return isChick;
}
public void setChick(boolean chick) {
isChick = chick;
}
}
......@@ -20,6 +20,34 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_70"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/selete_area_lay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/selete_area_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="黄冈校区22323"
android:textColor="@color/white"
android:textSize="@dimen/sp_18" />
<ImageView
android:id="@+id/selete_area_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_6"
android:src="@drawable/more" />
</LinearLayout>
<LinearLayout
android:layout_marginLeft="@dimen/dp_20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -59,6 +87,7 @@
android:textColor="@color/indicator_color"
android:textSize="@dimen/sp_18" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
......
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