Skip to content

Commit

Permalink
🎉Release 1.3,串口内容进行补充,添加剪贴板UI入口方便调试
Browse files Browse the repository at this point in the history
  • Loading branch information
Hny0305Lin committed Jul 11, 2024
1 parent 6c59a0b commit 8f07257
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import com.haohanyh.linmengjia.nearlink.nlchat.fun.R;

import com.haohanyh.linmengjia.nearlink.nlchat.fun.R.string;

import java.util.List;

public class ChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
Expand Down Expand Up @@ -118,15 +120,23 @@ 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), "推荐开始聊天", "取消显示");
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogConnected(), context.getString(string.prefixLogConnected), "推荐开始聊天", "取消显示", "复制进剪贴板");
} else if (result.equals(ChatUtils.getPrefixLogDisconnected())) {
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogDisconnected(), context.getString(R.string.prefixLogDisConnected), "推荐重启软件和星闪板", "取消显示");
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogDisconnected(), context.getString(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), "推荐检查", "取消显示");
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogConnectStateChanged(), context.getString(string.prefixLogConnectStateChanged), "推荐检查", "取消显示", "复制进剪贴板");
} else if (result.startsWith(ChatUtils.getPrefixLogNearlinkDevicesAddr())) {
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogNearlinkDevicesAddr(), context.getString(string.prefixLogNearlinkDevicesAddr), "推荐开始聊天", "取消显示", "复制进剪贴板");
} else if (result.startsWith(ChatUtils.getPrefixLogPairComplete())) {
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogPairComplete(), context.getString(R.string.prefixLogPairComplete), "推荐开始聊天", "取消显示");
ChatUIAlertDialog.showSerialLog(context, ChatUtils.getPrefixLogPairComplete(), context.getString(string.prefixLogPairComplete), "推荐开始聊天", "取消显示", "复制进剪贴板");
} else if (result.startsWith(ChatUtils.getPrefixLogSsapsMtuChanged())) {
//MTU暂时不写
} else if (result.startsWith(ChatUtils.getPrefixLogSleAnnounceEnableCallback())) {
//CakkBack暂时不写
} else {
//分支暂时不写
}

// 在这里处理长按事件
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ public void onClick(DialogInterface dialog, int which) {
return b;
}

public static void showSerialLog(Context context, String title, String message, String positiveButtonText, String negativeButtonText) {
/**
* 常用于ChatAdapter,展示串口内容,并做出开发者功能以助于下一步处理
* @param context 上下文,捆绑MainActivity
* @param title 标题
* @param message 捆绑R.string
* @param positiveButtonText 普遍为对话框Yes按钮
* @param negativeButtonText 普遍为对话框No按钮
* @param neutralButtonText 普通按钮,这里做剪贴板功能
*/
public static void showSerialLog(Context context, String title, String message, String positiveButtonText, String negativeButtonText, String neutralButtonText) {
new AlertDialog.Builder(context, R.style.HaohanyhDialog)
.setTitle(title)
.setMessage(message)
Expand All @@ -51,6 +60,12 @@ public void onClick(DialogInterface dialog, int which) {

}
})
.setNeutralButton(neutralButtonText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

}
})
.show();
}
}
8 changes: 6 additions & 2 deletions 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.196.2024.0710</string>
<string name="app_version">1.3.200.2024.0711</string>

<string name="appwarn">NLChat,浩瀚银河宗旨为用爱和魔法创造Android APP。</string>
<string name="thanks3q">友情感谢</string>
Expand Down Expand Up @@ -98,7 +98,11 @@
弹出此内容时,请您检查设备MAC地址是否为客户板地址,能正常则忽略。
</string>


<string name="prefixLogNearlinkDevicesAddr">
该串口提示为您的设备接入的服务板,已经获取客户端的专有MAC地址。
\n
弹出此内容时,请您检查设备是否能正常链接,能正常链接则忽略。
</string>



Expand Down

0 comments on commit 8f07257

Please sign in to comment.