Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Simple-Sms
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangchengbo
Simple-Sms
Commits
99ffcf0a
Commit
99ffcf0a
authored
Nov 20, 2025
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:1.长按桌面Icon[日志导出]功能 2.添加Log日志输出,便于统计
parent
8fd79a0e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
22 deletions
+26
-22
MainActivity.kt
...c/main/kotlin/com/secspace/sms/activities/MainActivity.kt
+0
-0
SettingsActivity.kt
...in/kotlin/com/secspace/sms/activities/SettingsActivity.kt
+3
-0
ThreadActivity.kt
...main/kotlin/com/secspace/sms/activities/ThreadActivity.kt
+6
-3
ConversationsAdapter.kt
.../kotlin/com/secspace/sms/adapters/ConversationsAdapter.kt
+7
-9
ThreadAdapter.kt
...rc/main/kotlin/com/secspace/sms/adapters/ThreadAdapter.kt
+1
-1
SmsReceiver.kt
...src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
+9
-9
No files found.
app/src/main/kotlin/com/secspace/sms/activities/MainActivity.kt
View file @
99ffcf0a
This diff is collapsed.
Click to expand it.
app/src/main/kotlin/com/secspace/sms/activities/SettingsActivity.kt
View file @
99ffcf0a
...
...
@@ -6,6 +6,7 @@ import android.os.Build
import
android.os.Bundle
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.annotation.RequiresApi
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.databinding.ActivitySettingsBinding
import
com.secspace.sms.dialogs.ExportMessagesDialog
...
...
@@ -29,6 +30,7 @@ class SettingsActivity : SimpleActivity() {
private
val
messagesFileType
=
"application/json"
private
val
messageImportFileTypes
=
listOf
(
"application/json"
,
"application/xml"
,
"text/xml"
)
private
val
TAG
=
"SettingsActivity"
private
val
binding
by
viewBinding
(
ActivitySettingsBinding
::
inflate
)
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
...
@@ -192,6 +194,7 @@ class SettingsActivity : SimpleActivity() {
settingsManageBlockedNumbersHolder
.
beVisibleIf
(
isNougatPlus
())
settingsManageBlockedNumbersHolder
.
setOnClickListener
{
Log
.
d
(
TAG
,
"setupManageBlockedNumbers: 黑名单管理"
)
// if (isOrWasThankYouInstalled()) {
Intent
(
this
@SettingsActivity
,
ManageBlockedNumbersActivity
::
class
.
java
).
apply
{
startActivity
(
this
)
...
...
app/src/main/kotlin/com/secspace/sms/activities/ThreadActivity.kt
View file @
99ffcf0a
...
...
@@ -24,7 +24,6 @@ import android.text.format.DateUtils
import
android.text.format.DateUtils.FORMAT_NO_YEAR
import
android.text.format.DateUtils.FORMAT_SHOW_DATE
import
android.text.format.DateUtils.FORMAT_SHOW_TIME
import
android.util.Log
import
android.util.TypedValue
import
android.view.Gravity
import
android.view.KeyEvent
...
...
@@ -44,6 +43,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.adapters.AttachmentsAdapter
import
com.secspace.sms.adapters.AutoCompleteTextViewAdapter
...
...
@@ -477,6 +477,7 @@ class ThreadActivity : SimpleActivity() {
private
fun
setupAdapter
()
{
threadItems
=
getThreadItems
()
Log
.
d
(
TAG
,
"setupAdapter: threadItems = $threadItems"
)
runOnUiThread
{
refreshMenuItems
()
...
...
@@ -486,6 +487,7 @@ class ThreadActivity : SimpleActivity() {
val
lastVisiblePosition
=
layoutManager
.
findLastVisibleItemPosition
()
val
shouldScrollToBottom
:
Boolean
=
currentList
.
lastOrNull
()
!=
threadItems
.
lastOrNull
()
&&
lastPosition
-
lastVisiblePosition
==
1
updateMessages
(
threadItems
,
if
(
shouldScrollToBottom
)
lastPosition
else
-
1
)
Log
.
d
(
TAG
,
"setupAdapter: threadItems = $threadItems"
)
}
}
...
...
@@ -973,13 +975,14 @@ class ThreadActivity : SimpleActivity() {
ConfirmationDialog
(
this
,
getString
(
confirmationMessage
))
{
ensureBackgroundThread
{
//记录被删除的Conversation会话包含[零宽度字符]的ThreadId
// Log.d(TAG, "getNewConversations
conversation = ${Gson().toJson(conversation)} ")
Log
.
d
(
TAG
,
"ThreadActivity askConfirmDelete:
conversation = ${Gson().toJson(conversation)} "
)
conversation
?.
let
{
val
listMessageData
=
getMessages
(
threadId
,
false
)
// Log.d(TAG, "getNewConversations
threadId = ${threadId} listMessageData = ${Gson().toJson(listMessageData)} ")
Log
.
d
(
TAG
,
"ThreadActivity askConfirmDelete:
threadId = ${threadId} listMessageData = ${Gson().toJson(listMessageData)} "
)
if
(
listMessageData
.
isNotEmpty
())
{
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
var
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
this
@ThreadActivity
).
listDeleteMsgIdAllData
android
.
util
.
Log
.
d
(
TAG
,
"ThreadActivity askConfirmDelete: 获取云备份 记录的数据集合 = $listMsgIdAll"
)
if
(
listMsgIdAll
.
isNullOrEmpty
()){
Config
.
newInstance
(
this
@ThreadActivity
).
listDeleteMsgIdAllData
=
"${it.title},"
}
else
{
...
...
app/src/main/kotlin/com/secspace/sms/adapters/ConversationsAdapter.kt
View file @
99ffcf0a
package
com.secspace.sms.adapters
import
android.text.TextUtils
import
android.util.Log
import
android.view.Menu
import
com.google.gson.Gson
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.activities.SimpleActivity
import
com.secspace.sms.dialogs.RenameConversationDialog
import
com.secspace.sms.extensions.*
import
com.secspace.sms.helpers.Config
import
com.secspace.sms.helpers.Constant
import
com.secspace.sms.helpers.refreshMessages
import
com.secspace.sms.models.Conversation
import
com.secspace.sms.models.Message
...
...
@@ -132,19 +131,18 @@ class ConversationsAdapter(
ConfirmationDialog
(
activity
,
question
)
{
ensureBackgroundThread
{
// Log.d(TAG, "getNewConversations
selectedKeys = ${Gson().toJson(selectedKeys)} ")
// Log.d(TAG, "getNewConversations currentList
= ${Gson().toJson(currentList)} ")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
selectedKeys = ${Gson().toJson(selectedKeys)} "
)
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete selectedKeys
= ${Gson().toJson(currentList)} "
)
currentList
.
forEach
{
if
(
selectedKeys
.
contains
(
it
.
hashCode
()))
{
// Log.d(TAG, "getNewConversations
selectedKeys = ${it.hashCode()} threadId = ${it.threadId}")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
selectedKeys = ${it.hashCode()} threadId = ${it.threadId}"
)
//记录被删除的Conversation会话包含[零宽度字符]的ThreadId
val
listMessageData
=
activity
.
getMessages
(
it
.
threadId
,
false
)
// Log.d(TAG, "getNewConversations
threadId = ${it.threadId} listMessageData = ${Gson().toJson(listMessageData)} ")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
threadId = ${it.threadId} listMessageData = ${Gson().toJson(listMessageData)} "
)
if
(
listMessageData
.
isNotEmpty
())
{
val
listContains
:
List
<
Message
>
=
listMessageData
.
filter
{
msg
->
msg
.
body
.
contains
(
"\u200B"
)
}
var
listMsgIdAll
:
String
?
=
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
// android.util.Log.d(TAG, "setupConversations
获取被删除的会话集合 listMsgIdAll = ${listMsgIdAll}")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
获取被删除的会话集合 listMsgIdAll = ${listMsgIdAll}"
)
if
(
listMsgIdAll
.
isNullOrEmpty
()){
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
=
"${it.title},"
}
else
{
...
...
@@ -152,7 +150,7 @@ class ConversationsAdapter(
if
(
listContains
.
isNotEmpty
()
&&
!
listMsgIdAllResult
.
contains
(
it
.
title
)
&&
!
it
.
title
.
contains
(
"*"
))
{
listMsgIdAll
+=
"${it.title},"
Config
.
newInstance
(
activity
).
listDeleteMsgIdAllData
=
listMsgIdAll
// android.util.Log.d(TAG, "setupConversations
获取被删除的会话集合 listMsgIdAll += ${listMsgIdAll}")
Log
.
d
(
TAG
,
"ConversationsAdapter askConfirmDelete
获取被删除的会话集合 listMsgIdAll += ${listMsgIdAll}"
)
}
}
}
...
...
app/src/main/kotlin/com/secspace/sms/adapters/ThreadAdapter.kt
View file @
99ffcf0a
...
...
@@ -6,7 +6,6 @@ import android.graphics.Typeface
import
android.graphics.drawable.BitmapDrawable
import
android.graphics.drawable.ColorDrawable
import
android.graphics.drawable.Drawable
import
android.util.Log
import
android.util.Size
import
android.util.TypedValue
import
android.view.Menu
...
...
@@ -28,6 +27,7 @@ import com.bumptech.glide.load.resource.bitmap.FitCenter
import
com.bumptech.glide.request.RequestListener
import
com.bumptech.glide.request.RequestOptions
import
com.bumptech.glide.request.target.Target
import
com.secspace.log.Log
import
com.secspace.sms.R
import
com.secspace.sms.activities.SimpleActivity
import
com.secspace.sms.databinding.*
...
...
app/src/main/kotlin/com/secspace/sms/receivers/SmsReceiver.kt
View file @
99ffcf0a
...
...
@@ -63,7 +63,7 @@ class SmsReceiver : BroadcastReceiver() {
body
+=
it
.
messageBody
date
=
System
.
currentTimeMillis
()
threadId
=
context
.
getThreadId
(
address
)
// android.util.
Log.d(TAG, "onReceive: address = $address body = $body date = $date")
Log
.
d
(
TAG
,
"onReceive: address = $address body = $body date = $date"
)
}
if
(
address
.
isNotEmpty
())
{
...
...
@@ -127,9 +127,9 @@ class SmsReceiver : BroadcastReceiver() {
if
(
lastNumber
.
isEmpty
())
{
RecentsHelper
(
context
=
context
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
val
listCallRecent
:
List
<
RecentCall
>
=
recents
.
distinctBy
{
it
.
phoneNumber
}
//
Log.d(TAG, "SmsReceiver最近通话 recents:${GsonUtil.parseListToJson(listCallRecent)}")
Log
.
d
(
TAG
,
"SmsReceiver最近通话 recents:${GsonUtil.parseListToJson(listCallRecent)}"
)
val
findResult
=
listCallRecent
.
filter
{
it
.
isShunFeng
}.
count
{
//
Log.d(TAG, "SmsReceiver findResult isNumber = ${PhoneFromUtil.isNumeric(it.phoneNumber)}")
Log
.
d
(
TAG
,
"SmsReceiver findResult isNumber = ${PhoneFromUtil.isNumeric(it.phoneNumber)}"
)
if
(
PhoneFromUtil
.
isNumeric
(
it
.
phoneNumber
))
{
if
(
phoneNumber
.
contains
(
"+86"
)){
...
...
@@ -145,7 +145,7 @@ class SmsReceiver : BroadcastReceiver() {
}
}
}
//
Log.d(TAG, "SmsReceiverfindResult:${findResult} phoneNumber = ${phoneNumber.trim()}")
Log
.
d
(
TAG
,
"SmsReceiverfindResult:${findResult} phoneNumber = ${phoneNumber.trim()}"
)
//从最近通话记录中找到了号码 进行掩码操作
if
(
findResult
>
0
)
{
PhoneUtils
.
phoneNumberFormat
(
phoneNumber
)
{
itNumber
->
...
...
@@ -154,7 +154,7 @@ class SmsReceiver : BroadcastReceiver() {
}
}
}
//
Log.d(TAG, "SmsReceiver lastNumber = $lastNumber")
Log
.
d
(
TAG
,
"SmsReceiver lastNumber = $lastNumber"
)
}
if
(
lastNumber
==
""
)
{
confirmCallBack
.
invoke
(
phoneNumber
)
...
...
@@ -191,12 +191,12 @@ class SmsReceiver : BroadcastReceiver() {
val
newMessageId
:
Long
=
context
.
insertNewSMS
(
address
,
subject
,
body
,
date
,
read
,
threadId
,
type
,
subscriptionId
)
//最新消息会话
val
conversation
:
Conversation
=
context
.
getConversations
(
threadId
).
firstOrNull
()
?:
return
@ensureBackgroundThread
// android.util.
Log.d(TAG, "handleMessage: toJson = ${Gson().toJson(conversation)}")
Log
.
d
(
TAG
,
"handleMessage: toJson = ${Gson().toJson(conversation)}"
)
if
(
aesPhoneNumber
.
isNotBlank
()
||
body
.
contains
(
"\u200B"
))
{
conversation
.
title
=
aesPhoneNumber
conversation
.
isSFNumber
=
true
}
//
Log.d(TAG, "SmsReceiverhandleConversation 掩码后的 Json:${GsonUtil.parseBeanToJson(conversation)}")
Log
.
d
(
TAG
,
"SmsReceiverhandleConversation 掩码后的 Json:${GsonUtil.parseBeanToJson(conversation)}"
)
try
{
context
.
insertOrUpdateConversation
(
conversation
)
}
catch
(
ignored
:
Exception
)
{
...
...
@@ -247,12 +247,12 @@ class SmsReceiver : BroadcastReceiver() {
}
}
//
Log.d(TAG, "SmsReceiver aesPhoneNumber 手机号是否加密 :${aesPhoneNumber}")
Log
.
d
(
TAG
,
"SmsReceiver aesPhoneNumber 手机号是否加密 :${aesPhoneNumber}"
)
if
(
aesPhoneNumber
.
isNotBlank
())
{
val
tipPopup
=
MyPushWindow
(
context
,
aesPhoneNumber
,
body
)
tipPopup
.
show
()
}
else
{
//
Log.d(TAG, "SmsReceiver 短信内容 = ${body} address = $address ")
Log
.
d
(
TAG
,
"SmsReceiver 短信内容 = ${body} address = $address "
)
if
(
body
.
contains
(
"\u200B"
))
{
if
(
address
.
contains
(
"+86"
))
{
address
.
replace
(
"+86"
,
""
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment