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
504b0350
Commit
504b0350
authored
Dec 12, 2024
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:添加非空判断条件
parent
ea77754b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
MainActivity.kt
...c/main/kotlin/com/secspace/sms/activities/MainActivity.kt
+5
-4
No files found.
app/src/main/kotlin/com/secspace/sms/activities/MainActivity.kt
View file @
504b0350
...
@@ -413,7 +413,7 @@ class MainActivity : SimpleActivity() {
...
@@ -413,7 +413,7 @@ class MainActivity : SimpleActivity() {
// Log.e(TAG, " getNewConversations privateContacts:${GsonUtil.parseListToJson(privateContacts)}")
// Log.e(TAG, " getNewConversations privateContacts:${GsonUtil.parseListToJson(privateContacts)}")
//获取系统SMS DB短信列表
//获取系统SMS DB短信列表
val
conversations
:
java
.
util
.
ArrayList
<
Conversation
>
=
getConversations
(
privateContacts
=
privateContacts
)
val
conversations
:
java
.
util
.
ArrayList
<
Conversation
>
=
getConversations
(
privateContacts
=
privateContacts
)
Log
.
e
(
TAG
,
" getNewConversations 获取系统SMS DB短信列表(脏数据) conversations:${GsonUtil.parseListToJson(conversations)}"
)
Log
.
e
(
TAG
,
" getNewConversations 获取系统SMS DB短信列表(脏数据) conversations:${GsonUtil.parseListToJson(conversations)}"
)
//通过DB数据与cache对比threadID
//通过DB数据与cache对比threadID
conversations
.
forEach
{
clonedConversation
->
conversations
.
forEach
{
clonedConversation
->
...
@@ -504,18 +504,19 @@ class MainActivity : SimpleActivity() {
...
@@ -504,18 +504,19 @@ class MainActivity : SimpleActivity() {
private
fun
setFirstConversationAndUpdateData
(
sortedConversations
:
ArrayList
<
Conversation
>)
{
private
fun
setFirstConversationAndUpdateData
(
sortedConversations
:
ArrayList
<
Conversation
>)
{
val
hasPerMissionResult
=
this
@MainActivity
.
hasPermission
(
PERMISSION_READ_CALL_LOG
)
val
hasPerMissionResult
=
this
@MainActivity
.
hasPermission
(
PERMISSION_READ_CALL_LOG
)
if
(
hasPerMissionResult
&&
sortedConversations
.
isNotEmpty
())
{
if
(
hasPerMissionResult
&&
sortedConversations
.
isNotEmpty
())
{
val
firstConversation
=
sortedConversations
.
first
()
//获取第一条未掩码会话
val
firstConversation
=
sortedConversations
.
first
OrNull
()
//获取第一条未掩码会话
Log
.
d
(
TAG
,
" MainActivity firstConversation() 获取第一条会话 =: ${GsonUtil.parseBeanToJson(firstConversation)}"
)
Log
.
d
(
TAG
,
" MainActivity firstConversation() 获取第一条会话 =: ${GsonUtil.parseBeanToJson(firstConversation)}"
)
if
(
firstConversation
==
null
)
return
val
phoneNumber
=
firstConversation
.
title
.
replace
(
" "
,
""
)
val
phoneNumber
=
firstConversation
.
title
.
replace
(
" "
,
""
)
//只针对手机号
//只针对手机号
if
(
phoneNumber
.
length
!=
11
)
return
if
(
phoneNumber
.
length
!=
11
)
return
if
(!
firstConversation
.
isSFNumber
)
{
if
(!
firstConversation
.
isSFNumber
)
{
Log
.
d
(
TAG
,
"----MainActivity----获取第一条会话手机号 phoneNumber:$phoneNumber"
)
Log
.
d
(
TAG
,
"----MainActivity----获取第一条会话手机号 phoneNumber:$phoneNumber"
)
RecentsHelper
(
context
=
this
@MainActivity
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
RecentsHelper
(
context
=
this
@MainActivity
).
getRecentCalls
(
false
,
Int
.
MAX_VALUE
)
{
recents
:
List
<
RecentCall
>
->
val
listCallRecent
:
List
<
RecentCall
>
=
recents
.
distinctBy
{
it
.
phoneNumber
}
val
listCallRecent
:
List
<
RecentCall
>
=
recents
.
distinctBy
{
it
.
phoneNumber
}
// Log.d(TAG, "----MainActivity----最近通话记录列表 :${GsonUtil.parseListToJson(listCallRecent)}")
// Log.d(TAG, "----MainActivity----最近通话记录列表 :${GsonUtil.parseListToJson(listCallRecent)}")
val
findResult
:
RecentCall
?
=
listCallRecent
.
firstOrNull
{
it
.
phoneNumber
.
replace
(
" "
,
""
)
==
phoneNumber
&&
it
.
isShunFeng
}
val
findResult
:
RecentCall
?
=
listCallRecent
.
firstOrNull
{
it
.
phoneNumber
.
replace
(
" "
,
""
)
==
phoneNumber
&&
it
.
isShunFeng
}
Log
.
d
(
TAG
,
"----MainActivity----是否从通话记录中查找到电话号Result:${findResult != null}"
)
Log
.
d
(
TAG
,
"----MainActivity----是否从通话记录中查找到电话号Result:${findResult != null}"
)
//从最近通话记录中找到了号码 进行掩码操作
//从最近通话记录中找到了号码 进行掩码操作
if
(
findResult
!=
null
)
{
if
(
findResult
!=
null
)
{
...
...
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