Skip to content

Commit

Permalink
🎉Release 1.3,对新UI页面出现串口内容添加长按打开Log说明
Browse files Browse the repository at this point in the history
  • Loading branch information
Hny0305Lin committed Jul 10, 2024
1 parent d3387e2 commit 6c59a0b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,22 @@ private class ReceivedDEBUGMessageHolder extends RecyclerView.ViewHolder {
messageText.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {

String result = messageText.getText().toString().trim();

if (result.equals(ChatUtils.getPrefixLogConnected())) {
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogConnected(), context.getString(R.string.prefixLogConnected), "推荐开始聊天", "取消显示");
} else if (result.equals(ChatUtils.getPrefixLogDisconnected())) {
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogDisconnected(), context.getString(R.string.prefixLogDisConnected), "推荐重启软件和星闪板", "取消显示");
} else if (result.equals(ChatUtils.getPrefixLogAcore())) {
//ACore暂时不写
} else if (result.startsWith(ChatUtils.getPrefixLogConnectStateChanged())) {
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogConnectStateChanged(), context.getString(R.string.prefixLogConnectStateChanged), "推荐检查", "取消显示");
} else if (result.startsWith(ChatUtils.getPrefixLogPairComplete())) {
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogPairComplete(), context.getString(R.string.prefixLogPairComplete), "推荐开始聊天", "取消显示");
}

// 在这里处理长按事件
Toast.makeText(context, "长按事件触发", Toast.LENGTH_SHORT).show();
Toast.makeText(context, messageText.getText().toString(), Toast.LENGTH_SHORT).show();

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,22 @@ public void onClick(DialogInterface dialog, int which) {
.show();
return b;
}

public static void showSerialLog(Context context, String title, String message, String positiveButtonText, String negativeButtonText) {
new AlertDialog.Builder(context, R.style.HaohanyhDialog)
.setTitle(title)
.setMessage(message)
.setCancelable(false)
.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {

}
})
.setNegativeButton(negativeButtonText, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {

}
})
.show();
}
}
22 changes: 21 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">NLChat</string>
<string name="app_package">com.haohanyh.linmengjia.nearlink.nlchat.fun</string>
<string name="app_version">1.3.190.2024.0710</string>
<string name="app_version">1.3.196.2024.0710</string>

<string name="appwarn">NLChat,浩瀚银河宗旨为用爱和魔法创造Android APP。</string>
<string name="thanks3q">友情感谢</string>
Expand Down Expand Up @@ -74,9 +74,29 @@



<string name="prefixLogConnected">
该串口提示为您设备接入的服务板,已经和客户板,通过星闪双向链接,可以开始通讯了。
\n
弹出Connected内容时,您可视为正常,当然不弹出也是正常的,因为这是您服务板接入使用后,客户板才启动的正常表现。
</string>

<string name="prefixLogDisConnected">
该串口提示为您设备接入的服务板,和客户板失去链接,故星闪链接断开。
\n
弹出此内容时,请您检查设备是否能正常链接,星闪板和设备链接的USB线接触是否正常。
</string>

<string name="prefixLogConnectStateChanged">
该串口提示为您设备接入的服务板,和客户板的链接状态发生改变。
\n
弹出此内容时,请您检查设备是否能正常链接,能正常链接则忽略,如果该内容是与Disconnected相互发送的,则链接已断开。
</string>

<string name="prefixLogPairComplete">
该串口提示为您设备接入的服务板,和客户板的链接,配对成功。
\n
弹出此内容时,请您检查设备MAC地址是否为客户板地址,能正常则忽略。
</string>



Expand Down

0 comments on commit 6c59a0b

Please sign in to comment.