|
|
|
@ -41,15 +41,17 @@ public class DoctorActivity extends BaseActivity { |
|
|
|
|
private DoctorAdapter doctorAdapter; |
|
|
|
|
private int startNum = 0; |
|
|
|
|
private int endNum = 10; |
|
|
|
|
private int numberOfColumns=4; |
|
|
|
|
private int numberOfColumns = 4; |
|
|
|
|
private int selectPostion = 0;//当前列表item点击位置
|
|
|
|
|
private EditText et_search; |
|
|
|
|
private Handler handler = new Handler(); |
|
|
|
|
List<GetNearDoctorApi.DoctorInfo.MemberBean> list=new ArrayList<>(); |
|
|
|
|
public static void StartActivity(Context context){ |
|
|
|
|
Intent intent=new Intent(context, DoctorActivity.class); |
|
|
|
|
List<GetNearDoctorApi.DoctorInfo.MemberBean> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
public static void StartActivity(Context context) { |
|
|
|
|
Intent intent = new Intent(context, DoctorActivity.class); |
|
|
|
|
context.startActivity(intent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
@ -60,12 +62,12 @@ public class DoctorActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void initView(){ |
|
|
|
|
et_search=findViewById(R.id.et_search); |
|
|
|
|
public void initView() { |
|
|
|
|
et_search = findViewById(R.id.et_search); |
|
|
|
|
et_search.setOnFocusChangeListener(new View.OnFocusChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onFocusChange(View view, boolean b) { |
|
|
|
|
InputKeyBoardUtils.show(DoctorActivity.this,view,b); |
|
|
|
|
InputKeyBoardUtils.show(DoctorActivity.this, view, b); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
et_search.addTextChangedListener(new TextWatcher() { |
|
|
|
@ -85,27 +87,28 @@ public class DoctorActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
recyclerView=findViewById(R.id.recyclerView); |
|
|
|
|
recyclerView = findViewById(R.id.recyclerView); |
|
|
|
|
recyclerView.requestFocus(); |
|
|
|
|
MyGridLayoutManager gridLayoutManager= new MyGridLayoutManager(DoctorActivity.this,numberOfColumns); |
|
|
|
|
MyGridLayoutManager gridLayoutManager = new MyGridLayoutManager(DoctorActivity.this, numberOfColumns); |
|
|
|
|
gridLayoutManager.setUpView(et_search); |
|
|
|
|
recyclerView.setLayoutManager(gridLayoutManager); |
|
|
|
|
doctorAdapter =new DoctorAdapter(R.layout.item_type_doctor_layout,list, new OnChildClickListener() { |
|
|
|
|
doctorAdapter = new DoctorAdapter(R.layout.item_type_doctor_layout, list, new OnChildClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public <T> void onChildClick(View view, int position, T data) { |
|
|
|
|
selectPostion = position; |
|
|
|
|
GetNearDoctorApi.DoctorInfo.MemberBean memberBean= (GetNearDoctorApi.DoctorInfo.MemberBean) data; |
|
|
|
|
GetNearDoctorApi.DoctorInfo.MemberBean memberBean = (GetNearDoctorApi.DoctorInfo.MemberBean) data; |
|
|
|
|
if (memberBean.isLast()) { |
|
|
|
|
startNum = startNum + endNum; |
|
|
|
|
loadData(0); |
|
|
|
|
} else { |
|
|
|
|
DoctorDetailActivity.StartActivity(DoctorActivity.this,memberBean.getPersoninfo().get(0).getUseraccount()); |
|
|
|
|
DoctorDetailActivity.StartActivity(DoctorActivity.this, memberBean.getPersoninfo().get(0).getUseraccount()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
recyclerView.setAdapter(doctorAdapter); |
|
|
|
|
recyclerView.addItemDecoration(new LinearSpacingItemDecoration(DoctorActivity.this,14)); |
|
|
|
|
recyclerView.addItemDecoration(new LinearSpacingItemDecoration(DoctorActivity.this, 14)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Runnable searchRunnable = new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
@ -129,7 +132,8 @@ public class DoctorActivity extends BaseActivity { |
|
|
|
|
@Override |
|
|
|
|
public void onSucceed(HttpData<ApiResponse<GetNearDoctorApi.DoctorInfo>> stringHttpData) { |
|
|
|
|
LogUtils.e("成功:" + stringHttpData); |
|
|
|
|
if (stringHttpData.getData().getCode() == 200) { |
|
|
|
|
if (stringHttpData.isRequestSucceed()) { |
|
|
|
|
if (stringHttpData.getData().isInnerRequestSucceed()) { |
|
|
|
|
List<GetNearDoctorApi.DoctorInfo.MemberBean> doctorInfo = stringHttpData.getData().getData().getMember(); |
|
|
|
|
if (doctorInfo == null) { |
|
|
|
|
return; |
|
|
|
@ -146,7 +150,6 @@ public class DoctorActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
|
doctorAdapter.notifyDataSetChanged(); |
|
|
|
|
if (type == 0) { |
|
|
|
|
recyclerView.requestFocus(); |
|
|
|
|
recyclerView.post(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
@ -155,7 +158,6 @@ public class DoctorActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
View view = recyclerView.getLayoutManager().findViewByPosition(selectPostion); |
|
|
|
|
if (view != null) { |
|
|
|
|
recyclerView.requestFocus(); |
|
|
|
|
view.requestFocus(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -163,6 +165,8 @@ public class DoctorActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|