-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉Alpha 1.3,临时去除新UI页面(新UI页面后续将会重新发布),修复星闪网络随机无法接收聊天信息的Bug(BETA),修复消息滚动…
…随机的Bug(消息滚动结束BETA),修复剪贴板问题(剪贴板结束BETA),新增串口日志全部获取,新增串口MAC地址打印在UI上(仅限服务板获取)
- Loading branch information
1 parent
fb9192e
commit b0f1ce5
Showing
14 changed files
with
233 additions
and
311 deletions.
There are no files selected for viewing
88 changes: 0 additions & 88 deletions
88
app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/ChatCore/ChatAdapter.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/ChatCore/ChatMessage.java
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
...in/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/ChatCore/ChatMessageQueueUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* 受Haohanyh Computer Software Products Open Source LICENSE保护 https://github.com/Hny0305Lin/LICENSE/blob/main/LICENSE */ | ||
package com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore; | ||
|
||
import android.util.Log; | ||
import android.widget.TextView; | ||
|
||
import java.util.Iterator; | ||
import java.util.Queue; | ||
|
||
/** | ||
* ChatMessageQueueUpdater 类用于更新消息队列并将其内容显示在指定的 TextView 上。 | ||
*/ | ||
public class ChatMessageQueueUpdater { | ||
private static final String TAG = "ChatMessageQueueUpdater & NLChat"; | ||
|
||
private Queue<String> messageQueue; // 消息队列 | ||
private TextView textView; // 显示消息的 TextView | ||
private String logPrefix; // 日志前缀,用于区分不同的消息队列 | ||
|
||
/** | ||
* 构造函数 | ||
* | ||
* @param messageQueue 消息队列 | ||
* @param textView 显示消息的 TextView | ||
* @param logPrefix 日志前缀 | ||
*/ | ||
public ChatMessageQueueUpdater(TextView textView, Queue<String> messageQueue, String logPrefix) { | ||
this.messageQueue = messageQueue; | ||
this.textView = textView; | ||
this.logPrefix = logPrefix; | ||
} | ||
|
||
/** | ||
* 更新 TextView 的内容,将消息队列中的所有消息显示在 TextView 上。 | ||
* 同时,移除消息队列中的空消息。 | ||
*/ | ||
public void updateTextView() { | ||
StringBuilder allMessages = new StringBuilder(); | ||
Iterator<String> iterator = messageQueue.iterator(); | ||
while (iterator.hasNext()) { | ||
String message = iterator.next(); | ||
Log.i(TAG, logPrefix + "当前队列消息内容:" + message); // 打印每个消息到日志 | ||
if (!message.trim().isEmpty()) { | ||
allMessages.append(message); | ||
} else { | ||
Log.i(TAG, logPrefix + "忽略空消息,因此消息队列无改动"); // 打印忽略空消息到日志 | ||
iterator.remove(); // 从队列中移除空消息 | ||
return; | ||
} | ||
} | ||
textView.setText(allMessages.toString()); | ||
Log.i(TAG, logPrefix + "消息队列有改动"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../com/haohanyh/linmengjia/nearlink/nlchat/fun/ChatCore/ChatSaveMessageDatabaseManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* 受Haohanyh Computer Software Products Open Source LICENSE保护 https://github.com/Hny0305Lin/LICENSE/blob/main/LICENSE */ | ||
package com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.content.Context; | ||
|
||
import com.haohanyh.linmengjia.nearlink.nlchat.fun.R; | ||
import com.haohanyh.linmengjia.nearlink.nlchat.fun.SQLite.SQLiteDataBaseAPP; | ||
|
||
public class ChatSaveMessageDatabaseManager { | ||
|
||
//调用SQLite | ||
private static SQLiteDataBaseAPP dbHelper; | ||
|
||
private Context context; | ||
|
||
public ChatSaveMessageDatabaseManager(Context context) { | ||
this.context = context; | ||
} | ||
|
||
public void saveMessageToDatabase(String timestamp, String message, String sender) { | ||
//检索是否有空消息,串口通讯时常有相关问题 | ||
if (message == null || message.trim().isEmpty()) { | ||
return; | ||
} | ||
//如果有消息再保存,上面是没消息不予保存 | ||
dbHelper.saveMessageToDatabase(message, sender, timestamp); | ||
dbHelper.saveVersionToDatabase(context.getString(R.string.app_version)); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/ChatCore/ChatUIToast.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.