|
@@ -1,6 +1,7 @@
|
|
|
package com.wdkl.callingmainnursemanager.ui.fragment;
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
+import android.os.Handler;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.v4.widget.SwipeRefreshLayout;
|
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
@@ -32,6 +33,7 @@ import com.wdkl.callingmainnursemanager.entity.MessageEvent;
|
|
|
import com.wdkl.callingmainnursemanager.entity.NurseHostListInfo;
|
|
|
import com.wdkl.callingmainnursemanager.entity.PartInfoEntity;
|
|
|
import com.wdkl.callingmainnursemanager.entity.UdpEntity;
|
|
|
+import com.wdkl.callingmainnursemanager.ui.activity.MainFragmentActivity;
|
|
|
import com.wdkl.callingmainnursemanager.util.LogUtil;
|
|
|
import com.wdkl.callingmainnursemanager.util.StringUtils;
|
|
|
import com.wdkl.callingmainnursemanager.util.UIUtils;
|
|
@@ -604,6 +606,7 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
Constants.CALLING_HOST_ID = hostId;
|
|
|
} else {
|
|
|
//挂断
|
|
|
+ ((MainFragmentActivity) getActivity()).endCalled();
|
|
|
ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
|
nurse_CallStaus.setText("");
|
|
|
UdpSendUtil.sendNurseHostHangUp(hostId);
|
|
@@ -658,7 +661,11 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
*/
|
|
|
@Override
|
|
|
public void nurseHostItemOnclick(View view, int position) {
|
|
|
- if (MyApplication.partInfoList.size() <= 0 || null == MyApplication.partInfoList.get(position)) {
|
|
|
+ if (!Constants.CALL_STATE.equals(Constants.STANDBY)) {
|
|
|
+ ToastUtil.showToast("请先取消当前呼叫");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (MyApplication.partInfoList.size() <= 0 || position >= MyApplication.partInfoList.size() || null == MyApplication.partInfoList.get(position)) {
|
|
|
return;
|
|
|
}
|
|
|
PartInfoEntity.PartInfo info = MyApplication.partInfoList.get(position);
|
|
@@ -717,16 +724,31 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
public void onMoonEvent(MessageEvent messageEvent) {
|
|
|
- if (messageEvent.getType() == Constants.EVENT_UDP2) {
|
|
|
- UdpEntity udpEntity = (UdpEntity) messageEvent.getMessage();
|
|
|
- String nurseHostID = udpEntity.getNurseHostID();
|
|
|
- if (Constants.CALLING_HOST_ID.equals(nurseHostID)) {
|
|
|
- //对方挂断
|
|
|
- ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
|
- nurse_CallStaus.setText("");
|
|
|
- CALL_STATUS = Constants.STANDBY;
|
|
|
- Constants.CALLING_HOST_ID = "";
|
|
|
- }
|
|
|
+ switch (messageEvent.getType()) {
|
|
|
+ case Constants.EVENT_UDP2:
|
|
|
+ UdpEntity udpEntity = (UdpEntity) messageEvent.getMessage();
|
|
|
+ String nurseHostID = udpEntity.getNurseHostID();
|
|
|
+ if (Constants.CALLING_HOST_ID.equals(nurseHostID)) {
|
|
|
+ //对方挂断
|
|
|
+ ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
|
+ nurse_CallStaus.setText("");
|
|
|
+ CALL_STATUS = Constants.STANDBY;
|
|
|
+ Constants.CALLING_HOST_ID = "";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case Constants.EVENT_SIP:
|
|
|
+ LogUtil.d("CallingHost", "Constants.CALL_STATE==" + Constants.CALL_STATE);
|
|
|
+ if (Constants.CALL_STATE.equals(Constants.IN_CALL)) {
|
|
|
+ ((MainFragmentActivity) getActivity()).autoCall();
|
|
|
+ } else if (Constants.CALL_STATE.equals(Constants.IN_CALLING)) {
|
|
|
+ nurse_CallStaus.setText("正在通话中...");
|
|
|
+ } else if (Constants.CALL_STATE.equals(Constants.STANDBY)) {
|
|
|
+ ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
|
+ nurse_CallStaus.setText("");
|
|
|
+ CALL_STATUS = Constants.STANDBY;
|
|
|
+ Constants.CALLING_HOST_ID = "";
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|