import com.ic.protocolSrv.utils.TimeUtil;
import com.ic.protocolSrv.utils.Util;
import com.ic.protocols.protocolAPIHelper;
+import com.ic.view.SOSRecView;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.locks.Condition;
}, recordtime * 1000);
return true;
} else if ("sosReceive".equals(paramStringMessage.cmd())) {
- //显示一个弹窗,然后只有按钮才可以退出
- ICLogger.d("sosReceive ... show page...");
+ SOSRecView instance = SOSRecView.getInstance();
+ instance.showMsgDialog();
}
return false;
}
import com.ic.protocolSrv.service.Deliver;
import com.ic.protocolSrv.service.HeartRateManager;
import com.ic.protocols.protocolAPIHelper;
-import com.ic.view.FindDeviceView;
+import com.ic.view.SOSRecView;
import com.ic.view.webmsgresponse.WebMsgView;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
}
}
-
-
return;
-
} else if (DIALOG_ACTION.equals(str)) {
ICLogger.d("receive DIALOG_ACTION");
if (paramIntent.hasExtra("contact")) {
this.playNotificationVoice(paramContext);
VibrateUtil.getInstance(paramContext).vibrateOn(true);
}
-
this.screenOn(paramContext);
}
} else if (paramIntent.hasExtra("findDev")) {
ICLogger.d("hasExtra(findDev)");
- String findDevTxt = paramIntent.getStringExtra("findDev");
- SharePreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false);
- isSilence = SharePreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false);
- ICLogger.d("isSilence ==> " + isSilence);
- ICLogger.d("findDevTxt ==> " + findDevTxt);
- if (findDevTxt != null && !isSilence) {
- //this.initMyDialog(paramContext, null, 5, findDevTxt, false);
- this.playFindDevVoice(paramContext);
- VibrateUtil.getInstance(paramContext).vibrateOn(true);
- this.screenOn(paramContext);
- FindDeviceView.getInstance().showMsgDialog();
- }
+ SOSRecView instance = SOSRecView.getInstance();
+ instance.showMsgDialog();
+ this.screenOn(paramContext);
+// String findDevTxt = paramIntent.getStringExtra("findDev");
+// SharePreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false);
+// isSilence = SharePreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false);
+// ICLogger.d("isSilence ==> " + isSilence);
+// ICLogger.d("findDevTxt ==> " + findDevTxt);
+// if (findDevTxt != null && !isSilence) {
+// //this.initMyDialog(paramContext, null, 5, findDevTxt, false);
+// this.playFindDevVoice(paramContext);
+// VibrateUtil.getInstance(paramContext).vibrateOn(true);
+// this.screenOn(paramContext);
+// FindDeviceView.getInstance().showMsgDialog();
+// }
} else if (paramIntent.hasExtra("takephoto")) {
String takephoto = paramIntent.getStringExtra("takephoto");
SharePreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false);
this.initMyDialog(paramContext, null, 6, takephoto, false);
this.playNotificationVoice(paramContext);
VibrateUtil.getInstance(paramContext).vibrateOn(true);
-
this.screenOn(paramContext);
}
}
-
} else if (ACTION_SET_SIT_RANGE.equals(str)) {
if (paramIntent.hasExtra(Constants.KEY_SIT_RANGE)) {
int sitrange = paramIntent.getIntExtra(Constants.KEY_SIT_RANGE, 0);
protocolgator_handler = new protocol_gator(connect, runtime);
}
}
- public void onDestroy(){
- if(protocolanan_handler!=null)
+
+ public void onDestroy() {
+ if (protocolanan_handler != null)
protocolanan_handler.unRegisterWearStateReceiver();
}
+
private static boolean is_protocol_not_Initialled() {
return (protocolbeehome_handler == null || protocoljiai_handler == null
|| protocolic_handler == null ||
ret = protocol_ic.AP00(runtime);
break;
case Config.PROTOCOL_FZD:
- ret = protocol_fzd.LK();
+ ret = protocol_fzd.LK(runtime);
break;
case Config.PROTOCOL_MQTT:
ret = protocol_mqtt.BREQ(runtime);
import com.ic.protocolSrv.bean.StringMessage;
import com.ic.protocolSrv.provider.ICDatabaseHelper;
import com.ic.protocolSrv.provider.ICFollowProvider;
+import com.ic.protocolSrv.provider.ICGlobalSettingsProvider;
import com.ic.protocolSrv.provider.ICMembersProvider;
import com.ic.protocolSrv.provider.WeTalkMessageProvider;
-import com.ic.protocolSrv.provider.ICGlobalSettingsProvider;
import com.ic.protocolSrv.service.HeartRateManager;
import com.ic.protocolSrv.utils.AlarmHelper;
import com.ic.protocolSrv.utils.CameraUtil;
ICLogger.d("not correct FZD cmd! ");
break;
}
-
-// if (cmdbuf.toString().split(CMD_COMPANY + CMD_HEADER_SPLIT).length > 1) {
-// ICLogger.d("More than 1 cmd in buffer ! just log it");
-// }
String cmdname = protocol_fzd.isCmdStr(cmd_msgbuf);
if (!cmdname.trim().isEmpty()) { //返回为非空,证明是可识别的FZD指令
for (protocol_fzd.CMD_TYPE key : protocol_fzd.cmdMap.keySet()) {
-
-// ICLogger.d("key " + protocol_fzd.cmdMap.get(key) + " " + cmdname + " cmdbuf " + cmd_msgbuf);
if (protocol_fzd.cmdMap.get(key).equals(cmdname)) { //如果是FZD命令,则进行处理,否则保留数据动
-
-// ICLogger.d("key is == > " + key);
-// if (key == CMD_TYPE.TK) {
-// handlerGroupChatVoiceContent(totalByte);
-// } else if (key == CMD_TYPE.TKOne) {
-// handlerOneChatVoiceContent(totalByte);
-// } else if (key == CMD_TYPE.TKIMG) {
-// handleImage(totalByte);
-// }
-// else
{
int cmdindexmid = cmd_msgbuf.indexOf(CMD_HEADER_SPLIT + cmdname);
String cmddata = cmd_msgbuf.substring(cmdindexmid + CMD_HEADER_SPLIT.length() + cmdname.length());
if (cmddata.startsWith(CMD_SPLIT)) cmddata = cmddata.substring(1);
-// ICLogger.d("handleCmd key " + key + " cmdname " + cmdname + " data " + cmddata);
handleCmd(key, cmdname, cmddata);
}
cmdbuf.delete(0, cmd_msgbuf.length() + 2);//处理后清空
-
break;
}
}
}
/*登录*/
- public static StringMessage LK() {
+ public static StringMessage LK(Runtime runtime) {
/*IC*YYYYYYYYYYYYYYY*LEN*LK*/
return genFZDCMD(cmdMap.get(CMD_TYPE.LK));
}
--- /dev/null
+package com.ic.view;
+
+import android.content.Context;
+import android.support.annotation.Nullable;
+import android.support.constraint.ConstraintLayout;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+
+public class EventBlockView extends ConstraintLayout {
+ private OnKeyListener mKeyListener;
+
+ public EventBlockView(Context context) {
+ super(context);
+ }
+
+ public EventBlockView(Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public EventBlockView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ public void setOnKeyListener(OnKeyListener l) {
+ super.setOnKeyListener(l);
+ this.mKeyListener = l;
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ if (mKeyListener != null) {
+ return mKeyListener.onKey(this, event.getKeyCode(), event);
+ }
+ return super.dispatchKeyEvent(event);
+ }
+
+}
+
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.packageName = context.getPackageName();
layoutParams.gravity = Gravity.CENTER;
+ layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
//加载布局
- view = View.inflate(context, R.layout.find_device_layout, null);
+ view = View.inflate(context, R.layout.sos_receive_layout, null);
+ view.setOnKeyListener((v, keyCode, event) -> {
+ //判断到按键就退出
+ ICLogger.d("on key click..." + keyCode);
+ dismiss();
+ return true;
+ });
windowManager.addView(view, layoutParams);
}
<?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.ic.view.EventBlockView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent" />
-</android.support.constraint.ConstraintLayout>
\ No newline at end of file
+</com.ic.view.EventBlockView>
\ No newline at end of file