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
1d680f4e
Commit
1d680f4e
authored
Nov 29, 2024
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:删除title标题更新,注释cache缓存更新UI,去除无用代码,
parent
d706e45b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
56 deletions
+4
-56
ThreadActivity.kt
...main/kotlin/com/secspace/sms/activities/ThreadActivity.kt
+4
-56
No files found.
app/src/main/kotlin/com/secspace/sms/activities/ThreadActivity.kt
View file @
1d680f4e
...
@@ -50,7 +50,6 @@ import com.secspace.sms.adapters.ThreadAdapter
...
@@ -50,7 +50,6 @@ import com.secspace.sms.adapters.ThreadAdapter
import
com.secspace.sms.databinding.ActivityThreadBinding
import
com.secspace.sms.databinding.ActivityThreadBinding
import
com.secspace.sms.databinding.ItemSelectedContactBinding
import
com.secspace.sms.databinding.ItemSelectedContactBinding
import
com.secspace.sms.dialogs.InvalidNumberDialog
import
com.secspace.sms.dialogs.InvalidNumberDialog
import
com.secspace.sms.dialogs.RenameConversationDialog
import
com.secspace.sms.dialogs.ScheduleMessageDialog
import
com.secspace.sms.dialogs.ScheduleMessageDialog
import
com.secspace.sms.extensions.*
import
com.secspace.sms.extensions.*
import
com.secspace.sms.helpers.*
import
com.secspace.sms.helpers.*
...
@@ -183,9 +182,6 @@ class ThreadActivity : SimpleActivity() {
...
@@ -183,9 +182,6 @@ class ThreadActivity : SimpleActivity() {
val
newConv
=
conversationsDB
.
getConversationWithThreadId
(
threadId
)
val
newConv
=
conversationsDB
.
getConversationWithThreadId
(
threadId
)
if
(
newConv
!=
null
)
{
if
(
newConv
!=
null
)
{
conversation
=
newConv
conversation
=
newConv
runOnUiThread
{
setupThreadTitle
()
}
}
}
}
}
...
@@ -246,8 +242,8 @@ class ThreadActivity : SimpleActivity() {
...
@@ -246,8 +242,8 @@ class ThreadActivity : SimpleActivity() {
}
}
private
fun
refreshMenuItems
()
{
private
fun
refreshMenuItems
()
{
val
firstPhoneNumber
=
participants
.
firstOrNull
()
?.
phoneNumbers
?.
firstOrNull
()
?.
value
//
val firstPhoneNumber = participants.firstOrNull()?.phoneNumbers?.firstOrNull()?.value
val
archiveAvailable
=
config
.
isArchiveAvailable
//
val archiveAvailable = config.isArchiveAvailable
binding
.
threadToolbar
.
menu
.
apply
{
binding
.
threadToolbar
.
menu
.
apply
{
findItem
(
R
.
id
.
delete
).
isVisible
=
threadItems
.
isNotEmpty
()
findItem
(
R
.
id
.
delete
).
isVisible
=
threadItems
.
isNotEmpty
()
findItem
(
R
.
id
.
restore
).
isVisible
=
/*threadItems.isNotEmpty() && isRecycleBin*/
false
findItem
(
R
.
id
.
restore
).
isVisible
=
/*threadItems.isNotEmpty() && isRecycleBin*/
false
...
@@ -333,7 +329,7 @@ class ThreadActivity : SimpleActivity() {
...
@@ -333,7 +329,7 @@ class ThreadActivity : SimpleActivity() {
}
}
setupParticipants
()
setupParticipants
()
setupAdapter
()
//
setupAdapter()
runOnUiThread
{
runOnUiThread
{
if
(
messages
.
isEmpty
())
{
if
(
messages
.
isEmpty
())
{
...
@@ -341,7 +337,6 @@ class ThreadActivity : SimpleActivity() {
...
@@ -341,7 +337,6 @@ class ThreadActivity : SimpleActivity() {
binding
.
messageHolder
.
threadTypeMessage
.
requestFocus
()
binding
.
messageHolder
.
threadTypeMessage
.
requestFocus
()
}
}
setupThreadTitle
()
setupSIMSelector
()
setupSIMSelector
()
updateMessageType
()
updateMessageType
()
callback
()
callback
()
...
@@ -418,7 +413,6 @@ class ThreadActivity : SimpleActivity() {
...
@@ -418,7 +413,6 @@ class ThreadActivity : SimpleActivity() {
setupAttachmentSizes
()
setupAttachmentSizes
()
setupAdapter
()
setupAdapter
()
runOnUiThread
{
runOnUiThread
{
setupThreadTitle
()
setupSIMSelector
()
setupSIMSelector
()
}
}
}
}
...
@@ -456,7 +450,7 @@ class ThreadActivity : SimpleActivity() {
...
@@ -456,7 +450,7 @@ class ThreadActivity : SimpleActivity() {
val
layoutManager
=
binding
.
threadMessagesList
.
layoutManager
as
LinearLayoutManager
val
layoutManager
=
binding
.
threadMessagesList
.
layoutManager
as
LinearLayoutManager
val
lastPosition
=
itemCount
-
1
val
lastPosition
=
itemCount
-
1
val
lastVisiblePosition
=
layoutManager
.
findLastVisibleItemPosition
()
val
lastVisiblePosition
=
layoutManager
.
findLastVisibleItemPosition
()
val
shouldScrollToBottom
=
currentList
.
lastOrNull
()
!=
threadItems
.
lastOrNull
()
&&
lastPosition
-
lastVisiblePosition
==
1
val
shouldScrollToBottom
:
Boolean
=
currentList
.
lastOrNull
()
!=
threadItems
.
lastOrNull
()
&&
lastPosition
-
lastVisiblePosition
==
1
updateMessages
(
threadItems
,
if
(
shouldScrollToBottom
)
lastPosition
else
-
1
)
updateMessages
(
threadItems
,
if
(
shouldScrollToBottom
)
lastPosition
else
-
1
)
}
}
}
}
...
@@ -841,14 +835,6 @@ class ThreadActivity : SimpleActivity() {
...
@@ -841,14 +835,6 @@ class ThreadActivity : SimpleActivity() {
}
}
}
}
private
fun
setupThreadTitle
()
{
val
title
=
conversation
?.
phoneNumber
binding
.
threadToolbar
.
title
=
if
(!
title
.
isNullOrEmpty
())
{
title
}
else
{
participants
.
getThreadTitle
()
}
}
@SuppressLint
(
"MissingPermission"
)
@SuppressLint
(
"MissingPermission"
)
private
fun
setupSIMSelector
()
{
private
fun
setupSIMSelector
()
{
...
@@ -1049,44 +1035,6 @@ class ThreadActivity : SimpleActivity() {
...
@@ -1049,44 +1035,6 @@ class ThreadActivity : SimpleActivity() {
updateMessageType
()
updateMessageType
()
}
}
private
fun
markAsUnread
()
{
ensureBackgroundThread
{
conversationsDB
.
markUnread
(
threadId
)
markThreadMessagesUnread
(
threadId
)
runOnUiThread
{
finish
()
bus
?.
post
(
Events
.
RefreshMessages
())
}
}
}
private
fun
addNumberToContact
()
{
val
phoneNumber
=
participants
.
firstOrNull
()
?.
phoneNumbers
?.
firstOrNull
()
?.
normalizedNumber
?:
return
Intent
().
apply
{
action
=
Intent
.
ACTION_INSERT_OR_EDIT
type
=
"vnd.android.cursor.item/contact"
putExtra
(
KEY_PHONE
,
phoneNumber
)
launchActivityIntent
(
this
)
}
}
private
fun
renameConversation
()
{
RenameConversationDialog
(
this
,
conversation
!!
)
{
title
->
ensureBackgroundThread
{
conversation
=
renameConversation
(
conversation
!!
,
newTitle
=
title
)
runOnUiThread
{
setupThreadTitle
()
}
}
}
}
private
fun
showConversationDetails
()
{
Intent
(
this
,
ConversationDetailsActivity
::
class
.
java
).
apply
{
putExtra
(
THREAD_ID
,
threadId
)
startActivity
(
this
)
}
}
@SuppressLint
(
"MissingPermission"
)
@SuppressLint
(
"MissingPermission"
)
private
fun
getThreadItems
():
ArrayList
<
ThreadItem
>
{
private
fun
getThreadItems
():
ArrayList
<
ThreadItem
>
{
...
...
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