From: snickersun Date: Thu, 12 Nov 2020 07:46:53 +0000 (+0800) Subject: release V695 X-Git-Url: http://git.snicker.com.cn/sitemap.xml?a=commitdiff_plain;h=b0271ce7a194cb736f86ab91f18a93f7f8d54b7f;p=protocol_srv.git release V695 protocol_jiai 消息未读标志设置 解决震动设置无效问题 窗口弹出会被置入后台问题。 --- diff --git a/app/release/ICSer_V692_2011112333_release.apk b/app/release/ICSer_V695_2011121531_release.apk similarity index 78% rename from app/release/ICSer_V692_2011112333_release.apk rename to app/release/ICSer_V695_2011121531_release.apk index 5975996b..00092351 100644 Binary files a/app/release/ICSer_V692_2011112333_release.apk and b/app/release/ICSer_V695_2011121531_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index e7945365..a4e240b8 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":692,"versionName":"2011112333","enabled":true,"outputFile":"ICSer_V692_2011112333_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V692_2011112333_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":695,"versionName":"2011121531","enabled":true,"outputFile":"ICSer_V695_2011121531_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V695_2011121531_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java index 980894e5..e8541bac 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java @@ -392,7 +392,7 @@ public class ContextProxy { } },50); - }else if (msgType==2){ + }else if (msgType==2) { new Handler().postDelayed(new Runnable() { @Override public void run() { @@ -407,7 +407,7 @@ public class ContextProxy { VibrateUtil.getInstance(_context).VibrateOnOnce(true); Util.mSleep(2000); } - if(Config.noBroadCastPushTxtNotify==false) { + if (Config.noBroadCastPushTxtNotify == false) { Intent intent = new Intent(ActionSrvPushTxt); intent.putExtra("msgType", msgType); //0 代表 server下发消息,1代表 SMS消息,2代表有提示音的消息 intent.putExtra("txtMsg", msg); @@ -415,8 +415,28 @@ public class ContextProxy { _context.sendBroadcast(intent); } } - },50); + }, 50); + + }else if (msgType==3){ //专门给需要回复的消息 + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + if (Config.noPushTxtNotifyDialog == false) { + Intent intent = new Intent(); + intent.setAction(DIALOG_ACTION); + intent.putExtra("pushtxt", msg); + intent.putExtra("needreply",true); + _context.sendBroadcast(intent); + } else { + WakeLockUtil.ScreenOnWakeLockTemperary(_context); + play_waning_notify(_context); + VibrateUtil.getInstance(_context).VibrateOnOnce(true); + Util.mSleep(2000); + } + } + },50); }else{ new Handler().postDelayed(new Runnable() { diff --git a/app/src/main/java/com/enqualcomm/support/utils/CustomDialog.java b/app/src/main/java/com/enqualcomm/support/utils/CustomDialog.java index 5886f016..c76545d8 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/CustomDialog.java +++ b/app/src/main/java/com/enqualcomm/support/utils/CustomDialog.java @@ -4,15 +4,19 @@ package com.enqualcomm.support.utils; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface.OnClickListener; +import android.os.Bundle; +import android.view.Display; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; +import android.view.Window; import android.widget.Button; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; +import com.enqualcomm.support.Config; import com.enqualcomm.support.R; public class CustomDialog extends Dialog { @@ -24,6 +28,7 @@ public class CustomDialog extends Dialog { super(var1, var2); } + public static class Builder { private int app_id; private View contentView; @@ -40,6 +45,17 @@ public class CustomDialog extends Dialog { this.context = var1; } + private void resizewindow(){ + if(Config.custom_name.equals("YQ")||Config.custom_name.equals("YQ_EN")) { + if(mDialog!=null) + { + Window window =mDialog.getWindow(); + ViewGroup.LayoutParams windowLayoutParams = window.getAttributes(); // 获取对话框当前的参数值 + windowLayoutParams.width = 200;//(int) (display.getWidth() * 0.7); // 宽度设置为屏幕的0.95 + windowLayoutParams.height = 200;//(int) (display.getHeight() * 0.6); // 高度设置为屏幕的0.6 + } + } + } private CustomDialog getDialogInstance() { this.mDialog = new CustomDialog(this.context, R.style.Dialog); @@ -99,6 +115,8 @@ public class CustomDialog extends Dialog { } this.mDialog.setContentView(view); + mDialog.setCanceledOnTouchOutside(false); + resizewindow(); return this.mDialog; } diff --git a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java index 1a3d0396..2ab3655e 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java @@ -90,7 +90,7 @@ public class ProcessReceiver extends BroadcastReceiver { private float y2 = 0.0F; - private void initMyDialog(final Context context, final Contact contact, int app_id,String msg) { + private void initMyDialog(final Context context, final Contact contact, int app_id,String msg,boolean needreply) { String var4 = contact==null?"SMS":contact.name; if (this.mDialog == null) { @@ -188,26 +188,32 @@ public class ProcessReceiver extends BroadcastReceiver { tmpDialog = this.mDialog.setTitle("WEB"+context.getString(R.string.sms_title)).setApp(1); StringBuilder var7 = new StringBuilder(); var7.append(msg); - mCustomDialog = tmpDialog.setMessage(var7.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface var1, int var2) { - var1.dismiss(); - VibrateUtil.getInstance(context).VibrateOn(false); - - if(CoreService.getInstance()!=null) { - Runtime runtime=CoreService.getInstance().getRuntime(); - if(Config.custom_name.equals("YQ") || Config.custom_name.equals("YQ_EN")) - { - runtime.setAlarmType(Runtime.AlarmType.ALARM_MSGREAD); - Config.setLastUnReadMessage(CoreService.getInstance(),""); - Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); - }else{ - CoreService.getInstance().getConnection().send(protocolAPIHelper.getPushTxtReadFlagToSrvMSG(runtime)); + if (needreply) { + mCustomDialog = tmpDialog.setMessage(var7.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface var1, int var2) { + var1.dismiss(); + VibrateUtil.getInstance(context).VibrateOn(false); + if (CoreService.getInstance() != null) { + Runtime runtime = CoreService.getInstance().getRuntime(); + if (Config.custom_name.equals("YQ") || Config.custom_name.equals("YQ_EN")) { + runtime.setAlarmType(Runtime.AlarmType.ALARM_MSGREAD); + Config.setLastUnReadMessage(CoreService.getInstance(), ""); + Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); + } else { + CoreService.getInstance().getConnection().send(protocolAPIHelper.getPushTxtReadFlagToSrvMSG(runtime)); + } } - } - } - }).create(); + }).create(); + }else{ + mCustomDialog = tmpDialog.setMessage(var7.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface var1, int var2) { + var1.dismiss(); + VibrateUtil.getInstance(context).VibrateOn(false); + } + }).create(); + } mCustomDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST); mCustomDialog.show(); } else if (app_id ==5) { @@ -416,7 +422,7 @@ public class ProcessReceiver extends BroadcastReceiver { isSilence = SharPreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false); if (contact != null && !isSilence) { if (!DeviceInfoUtil.isTopActivity(paramContext)) { - this.initMyDialog(paramContext, contact, 1,""); + this.initMyDialog(paramContext, contact, 1,"",false); this.playNotificationVoice(paramContext); VibrateUtil.getInstance(paramContext).VibrateOn(true); } @@ -428,21 +434,25 @@ public class ProcessReceiver extends BroadcastReceiver { SharPreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false); isSilence = SharPreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false); if (sms != null && !isSilence) { - if (!DeviceInfoUtil.isTopActivity(paramContext)) { - this.initMyDialog(paramContext, null, 3,sms); + //if (!DeviceInfoUtil.isTopActivity(paramContext)) { + this.initMyDialog(paramContext, null, 3,sms,false); this.playNotificationVoice(paramContext); VibrateUtil.getInstance(paramContext).VibrateOn(true); - } + //} this.screenOn(paramContext); } }else if (paramIntent.hasExtra("pushtxt")) { String sms = paramIntent.getStringExtra("pushtxt"); + boolean needreply=false; + if (paramIntent.hasExtra("needreply")){ + needreply= paramIntent.getBooleanExtra("needreply",false); + } SharPreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false); isSilence = SharPreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false); if (sms != null && !isSilence) { if (!DeviceInfoUtil.isTopActivity(paramContext)) { - this.initMyDialog(paramContext, null, 4, sms); + this.initMyDialog(paramContext, null, 4, sms,needreply); this.playNotificationVoice(paramContext); VibrateUtil.getInstance(paramContext).VibrateOn(true); } @@ -454,13 +464,10 @@ public class ProcessReceiver extends BroadcastReceiver { SharPreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false); isSilence = SharPreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false); if (finddevtxt != null && !isSilence) { - if (!DeviceInfoUtil.isTopActivity(paramContext)) { - this.initMyDialog(paramContext, null, 5,finddevtxt); + this.initMyDialog(paramContext, null, 5,finddevtxt,false); this.playFindDevVoice(paramContext); VibrateUtil.getInstance(paramContext).VibrateOn(true); - } - this.screenOn(paramContext); } }else if (paramIntent.hasExtra("takephoto")) { @@ -468,13 +475,11 @@ public class ProcessReceiver extends BroadcastReceiver { SharPreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false); isSilence = SharPreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false); if (takephoto != null && !isSilence) { - if (!DeviceInfoUtil.isTopActivity(paramContext)) { - this.initMyDialog(paramContext, null, 6,takephoto); + + this.initMyDialog(paramContext, null, 6,takephoto,false); this.playNotificationVoice(paramContext); VibrateUtil.getInstance(paramContext).VibrateOn(true); - } - this.screenOn(paramContext); } } diff --git a/app/src/main/java/com/enqualcomm/support/utils/Util.java b/app/src/main/java/com/enqualcomm/support/utils/Util.java index 66e29b64..56688041 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/Util.java +++ b/app/src/main/java/com/enqualcomm/support/utils/Util.java @@ -91,20 +91,29 @@ public class Util { long lasttime_inms=System.currentTimeMillis()-TimeUtil.parseDatetiime(datetime).getTime(); ICLogger.i("有消息"+lasttime_inms/1000 +"秒未读!"); - if ((lasttime_inms>=8*60*1000 && lasttime_inms<=13*60*1000) //在10分钟,20分钟时都提醒一次。 + if ((lasttime_inms>8*60*1000 && lasttime_inms<=13*60*1000) //在10分钟,20分钟时都提醒一次。 ||(lasttime_inms>18*60*1000 && lasttime_inms<=23*60*1000)) { - if (!Config.custom_name.equals("VitracK")){ - txtmsg = Util.UrlGB2312ToUTF8(txtmsg); + if (!Config.custom_name.equals("VitracK") ){ + if(Config.protocol_no==Config.PROTOCOL_JIAI){ + txtmsg=Util.decodeUnicode2Utf8(txtmsg); + }else { + txtmsg = Util.UrlGB2312ToUTF8(txtmsg); + } } if(Config.custom_name.equals("YQ") || Config.custom_name.equals("YQ_EN")) { runtime.setAlarmType(Runtime.AlarmType.ALARM_UNREADMSG); // Config.setLastUnReadMessage(CoreService.getInstance(),""); Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); + } - runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0); + runtime.getContextProxy().sendMsgBroadcast(txtmsg, 3); //需要恢复消息 + + //runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0); //不需要回复 + + } diff --git a/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java b/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java index 8baa2c7b..465f2627 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java @@ -20,7 +20,7 @@ public class VibrateUtil { private static VibrateUtil vibrateUtil=null; private static long patter_item= 1000; - private long[] patter = {patter_item, 1000, patter_item, 1000}; //1秒开,1秒关,2秒开,50ms关 + private long[] patter = { patter_item, 1000, patter_item,1000}; //1秒开,1秒关,2秒开,50ms关 private long[] patterOnce = {patter_item, 1000}; //1秒开,1秒关,2秒开,50ms关 /** @@ -33,6 +33,7 @@ public class VibrateUtil { public void VibrateOn(boolean on){ if (patter_item>0) { if (vibrator != null) { + patter = new long[]{patter_item, 1000, patter_item, 1000}; if (on) // vibrator.vibrate(patter, 0);//一直循环 vibrator.vibrate(patter, -1);//不循环 @@ -44,6 +45,7 @@ public class VibrateUtil { public void VibrateOnOnce(boolean on){ if (patter_item>0) { if (vibrator != null) { + patterOnce = new long[]{patter_item, 1000}; if (on) // vibrator.vibrate(patter, 0);//一直循环 vibrator.vibrate(patterOnce, -1);//不循环 diff --git a/app/src/main/java/com/ic/protocols/protocol_jiai.java b/app/src/main/java/com/ic/protocols/protocol_jiai.java index c1145eba..5cd8a828 100644 --- a/app/src/main/java/com/ic/protocols/protocol_jiai.java +++ b/app/src/main/java/com/ic/protocols/protocol_jiai.java @@ -1658,13 +1658,14 @@ public static StringMessage AP50(Runtime ds){ String play_time=cmdlist[5]; String vib_time=cmdlist[6]; ICLogger.i("收到服务器文本 "+txtmsg+" 序号 "+msg_index_no+" , 播放 "+play_time+" 次,震动 "+vib_time+" 次!"); + Config.setLastUnReadMessage(runtime.getContextProxy().context,txtmsg); //保存未读文档 txtmsg=Util.decodeUnicode2Utf8(txtmsg); StringMessage msg=AP93(cmdindex); //设定当前工作模式及循环频率 connection.send(msg); runtime.PushtxtMsg_srv_index=msg_index_no;//给回复AP94用 ICLogger.i("received Txt Msg "+txtmsg); - runtime.getContextProxy().sendMsgBroadcast(txtmsg,0); + runtime.getContextProxy().sendMsgBroadcast(txtmsg,3); runtime.getContextProxy().saveMstToSMSDB(txtmsg); }else{ diff --git a/app/src/main/res/layout/dialog_normal_layout.xml b/app/src/main/res/layout/dialog_normal_layout.xml index f1917ce3..9fe34467 100644 --- a/app/src/main/res/layout/dialog_normal_layout.xml +++ b/app/src/main/res/layout/dialog_normal_layout.xml @@ -17,7 +17,7 @@ android:id="@id/title" android:visibility="visible" android:layout_width="fill_parent" - android:layout_height="40.0dip" + android:layout_height="35dip" android:text="@string/title_alert" style="@style/text_18_ffffff" android:textSize="30sp" /> diff --git a/app/version_code.properties b/app/version_code.properties index 1c806fcb..b8dee782 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Wed Nov 11 23:33:52 CST 2020 -VERSION_CODE=692 +#Thu Nov 12 15:31:34 CST 2020 +VERSION_CODE=695