|
|
@ -1,29 +1,43 @@ |
|
|
|
package com.community.pocket.ui.main.ui.visitor; |
|
|
|
package com.community.pocket.ui.main.ui.visitor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint; |
|
|
|
import android.os.Build; |
|
|
|
import android.os.Build; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.os.Bundle; |
|
|
|
|
|
|
|
import android.os.Handler; |
|
|
|
|
|
|
|
import android.os.Looper; |
|
|
|
|
|
|
|
import android.os.Message; |
|
|
|
import android.text.Editable; |
|
|
|
import android.text.Editable; |
|
|
|
import android.text.TextWatcher; |
|
|
|
import android.text.TextWatcher; |
|
|
|
|
|
|
|
import android.util.Log; |
|
|
|
import android.view.View; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.ArrayAdapter; |
|
|
|
import android.widget.ArrayAdapter; |
|
|
|
import android.widget.AutoCompleteTextView; |
|
|
|
import android.widget.AutoCompleteTextView; |
|
|
|
import android.widget.Button; |
|
|
|
import android.widget.Button; |
|
|
|
import android.widget.EditText; |
|
|
|
import android.widget.EditText; |
|
|
|
import android.widget.Spinner; |
|
|
|
import android.widget.Spinner; |
|
|
|
|
|
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
import androidx.annotation.NonNull; |
|
|
|
import androidx.annotation.Nullable; |
|
|
|
import androidx.annotation.Nullable; |
|
|
|
import androidx.annotation.RequiresApi; |
|
|
|
import androidx.annotation.RequiresApi; |
|
|
|
|
|
|
|
import androidx.lifecycle.Observer; |
|
|
|
|
|
|
|
import androidx.lifecycle.ViewModelProvider; |
|
|
|
|
|
|
|
|
|
|
|
import com.community.pocket.R; |
|
|
|
import com.community.pocket.R; |
|
|
|
|
|
|
|
import com.community.pocket.data.adapter.VisitorAdpter; |
|
|
|
import com.community.pocket.ui.BaseFragment; |
|
|
|
import com.community.pocket.ui.BaseFragment; |
|
|
|
import com.community.pocket.ui.main.ui.forum.ShowWordCount; |
|
|
|
import com.community.pocket.ui.main.ui.forum.ShowWordCount; |
|
|
|
|
|
|
|
import com.community.pocket.util.PropertiesUtil; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.xutils.view.annotation.ContentView; |
|
|
|
import org.xutils.view.annotation.ContentView; |
|
|
|
import org.xutils.view.annotation.Event; |
|
|
|
import org.xutils.view.annotation.Event; |
|
|
|
import org.xutils.view.annotation.ViewInject; |
|
|
|
import org.xutils.view.annotation.ViewInject; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
|
|
|
|
import java.lang.reflect.Method; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -50,6 +64,16 @@ public class VisitorAppointmentFragment extends BaseFragment { |
|
|
|
|
|
|
|
|
|
|
|
private VisitorViewModel appointmentViewModel; |
|
|
|
private VisitorViewModel appointmentViewModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//AutoCompleteTextView的doBeforeTextChanged方法
|
|
|
|
|
|
|
|
private Method doBeforeTextChanged; |
|
|
|
|
|
|
|
//AutoCompleteTextView的doAfterTextChanged方法
|
|
|
|
|
|
|
|
private Method doAfterTextChanged; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//预约人数据呀
|
|
|
|
|
|
|
|
private VisitorAdpter visitorAdpter; |
|
|
|
|
|
|
|
//预约时间数据
|
|
|
|
|
|
|
|
private ArrayAdapter<String> timeAdpter; |
|
|
|
|
|
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
|
|
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
|
|
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
|
|
@ -57,138 +81,175 @@ public class VisitorAppointmentFragment extends BaseFragment { |
|
|
|
ShowWordCount showWordCount = new ShowWordCount(new int[]{R.id.show_word_top, R.id.show_word_bottom}, R.id.notes, view); |
|
|
|
ShowWordCount showWordCount = new ShowWordCount(new int[]{R.id.show_word_top, R.id.show_word_bottom}, R.id.notes, view); |
|
|
|
showWordCount.showCount(); |
|
|
|
showWordCount.showCount(); |
|
|
|
|
|
|
|
|
|
|
|
// appointmentViewModel=new ViewModelProvider(this,new VisitorAppointmentFactory()).get(VisitorViewModel.class);
|
|
|
|
appointmentViewModel = new ViewModelProvider(this, new VisitorAppointmentFactory()).get(VisitorViewModel.class); |
|
|
|
|
|
|
|
|
|
|
|
// //监听访客预约表单校验状态
|
|
|
|
//监听访客预约表单校验状态
|
|
|
|
// appointmentViewModel.getVisitorFormState().observe(getViewLifecycleOwner(), new Observer<VisitorFormState>() {
|
|
|
|
appointmentViewModel.getVisitorFormState().observe(getViewLifecycleOwner(), new Observer<VisitorFormState>() { |
|
|
|
// @Override
|
|
|
|
@Override |
|
|
|
// public void onChanged(VisitorFormState visitorFormState) {
|
|
|
|
public void onChanged(VisitorFormState visitorFormState) { |
|
|
|
// if(visitorFormState==null){
|
|
|
|
if (visitorFormState == null) { |
|
|
|
// return;
|
|
|
|
return; |
|
|
|
// }
|
|
|
|
} |
|
|
|
// submit.setEnabled(visitorFormState.isDataValid());
|
|
|
|
submit.setEnabled(visitorFormState.isDataValid()); |
|
|
|
// if(visitorFormState.getAppointmentError()!=null){
|
|
|
|
if (visitorFormState.getAppointmentError() != null) { |
|
|
|
// appointment.setError(getString(visitorFormState.getAppointmentError()));
|
|
|
|
appointment.setError(getString(visitorFormState.getAppointmentError(), PropertiesUtil.getIntValue("username.length"))); |
|
|
|
// }
|
|
|
|
} |
|
|
|
//
|
|
|
|
|
|
|
|
// if(visitorFormState.getChooseTimeError()!=null){
|
|
|
|
|
|
|
|
// Toast.makeText(getContext(),R.string.invalid_time,Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if(visitorFormState.getNotesError()!=null){
|
|
|
|
|
|
|
|
// notes.setError(getString(visitorFormState.getNotesError()));
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// //监听预约请求结果
|
|
|
|
|
|
|
|
// appointmentViewModel.getVisitorResponse().observe(getViewLifecycleOwner(), new Observer<VisitorResponse>() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void onChanged(VisitorResponse visitorResponse) {
|
|
|
|
|
|
|
|
// if(visitorResponse==null){
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(visitorResponse.getSuccess()!=null){
|
|
|
|
|
|
|
|
// Toast.makeText(getContext(),visitorResponse.getSuccess(),Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
// NavHostFragment.findNavController(VisitorAppointmentFragment.this).navigate(R.id.visitorReservationFragment);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if(visitorResponse.getError()!=null){
|
|
|
|
|
|
|
|
// Toast.makeText(getContext(),visitorResponse.getError(),Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// //检索预约人请求结果
|
|
|
|
|
|
|
|
// appointmentViewModel.getSearchPeopleReq().observe(getViewLifecycleOwner(), new Observer<VisitorResponse<List<String>>>() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void onChanged(VisitorResponse<List<String>> visitorResponse) {
|
|
|
|
|
|
|
|
// if(visitorResponse==null){
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(visitorResponse.getSuccess()!=null){
|
|
|
|
|
|
|
|
// initSearch(visitorResponse.getBody());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(visitorResponse.getError()!=null){
|
|
|
|
|
|
|
|
// Toast.makeText(getContext(),visitorResponse.getError(),Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// //检索预约人可预约时间
|
|
|
|
|
|
|
|
// appointmentViewModel.getSearchTimeReq().observe(getViewLifecycleOwner(), new Observer<VisitorResponse<List<String>>>() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void onChanged(VisitorResponse<List<String>> listVisitorResponse) {
|
|
|
|
|
|
|
|
// if(listVisitorResponse==null){
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(listVisitorResponse.getSuccess()!=null){
|
|
|
|
|
|
|
|
// initChooseTime(listVisitorResponse.getBody());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(listVisitorResponse.getError()!=null){
|
|
|
|
|
|
|
|
// Toast.makeText(getContext(),listVisitorResponse.getError(),Toast.LENGTH_LONG).show();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// appointment.addTextChangedListener(new MyTextChange() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void afterTextChanged(Editable s) {
|
|
|
|
|
|
|
|
// if(s.toString().length()>0){
|
|
|
|
|
|
|
|
// appointmentViewModel.searchPeople(s.toString());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// appointment.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
|
|
|
// appointmentViewModel.appointmentDataChanged(appointment.getText().toString(),chooseTime.getSelectedItem().toString(),notes.getText().toString());
|
|
|
|
|
|
|
|
// appointmentViewModel.searchTime(appointment.getText().toString());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// chooseTime.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
|
|
|
// appointmentViewModel.appointmentDataChanged(appointment.getText().toString(),chooseTime.getSelectedItem().toString(),notes.getText().toString());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
|
|
// public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// notes.addTextChangedListener(new MyTextChange(){});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (visitorFormState.getNotesError() != null) { |
|
|
|
|
|
|
|
notes.setError(getString(visitorFormState.getNotesError())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//监听预约请求结果
|
|
|
|
|
|
|
|
appointmentViewModel.getVisitorResponse().observe(getViewLifecycleOwner(), new Observer<VisitorResponse>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onChanged(VisitorResponse visitorResponse) { |
|
|
|
|
|
|
|
if (visitorResponse == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (visitorResponse.getSuccess() != null) { |
|
|
|
|
|
|
|
Toast.makeText(getContext(), visitorResponse.getSuccess(), Toast.LENGTH_LONG).show(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VisitorFragment visitorFragment = ((VisitorFragment) Objects.requireNonNull(getParentFragment()).getParentFragment()); |
|
|
|
|
|
|
|
Button button = Objects.requireNonNull(Objects.requireNonNull(visitorFragment).getView()).findViewById(R.id.visitor_reservation); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Method method = VisitorFragment.class.getDeclaredMethod("my", View.class); |
|
|
|
|
|
|
|
method.setAccessible(true); |
|
|
|
|
|
|
|
method.invoke(visitorFragment, button); |
|
|
|
|
|
|
|
} catch (NoSuchMethodException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (visitorResponse.getError() != null) { |
|
|
|
|
|
|
|
Toast.makeText(getContext(), visitorResponse.getError(), Toast.LENGTH_LONG).show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//检索预约人请求结果
|
|
|
|
|
|
|
|
appointmentViewModel.getSearchPeopleReq().observe(getViewLifecycleOwner(), new Observer<VisitorResponse<Map<String, List<String>>>>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onChanged(VisitorResponse<Map<String, List<String>>> visitorResponse) { |
|
|
|
|
|
|
|
if (visitorResponse == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (visitorResponse.getSuccess() != null) { |
|
|
|
|
|
|
|
initSearch(visitorResponse.getBody()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (visitorResponse.getError() != null) { |
|
|
|
|
|
|
|
Toast.makeText(getContext(), visitorResponse.getError(), Toast.LENGTH_LONG).show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appointment.addTextChangedListener(new MyTextChange() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void afterTextChanged(Editable s) { |
|
|
|
|
|
|
|
if (timeAdpter != null) { |
|
|
|
|
|
|
|
timeAdpter.clear(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (s.toString().equals(appointment.getTag(R.string.visitor_tag))) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (visitorAdpter != null && visitorAdpter.containsKey(s.toString())) { |
|
|
|
|
|
|
|
appointmentViewModel.appointmentDataChanged(appointment.getText(), notes.getText()); |
|
|
|
|
|
|
|
initTime(s); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
appointment.setTag(R.string.visitor_tag, s.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long time = System.currentTimeMillis(); |
|
|
|
|
|
|
|
//输入的字符间隔时间 小于700毫秒 移除以前的handler 延时600毫秒执行
|
|
|
|
|
|
|
|
if (appointment.getTag() != null && time - (Long) appointment.getTag() < 700) { |
|
|
|
|
|
|
|
searchHandler.removeMessages(1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
searchHandler.sendEmptyMessageDelayed(1, 600); |
|
|
|
|
|
|
|
appointment.setTag(time); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notes.addTextChangedListener(new MyTextChange() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void afterTextChanged(Editable s) { |
|
|
|
|
|
|
|
appointmentViewModel.appointmentDataChanged(appointment.getText(), notes.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//延时搜索的handler
|
|
|
|
|
|
|
|
private Handler searchHandler = new Handler(Looper.getMainLooper()) { |
|
|
|
|
|
|
|
public void handleMessage(@NotNull Message msg) { |
|
|
|
|
|
|
|
dealSearchHint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据用户输入的字符去调用接口查询预约人 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void dealSearchHint() { |
|
|
|
|
|
|
|
String searchContent = appointment.getText().toString(); |
|
|
|
|
|
|
|
if (searchContent.isEmpty()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
appointmentViewModel.searchPeople(searchContent); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("SoonBlockedPrivateApi") |
|
|
|
|
|
|
|
private void refreshDropList() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (doAfterTextChanged == null) { |
|
|
|
|
|
|
|
Class<AutoCompleteTextView> autoCompleteTextView = AutoCompleteTextView.class; |
|
|
|
|
|
|
|
doBeforeTextChanged = autoCompleteTextView.getDeclaredMethod("doBeforeTextChanged"); |
|
|
|
|
|
|
|
doBeforeTextChanged.setAccessible(true); |
|
|
|
|
|
|
|
doAfterTextChanged = autoCompleteTextView.getDeclaredMethod("doAfterTextChanged"); |
|
|
|
|
|
|
|
doAfterTextChanged.setAccessible(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// doBeforeTextChanged.invoke(appointment);
|
|
|
|
|
|
|
|
doAfterTextChanged.invoke(appointment); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
Log.e("", e.toString()); |
|
|
|
|
|
|
|
Toast.makeText(getContext(), R.string.load_data_err, Toast.LENGTH_LONG).show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 搜索框 |
|
|
|
* 搜索框 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
|
|
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
|
|
|
private void initSearch(List<String> arrays) { |
|
|
|
private void initSearch(Map<String, List<String>> arrays) { |
|
|
|
// 设置适配器
|
|
|
|
// 设置适配器
|
|
|
|
ArrayAdapter<String> adapter = new ArrayAdapter<>(Objects.requireNonNull(this.getContext()), android.R.layout.simple_list_item_1, arrays); |
|
|
|
if (visitorAdpter == null) { |
|
|
|
|
|
|
|
visitorAdpter = new VisitorAdpter(arrays, getContext()); |
|
|
|
// 将适配器与当前AutoCompleteTextView控件绑定
|
|
|
|
// 将适配器与当前AutoCompleteTextView控件绑定
|
|
|
|
appointment.setAdapter(adapter); |
|
|
|
appointment.setAdapter(visitorAdpter); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
visitorAdpter.addAll(arrays); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
refreshDropList(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
|
|
|
@RequiresApi(api = Build.VERSION_CODES.KITKAT) |
|
|
|
private void initChooseTime(List<String> arrays) { |
|
|
|
private void initTime(Editable e) { |
|
|
|
// 设置适配器
|
|
|
|
if (timeAdpter == null) { |
|
|
|
ArrayAdapter<String> adapter = new ArrayAdapter<>(Objects.requireNonNull(this.getContext()), android.R.layout.simple_list_item_1, arrays); |
|
|
|
timeAdpter = new ArrayAdapter<>(Objects.requireNonNull(getContext()), android.R.layout.simple_list_item_1, visitorAdpter.getTime(e.toString())); |
|
|
|
chooseTime.setAdapter(adapter); |
|
|
|
chooseTime.setAdapter(timeAdpter); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
timeAdpter.clear(); |
|
|
|
|
|
|
|
timeAdpter.addAll(visitorAdpter.getTime(e.toString())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|