Skip to content

Commit

Permalink
阅后即焚消息的点击和双击
Browse files Browse the repository at this point in the history
  • Loading branch information
Hny0305Lin committed Aug 4, 2024
1 parent b445921 commit cf10ac7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ void bind(ChatUtilsForMessage message) {
// 设置消息2分钟后从数据源中删除并更新UI
messageHandler.postDelayed(burnHandler, ChatUtilsForSettings.getBurntimer()); // 延迟时间为120000毫秒,即2分钟

// 新增点击显示3秒钟文字(后续做出
messageText.setOnClickListener(v -> {
Toast.makeText(context, message.getMessage(), Toast.LENGTH_SHORT).show();
});

// 新增长按可以在2分钟内看完后手动删除密聊
messageText.setOnLongClickListener(v -> {
if (!ChatUtilsForSettings.isBurnalertdialog()) {
Expand Down Expand Up @@ -314,6 +319,11 @@ void bind(ChatUtilsForMessage message) {
// 设置消息2分钟后从数据源中删除并更新UI
messageHandler.postDelayed(burnHandler, ChatUtilsForSettings.getBurntimer()); // 延迟时间为120000毫秒,即2分钟

// 新增点击显示3秒钟文字(后续做出
messageText.setOnClickListener(v -> {
Toast.makeText(context, message.getMessage(), Toast.LENGTH_SHORT).show();
});

// 新增长按可以在2分钟内看完后手动删除密聊
messageText.setOnLongClickListener(v -> {
if (!ChatUtilsForSettings.isBurnalertdialog()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public class ChatUtilsForSettings {
private static final boolean sqlitehistorymanagerlog = true; // 控制是否启用SQLite保存存储、历史记录显示Logcat(开发者使用)
//这里设置的是阅后即焚功能相关
private static boolean burnmessage = false; // 控制是否启用阅后即焚聊天功能
private static final boolean burnshowword = false; // 控制是否启用阅后即焚文字显示(后续转为用户使用,false为不需要,true为需要点击显示3秒文字)
private static final boolean burnalertdialog = false; // 控制是否启用阅后即焚AliertDialog(开发者使用,false为长按消失消息,true为长按显示开发者信息)
private static final int burnwordshowtimer = 3000; // 控制阅后即焚阅读时间
private static final int burntimer = 120000; // 控制阅后即焚的时间(2分钟,120000.如为开发者推荐全局2秒钟,2000)
//这里设置的是跟C代码相关的,白名单获取聊天文本,当这些文本出现在串口通讯里面的时候,提取这String后者即可,期间过滤掉前者和大量串口log。
private static final String PREFIX_SERVER = " Let's start chatting, This is the content of the server:";
Expand Down Expand Up @@ -73,10 +75,14 @@ public class ChatUtilsForSettings {
//控制是否启动阅后即焚功能
public static boolean isBurnmessage() { return burnmessage; }

public static boolean isBurnshowword() { return burnshowword; }

public static boolean isBurnalertdialog() { return burnalertdialog; }

public static void setBurnmessage(boolean burnmessage) { ChatUtilsForSettings.burnmessage = burnmessage; }

public static int getBurnwordshowtimer() { return burnwordshowtimer; }

public static int getBurntimer() { return burntimer; }

//对方为星闪服务端(User)
Expand Down

0 comments on commit cf10ac7

Please sign in to comment.