From 9cd20c790938aff6a1b91e0e52547077ab239db1 Mon Sep 17 00:00:00 2001 From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674> Date: 星期三, 05 四月 2017 15:29:49 +0800 Subject: [PATCH] --- VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/PhoneCallMng.java | 2 VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/PhoneCallFragment.java | 50 +++++++++---------------- VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left_row.xml | 6 +- VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java | 27 +++++++++++++ VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/widget/phonecall/PhoneCallLeftListView.java | 3 + VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left.xml | 1 6 files changed, 50 insertions(+), 39 deletions(-) diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java index e47b8ae..f6905f3 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java @@ -3,10 +3,12 @@ import android.content.Context; import android.widget.ArrayAdapter; import android.widget.SectionIndexer; +import android.widget.TextView; import com.bsk.zhangbo.demoforbsk.R; import com.camnter.easyrecyclerview.adapter.EasyRecyclerViewAdapter; import com.camnter.easyrecyclerview.holder.EasyRecyclerViewHolder; +import com.facebook.drawee.view.SimpleDraweeView; import java.util.ArrayList; import java.util.Collections; @@ -14,9 +16,16 @@ import java.util.List; import java.util.Set; +import cn.com.basic.face.service.vo.PhoneCallFragment.PhoneCallQueryItem; + +import cn.com.basic.face.base.MainActivity; +import cn.com.basic.face.util.AppApi; + public class PhoneCallFragment { public static class PhoneCallLeftAdapter extends EasyRecyclerViewAdapter { + + private boolean isSortByDept; @Override public int[] getItemLayouts() { @@ -25,7 +34,20 @@ @Override public void onBindRecycleViewHolder(EasyRecyclerViewHolder viewHolder, int position) { - + TextView fragment_phone_call_left_row_name = viewHolder.findViewById(R.id.fragment_phone_call_left_interviewee_row_name); + TextView fragment_phone_call_left_row_dept = viewHolder.findViewById(R.id.fragment_phone_call_left_interviewee_row_dept); + if (isSortByDept) { + fragment_phone_call_left_row_name.setTextColor(MainActivity.getInstance().getResources().getColor(R.color.colorText_b)); + fragment_phone_call_left_row_dept.setTextColor(MainActivity.getInstance().getResources().getColor(R.color.colorText_5)); + } else { + fragment_phone_call_left_row_name.setTextColor(MainActivity.getInstance().getResources().getColor(R.color.colorText_5)); + fragment_phone_call_left_row_dept.setTextColor(MainActivity.getInstance().getResources().getColor(R.color.colorText_b)); + } + PhoneCallQueryItem item = getItem(position); + fragment_phone_call_left_row_name.setText(item.getName()); + fragment_phone_call_left_row_dept.setText(item.getDeptName()); + SimpleDraweeView fragment_phone_call_left_row_photo = viewHolder.findViewById(R.id.fragment_phone_call_left_row_photo); + fragment_phone_call_left_row_photo.setImageURI(AppApi.IMAGEURL_BASE+item.getImagePath()); } @Override @@ -33,6 +55,9 @@ return 0; } + public void setSortByDept(boolean isSortByDept) { + this.isSortByDept = isSortByDept; + } } public class AlphabeticalAdapter extends ArrayAdapter<String> implements SectionIndexer diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/PhoneCallFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/PhoneCallFragment.java index 9c7c5f6..6e77eb1 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/PhoneCallFragment.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/PhoneCallFragment.java @@ -1,9 +1,13 @@ 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.RadioButton; import android.widget.RadioGroup; import com.bsk.zhangbo.demoforbsk.R; @@ -42,21 +46,15 @@ private CheckInIntervieweeCell fragment_phone_call_right_interviewe_cell; @ViewInject(R.id.fragment_phone_call_left_list_view) private PhoneCallLeftListView fragment_phone_call_left_list_view; - - private CheckInLeftListViewAdapter mAdapter; - private List mList; + @ViewInject(R.id.fragment_phone_call_left_sort_by_name_radio_button) + private RadioButton fragment_phone_call_left_sort_by_name_radio_button; + @ViewInject(R.id.fragment_phone_call_left_search) + private EditText fragment_phone_call_left_search; public View addLeftLayout() { fragment_phone_call_left = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_phone_call_left,null); ViewUtils.inject(this, fragment_phone_call_left); fragment_phone_call_left_list_view.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false)); - mAdapter = new CheckInLeftListViewAdapter(getActivity(),Constant.CheckIn.VISITOR_ROW); - - fragment_phone_call_left_sort_type_linear_layout.setVisibility(View.VISIBLE); - mAdapter = new CheckInLeftListViewAdapter(getActivity(), Constant.CheckIn.INTERVIEWEE_ROW); - mAdapter.set_fragment_check_in_left_sort_radio_group_type(CheckInLeftListViewAdapter.TYPE_NAME); - mAdapter.setList(mList); - fragment_phone_call_left_list_view.setAdapter(mAdapter); return fragment_phone_call_left; } @@ -71,19 +69,13 @@ fragment_phone_call_left_sort_radio_group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { - switch (radioGroup.getCheckedRadioButtonId()){ - case R.id.fragment_phone_call_left_sort_by_name_radio_button: - mAdapter.set_fragment_check_in_left_sort_radio_group_type(CheckInLeftListViewAdapter.TYPE_NAME); - mAdapter.setList(mList); - fragment_phone_call_left_list_view.setAdapter(mAdapter); - break; - case R.id.fragment_phone_call_left_sort_by_dept_radio_button: - mAdapter.set_fragment_check_in_left_sort_radio_group_type(CheckInLeftListViewAdapter.TYPE_DEPARTMENT); - mAdapter.setList(mList); - fragment_phone_call_left_list_view.setAdapter(mAdapter); - break; - } + loadLeftList(); } + }); + fragment_phone_call_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) { loadLeftList(); } }); } @@ -92,19 +84,13 @@ public void setMenuVisibility(boolean menuVisible) { super.setMenuVisibility(menuVisible); if (menuVisible && fragment_phone_call_left_list_view != null) { - PhoneCallMng.getInstance().findPhoneCallLeftList(true, ""); + loadLeftList(); } } - protected void initData() { -// mList = new ArrayList(); -// for (int i=0;i<3;i++){ -// cn.com.basic.face.service.vo.PhoneCallFragment.PhoneCallQueryItem item = -// new cn.com.basic.face.service.vo.PhoneCallFragment.PhoneCallQueryItem(); -// mList.add(item); -// } -// mAdapter.setList(mList); -// fragment_phone_call_left_list_view.setAdapter(mAdapter); + public void loadLeftList() { + PhoneCallMng.getInstance().findPhoneCallLeftList(!fragment_phone_call_left_sort_by_name_radio_button.isChecked(), + fragment_phone_call_left_search.getText().toString()); } @OnClick(R.id.fragment_phone_call_left_back) diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/PhoneCallMng.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/PhoneCallMng.java index ba7e38c..cc7bf70 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/PhoneCallMng.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/PhoneCallMng.java @@ -29,7 +29,7 @@ public void success() { List<PhoneCallQueryItem> list = getList(PhoneCallQueryItem.class); sort(list, isSortByDept); - PhoneCallFragment.getInstance().get_fragment_phone_call_left_list_view().show(list); + PhoneCallFragment.getInstance().get_fragment_phone_call_left_list_view().show(isSortByDept, list); } }); } diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/widget/phonecall/PhoneCallLeftListView.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/widget/phonecall/PhoneCallLeftListView.java index ca48c07..3acd31b 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/widget/phonecall/PhoneCallLeftListView.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/widget/phonecall/PhoneCallLeftListView.java @@ -36,9 +36,10 @@ initView(); } - public void show(List<PhoneCallFragment.PhoneCallQueryItem> list) { + public void show(boolean isSortByDept, List<PhoneCallFragment.PhoneCallQueryItem> list) { phoneCallLeftAdapter.setList(list); setAdapter(phoneCallLeftAdapter); + phoneCallLeftAdapter.setSortByDept(isSortByDept); } } diff --git a/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left.xml b/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left.xml index cdd9390..79dd768 100644 --- a/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left.xml +++ b/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left.xml @@ -38,7 +38,6 @@ android:id="@+id/fragment_phone_call_left_sort_type_linear_layout" android:orientation="horizontal" android:gravity="center" - android:visibility="gone" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView diff --git a/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left_row.xml b/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left_row.xml index 5bf4354..a5fc408 100644 --- a/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left_row.xml +++ b/VisitFace/DemoForBsk/app/src/main/res/layout/fragment_phone_call_left_row.xml @@ -17,7 +17,7 @@ android:id="@+id/fragment_phone_call_left_interviewee_row_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="11" + android:text="" android:layout_centerVertical="true" android:textSize="@dimen/text_size_big" android:textColor="@color/colorText_b"/> @@ -25,14 +25,14 @@ android:id="@+id/fragment_phone_call_left_interviewee_row_dept" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="12" + android:text="" android:layout_centerVertical="true" android:layout_toRightOf="@id/fragment_phone_call_left_interviewee_row_name" android:layout_marginLeft="20dp" android:textSize="@dimen/text_size_big" android:textColor="@color/colorText_5"/> <com.facebook.drawee.view.SimpleDraweeView - android:id="@+id/fragment_phone_call_left_interviewee_row_photo" + android:id="@+id/fragment_phone_call_left_row_photo" android:layout_width="36dp" android:layout_height="36dp" fresco:roundAsCircle = "true" -- Gitblit v1.8.0