| | |
| | | package cn.com.basic.face.fragment;
|
| | |
|
| | | import android.support.v7.widget.LinearLayoutManager;
|
| | | import android.text.Editable;
|
| | | import android.text.TextWatcher;
|
| | | import android.view.LayoutInflater;
|
| | | import android.view.View;
|
| | | import android.widget.EditText;
|
| | | import android.widget.LinearLayout;
|
| | | import android.widget.TextView;
|
| | | import android.widget.Toast;
|
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import cn.com.basic.face.adapter.VisitLeftAdapter;
|
| | | import cn.com.basic.face.adapter.VisitFragment.VisitLeftAdapter;
|
| | | import cn.com.basic.face.base.LeftRightBaseFragment;
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.service.VisitMng;
|
| | | import cn.com.basic.face.widget.visit.VisitLeftListView;
|
| | |
|
| | | import com.camnter.easyrecyclerview.holder.EasyRecyclerViewHolder;
|
| | | import com.camnter.easyrecyclerview.widget.EasyRecyclerView;
|
| | | import com.lidroid.xutils.ViewUtils;
|
| | | import com.lidroid.xutils.view.annotation.ViewInject;
|
| | | import com.lidroid.xutils.view.annotation.event.OnClick;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * Created by Sinoe on 2017/2/23.
|
| | | */
|
| | | public class VisitFragment extends LeftRightBaseFragment {
|
| | | private static VisitFragment instance = new VisitFragment();
|
| | | public static VisitFragment getInstance(){ return instance; }
|
| | |
|
| | | public class VisitFragment extends LeftRightBaseFragment implements EasyRecyclerViewHolder.OnItemClickListener{
|
| | | private View mViewLeft,mViewRight;
|
| | | private LinearLayout mRowLayout1,mRowLayout2,mRowLayout3,mRowLayout4,mRowLayout5,mRowLayout6,mRowLayout7;
|
| | | private TextView mRow1TextViewLeft,mRow1TextViewRight,mRow2TextViewLeft,mRow2TextViewRight,mRow3TextViewLeft,mRow3TextViewRight,mRow4TextViewLeft,mRow4TextViewRight,
|
| | | mRow5TextViewLeft,mRow5TextViewRight,mRow6TextViewLeft,mRow6TextViewRight,mRow7TextViewLeft,mRow7TextViewRight;
|
| | | private VisitLeftAdapter mAdapter;
|
| | | private EasyRecyclerView mRecyclerView;
|
| | | private int mOldPosition = 0,mNewPosition = 0;
|
| | | public static VisitFragment newInstance(){
|
| | | return new VisitFragment();
|
| | | @ViewInject(R.id.fragment_visit_left_list_view)
|
| | | private VisitLeftListView fragment_visit_left_list_view;
|
| | | @ViewInject(R.id.fragment_visit_left_search)
|
| | | private EditText fragment_visit_left_search;
|
| | |
|
| | | @ViewInject(R.id.fragment_visit_right_gender)
|
| | | private TextView fragment_visit_right_gender;
|
| | | @ViewInject(R.id.fragment_visit_right_phone)
|
| | | private TextView fragment_visit_right_phone;
|
| | | @ViewInject(R.id.fragment_visit_right_name)
|
| | | private TextView fragment_visit_right_name;
|
| | | @ViewInject(R.id.fragment_visit_right_id_type)
|
| | | private TextView fragment_visit_right_id_type;
|
| | | @ViewInject(R.id.fragment_visit_right_country)
|
| | | private TextView fragment_visit_right_country;
|
| | | @ViewInject(R.id.fragment_visit_right_id_num)
|
| | | private TextView fragment_visit_right_id_num;
|
| | | @ViewInject(R.id.fragment_visit_right_birthday)
|
| | | private TextView fragment_visit_right_birthday;
|
| | | @ViewInject(R.id.fragment_visit_right_company)
|
| | | private TextView fragment_visit_right_company;
|
| | | @ViewInject(R.id.fragment_visit_right_person)
|
| | | private TextView fragment_visit_right_person;
|
| | | @ViewInject(R.id.fragment_visit_right_visit_reason)
|
| | | private TextView fragment_visit_right_visit_reason;
|
| | | @ViewInject(R.id.fragment_visit_right_from_dept)
|
| | | private TextView fragment_visit_right_from_dept;
|
| | | @ViewInject(R.id.fragment_visit_right_status)
|
| | | private TextView fragment_visit_right_status;
|
| | | @ViewInject(R.id.fragment_visit_right_visit_time)
|
| | | private TextView fragment_visit_right_visit_time;
|
| | | @ViewInject(R.id.fragment_visit_right_exit_time)
|
| | | private TextView fragment_visit_right_exit_time;
|
| | |
|
| | | public int[] getLeftRightLayoutIds() {
|
| | | return new int[]{R.layout.fragment_visit_left, R.layout.fragment_visit_right};
|
| | | }
|
| | |
|
| | | public View addLeftLayout() {
|
| | | mViewLeft = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_visit_left,null);
|
| | | mRecyclerView = (EasyRecyclerView) mViewLeft.findViewById(R.id.visitor_manager_recycler);
|
| | | LinearLayoutManager manager = new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false);
|
| | | mRecyclerView.setLayoutManager(manager);
|
| | | mAdapter = new VisitLeftAdapter();
|
| | | ViewUtils.inject(this, mViewLeft);
|
| | | return mViewLeft;
|
| | | }
|
| | |
|
| | | public View addRightLayout() {
|
| | | mViewRight = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_visit_right,null);
|
| | | mRowLayout1 = (LinearLayout) mViewRight.findViewById(R.id.visitor_manager_row1);
|
| | | mRowLayout2 = (LinearLayout) mViewRight.findViewById(R.id.visitor_manager_row2);
|
| | | mRowLayout3 = (LinearLayout) mViewRight.findViewById(R.id.visitor_manager_row3);
|
| | | mRowLayout4 = (LinearLayout) mViewRight.findViewById(R.id.visitor_manager_row4);
|
| | | mRowLayout5 = (LinearLayout) mViewRight.findViewById(R.id.visitor_manager_row5);
|
| | | mRowLayout6 = (LinearLayout) mViewRight.findViewById(R.id.visitor_manager_row6);
|
| | | mRowLayout7 = (LinearLayout) mViewRight.findViewById(R.id.visitor_manager_row7);
|
| | |
|
| | | mRow1TextViewLeft = (TextView) mRowLayout1.findViewById(R.id.visitor_manager_row_title_left);
|
| | | mRow1TextViewRight = (TextView) mRowLayout1.findViewById(R.id.visitor_manager_row_title_right);
|
| | | mRow1TextViewLeft.setText(R.string.title_name);
|
| | | mRow1TextViewRight.setText(R.string.title_phone);
|
| | |
|
| | | mRow2TextViewLeft = (TextView) mRowLayout2.findViewById(R.id.visitor_manager_row_title_left);
|
| | | mRow2TextViewRight = (TextView) mRowLayout2.findViewById(R.id.visitor_manager_row_title_right);
|
| | | mRow2TextViewLeft.setText(R.string.title_sex);
|
| | | mRow2TextViewRight.setText(R.string.title_idClass);
|
| | |
|
| | | mRow3TextViewLeft = (TextView) mRowLayout3.findViewById(R.id.visitor_manager_row_title_left);
|
| | | mRow3TextViewRight = (TextView) mRowLayout3.findViewById(R.id.visitor_manager_row_title_right);
|
| | | mRow3TextViewLeft.setText(R.string.title_nation);
|
| | | mRow3TextViewRight.setText(R.string.title_idNumber);
|
| | |
|
| | | mRow4TextViewLeft = (TextView) mRowLayout4.findViewById(R.id.visitor_manager_row_title_left);
|
| | | mRow4TextViewRight = (TextView) mRowLayout4.findViewById(R.id.visitor_manager_row_title_right);
|
| | | mRow4TextViewLeft.setText(R.string.title_birthday);
|
| | | mRow4TextViewRight.setText(R.string.title_companyName);
|
| | |
|
| | | mRow5TextViewLeft = (TextView) mRowLayout5.findViewById(R.id.visitor_manager_row_title_left);
|
| | | mRow5TextViewRight = (TextView) mRowLayout5.findViewById(R.id.visitor_manager_row_title_right);
|
| | | mRow5TextViewLeft.setText(R.string.title_visitor);
|
| | | mRow5TextViewRight.setText(R.string.title_visitor_thing);
|
| | |
|
| | | mRow6TextViewLeft = (TextView) mRowLayout6.findViewById(R.id.visitor_manager_row_title_left);
|
| | | mRow6TextViewRight = (TextView) mRowLayout6.findViewById(R.id.visitor_manager_row_title_right);
|
| | | mRow6TextViewLeft.setText(R.string.title_visitor_department);
|
| | | mRow6TextViewRight.setText(R.string.title_visitor_state);
|
| | |
|
| | | mRow7TextViewLeft = (TextView) mRowLayout7.findViewById(R.id.visitor_manager_row_title_left);
|
| | | mRow7TextViewRight = (TextView) mRowLayout7.findViewById(R.id.visitor_manager_row_title_right);
|
| | | mRow7TextViewLeft.setText(R.string.title_visitor_start_time);
|
| | | mRow7TextViewRight.setText(R.string.title_visitor_end_time);
|
| | | return mViewRight;
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void initListeners() {
|
| | | mAdapter.setOnItemClickListener(this);
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void initData() {
|
| | | List list = new ArrayList();
|
| | | for (int i = 0;i<20;i++){
|
| | | list.add("");
|
| | | }
|
| | | mAdapter.setList(list);
|
| | | mRecyclerView.setAdapter(mAdapter);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void onItemClick(View convertView, int position) {
|
| | | if (position ==0 ||position ==3 ||position ==8){
|
| | |
|
| | | }else {
|
| | | mNewPosition = position;
|
| | | mAdapter.checkItemShow(mOldPosition,mNewPosition);
|
| | | mOldPosition = mNewPosition;
|
| | | mAdapter.getItem(position);
|
| | | Toast.makeText(getActivity(),position+"",Toast.LENGTH_SHORT).show();
|
| | | // Log.e("aaaaaaaaaaaaaaaaaa",position+"");
|
| | | //// ((CheckBox)mRecyclerView.getChildAt(position).findViewById(R.id.item_visitor_info_check)).setChecked(true);
|
| | | // CheckBox checkBox = (CheckBox) mRecyclerView.getChildAt(position).findViewById(R.id.item_visitor_info_check);
|
| | | // checkBox.setChecked(true);
|
| | | }
|
| | | }
|
| | |
|
| | | @OnClick(R.id.visitor_manager_back)
|
| | | @OnClick(R.id.fragment_visit_left_back)
|
| | | public void back(View view) {
|
| | | MainActivity.selectPage(0);
|
| | | }
|
| | |
|
| | | public VisitLeftListView get_fragment_visit_left_list_view() {
|
| | | return fragment_visit_left_list_view;
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void initListeners() {
|
| | | super.initListeners();
|
| | | fragment_visit_left_search.addTextChangedListener(new TextWatcher() {
|
| | | public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
| | | public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
| | | public void afterTextChanged(Editable editable) { reloadList(); }
|
| | | });
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void setMenuVisibility(boolean menuVisible) {
|
| | | super.setMenuVisibility(menuVisible);
|
| | | if (menuVisible && fragment_visit_left_list_view != null) {
|
| | | reloadList();
|
| | | }
|
| | | }
|
| | |
|
| | | private void reloadList() {
|
| | | VisitMng.getInstance().findLeftVisitorList(fragment_visit_left_search.getText().toString());
|
| | | }
|
| | |
|
| | | public void setVisitInfo(cn.com.basic.face.service.vo.VisitFragment.VisitQueryItem item) {
|
| | | fragment_visit_right_name.setText(item.getName());
|
| | | fragment_visit_right_phone.setText(item.getPhone());
|
| | | fragment_visit_right_gender.setText("");
|
| | | fragment_visit_right_id_type.setText("");
|
| | | fragment_visit_right_country.setText("");
|
| | | fragment_visit_right_id_num.setText(item.getIdentify());
|
| | | fragment_visit_right_birthday.setText("");
|
| | | fragment_visit_right_company.setText(item.getCompanyName());
|
| | | fragment_visit_right_person.setText("");
|
| | | fragment_visit_right_visit_reason.setText("");
|
| | | fragment_visit_right_from_dept.setText("");
|
| | | fragment_visit_right_status.setText("");
|
| | | fragment_visit_right_visit_time.setText("");
|
| | | fragment_visit_right_exit_time.setText("");
|
| | | }
|
| | | }
|