|
//using System;
|
//using System.Collections.Generic;
|
//using System.Threading;
|
//using Android.App;
|
//using Android.Icu.Text;
|
//using Android.OS;
|
//using Android.Runtime;
|
//using Android.Util;
|
//using Android.Views;
|
//using Android.Widget;
|
//using HDL_ON.Common;
|
//using HDL_ON.DAL.Server;
|
//using Java.Util;
|
|
//namespace HDL_ON_Android.LeChengView.Form
|
//{
|
// public class ReverseCallFragment : Fragment, View.IOnClickListener
|
// {
|
|
// private View mView;
|
|
// private ImageView screenshotImg;// 截图
|
// private ImageView unlockImg;// 开锁
|
// private LinearLayout answerLayout; // 接听
|
// private ImageView hangupImg;// 挂断
|
// private ImageView answerImg;// 接听
|
// private TextView hangupText;
|
|
// private TextView tvTip;
|
|
// private System.Threading.Timer timer = null;
|
// private int Time = 0;
|
// private bool isAnswer;//是否已经点击接听过了
|
|
// private static LeChengVideoActivity CurtActivity;
|
|
// public override void OnCreate(Bundle savedInstanceState)
|
// {
|
// base.OnCreate(savedInstanceState);
|
|
// CurtActivity = (LeChengVideoActivity)this.Activity;
|
// }
|
|
// public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
// {
|
// mView = inflater.Inflate(Resource.Layout.fragment_call, container, false);
|
|
// IniView();
|
|
// CurtActivity.Play();
|
|
// CurtActivity.CloseAudio();
|
|
// return mView;
|
// }
|
|
// private void IniView()
|
// {
|
// screenshotImg = (ImageView)mView.FindViewById(Resource.Id.callScreenshotImg);//
|
// unlockImg = (ImageView)mView.FindViewById(Resource.Id.callUnlockImg);//
|
// tvTip = (TextView)mView.FindViewById(Resource.Id.callTipText);
|
// answerLayout = (LinearLayout)mView.FindViewById(Resource.Id.callAnswerLayout);
|
// hangupImg = (ImageView)mView.FindViewById(Resource.Id.callHangupImg);
|
// answerImg = (ImageView)mView.FindViewById(Resource.Id.callAnswerImg);
|
// hangupText = (TextView)mView.FindViewById(Resource.Id.callHangupText);
|
|
// screenshotImg.SetOnClickListener(this);
|
// unlockImg.SetOnClickListener(this);
|
// hangupImg.SetOnClickListener(this);
|
// answerImg.SetOnClickListener(this);
|
|
// hangupText.SetText(GetString(Resource.String.video_not_answer), null);
|
// tvTip.SetText(GetString(Resource.String.calling), null);
|
// }
|
|
|
// /// <summary>
|
// /// 开锁
|
// /// </summary>
|
// private void PostUnlock()
|
// {
|
// //开锁,当收到来电信息时可进行开锁操作
|
// new Thread(() =>
|
// {
|
// try
|
// {
|
// Dictionary<string, object> d = new Dictionary<string, object>();
|
// d.Add("deviceId", CurtActivity.DeviceId);//设备id
|
// string jsonString = HttpUtil.GetSignRequestJson(d);
|
|
// string url = "/home-wisdom/platform/imou/openDoorbell";
|
// ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
|
// Log.Info("LcVideo", "Post Unlock Response code=" + response.Code);
|
// }
|
// catch { }
|
|
// }).Start();
|
// }
|
|
// /// <summary>
|
// /// 开锁
|
// /// </summary>
|
// private void Unlock()
|
// {
|
// //
|
// CurtActivity.Unlock();
|
// UpdataUnlockState();
|
// }
|
|
// /// <summary>
|
// /// 更新开锁按钮状态,开锁成功,15秒内不给再点击按钮
|
// /// </summary>
|
// private void UpdataUnlockState()
|
// {
|
// try
|
// {
|
// if (unlockImg == null) return;
|
|
// unlockImg.Enabled = false;
|
|
// new Thread(() =>
|
// {
|
// Thread.Sleep(15 * 1000);
|
// Activity.RunOnUiThread(() =>
|
// {
|
// if (unlockImg != null)
|
// unlockImg.Enabled = true;
|
// });
|
// }).Start();
|
// }
|
// catch { }
|
// }
|
|
// private string GetTime(int time)
|
// {
|
|
// int m = time / 60;
|
// int s = time % 60;
|
|
// return UnitFormat(m) + ":" + UnitFormat(s);
|
|
// }
|
|
// private static string UnitFormat(int i)
|
// {
|
// string retStr = null;
|
// if (i >= 0 && i < 10)
|
// retStr = "0" + i;
|
// else
|
// retStr = "" + i;
|
// return retStr;
|
// }
|
|
// /// <summary>
|
// /// 通话记录计时器,从拉流成功开始计算时间
|
// /// </summary>
|
// public void TimeStarts()
|
// {
|
// try
|
// {
|
// if (timer != null)
|
// timer.Dispose();
|
|
// TimerCallback timerCallback = new TimerCallback(Tick);
|
// timer = new System.Threading.Timer(timerCallback, null, 0, 1000);
|
|
// }
|
// catch (Exception) { }
|
// }
|
|
// public void TimeEnd()
|
// {
|
// Time = 0;
|
|
// if (timer != null)
|
// {
|
// timer.Dispose();
|
// timer = null;
|
// }
|
// }
|
|
// public void Tick(object state)
|
// {
|
// try
|
// {
|
// Activity.RunOnUiThread(() =>
|
// {
|
// try
|
// {
|
// Time++;
|
// if (tvTip != null)
|
// tvTip.SetText(GetTime(Time), null);
|
// }
|
// catch { }
|
// });
|
// }
|
// catch { }
|
// }
|
|
// public void OnClick(View v)
|
// {
|
// if (v.Equals(answerImg))
|
// {
|
// //接收来电
|
// isAnswer = true;
|
// CurtActivity.StartTalk();
|
// answerLayout.Visibility = ViewStates.Gone;
|
// PostAnswer();
|
// }
|
// else if (v.Equals(hangupImg))
|
// {
|
// CurtActivity.StopTalk();
|
// //2021-11-30 增加拒绝和挂断操作处理
|
// if (isAnswer)
|
// {
|
// //如果接听过了,执行挂断接口
|
// PostHangup();
|
// }
|
// else
|
// {
|
// //没接听直接挂断,执行拒接接口
|
// PostReject();
|
// }
|
|
// TimeEnd();
|
// Activity.Finish();
|
// }
|
// else if (v.Equals(screenshotImg))
|
// {
|
// //有视频过来可调用此接口进行拍照
|
// screenshotImg.Selected = true;
|
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
|
// string time = format.Format(new Date(SystemClock.CurrentThreadTimeMillis()));
|
// string ss = Android.OS.Environment.ExternalStorageDirectory.Path + "/DCIM/Camera";
|
// string path = ss + "/" + time + ".jpg";
|
// CurtActivity.SnapShot(path);
|
// }
|
// else if (v.Equals(unlockImg))
|
// {
|
// CurtActivity.Unlock();
|
// }
|
// }
|
|
// /// <summary>
|
// /// post 接听电话记录
|
// /// </summary>
|
// public void PostAnswer()
|
// {
|
// new Thread(() =>
|
// {
|
// try
|
// {
|
// Dictionary<string, object> d = new Dictionary<string, object>();
|
// d.Add("callId", CurtActivity.CallId);//呼叫id
|
// d.Add("callStatus", "RECEIVED");//可用值:MISSED,RECEIVED,REJECT
|
// // d.Add("callDuration", Time);//通话时长(秒)
|
// d.Add("interphoneTypeEnum", "IMOUVISIAL");//可用值:FLVI,IMOUVISIAL
|
// string jsonString = HttpUtil.GetSignRequestJson(d);
|
|
// string url = "/home-wisdom/platform/imou/updateCallStatus";
|
// ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
|
// Log.Info("LcVideo", "Post Answer Response code=" + response.Code);
|
// }
|
// catch { }
|
|
// }).Start();
|
// }
|
|
// /// <summary>
|
// /// post 挂断电话记录
|
// /// </summary>
|
// public void PostHangup()
|
// {
|
// new Thread(() =>
|
// {
|
// try
|
// {
|
// Dictionary<string, object> d = new Dictionary<string, object>();
|
// d.Add("callId", CurtActivity.CallId);//呼叫id
|
// d.Add("callStatus", "RECEIVED");//可用值:MISSED,RECEIVED,REJECT
|
// d.Add("callDuration", Time);//通话时长(秒)
|
// d.Add("interphoneTypeEnum", "IMOUVISIAL");//可用值:FLVI,IMOUVISIAL
|
// string jsonString = HttpUtil.GetSignRequestJson(d);
|
|
// string url = "/home-wisdom/platform/imou/updateCallStatus";
|
// ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
|
// Log.Info("LcVideo", "Post Hangup Response code=" + response.Code);
|
// }
|
// catch { }
|
|
// }).Start();
|
// }
|
|
// /// <summary>
|
// /// post 拒接记录,仅只有在正常挂断状态下才提交通话时间
|
// /// </summary>
|
// public void PostReject()
|
// {
|
// new Thread(() =>
|
// {
|
// try
|
// {
|
// Dictionary<string, object> d = new Dictionary<string, object>();
|
// d.Add("callId", CurtActivity.CallId);//呼叫id
|
// d.Add("callStatus", "REJECT");//可用值:MISSED,RECEIVED,REJECT
|
// d.Add("interphoneTypeEnum", "IMOUVISIAL");//可用值:FLVI,IMOUVISIAL
|
// string jsonString = HttpUtil.GetSignRequestJson(d);
|
|
// string url = "/home-wisdom/platform/imou/updateCallStatus";
|
// ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
|
// Log.Info("LcVideo", "Post Reject Response code=" + response.Code);
|
// }
|
// catch { }
|
|
// }).Start();
|
// }
|
// }
|
//}
|