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
d706e45b
Commit
d706e45b
authored
Nov 29, 2024
by
zhangchengbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:去除无用代码
parent
02bb4979
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
128 deletions
+0
-128
ThreadAdapter.kt
...rc/main/kotlin/com/secspace/sms/adapters/ThreadAdapter.kt
+0
-128
No files found.
app/src/main/kotlin/com/secspace/sms/adapters/ThreadAdapter.kt
View file @
d706e45b
package
com.secspace.sms.adapters
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
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
...
...
@@ -30,23 +28,16 @@ import com.bumptech.glide.request.RequestListener
import
com.bumptech.glide.request.RequestOptions
import
com.bumptech.glide.request.target.Target
import
com.secspace.sms.R
import
com.secspace.sms.activities.NewConversationActivity
import
com.secspace.sms.activities.SimpleActivity
import
com.secspace.sms.activities.ThreadActivity
import
com.secspace.sms.databinding.*
import
com.secspace.sms.dialogs.DeleteConfirmationDialog
import
com.secspace.sms.dialogs.MessageDetailsDialog
import
com.secspace.sms.dialogs.SelectTextDialog
import
com.secspace.sms.extensions.*
import
com.secspace.sms.helpers.*
import
com.secspace.sms.models.Attachment
import
com.secspace.sms.models.Message
import
com.secspace.sms.models.ThreadItem
import
com.simplemobiletools.commons.adapters.MyRecyclerViewListAdapter
import
com.simplemobiletools.commons.dialogs.ConfirmationDialog
import
com.simplemobiletools.commons.extensions.*
import
com.simplemobiletools.commons.helpers.SimpleContactsHelper
import
com.simplemobiletools.commons.helpers.ensureBackgroundThread
import
com.simplemobiletools.commons.views.MyRecyclerView
class
ThreadAdapter
(
...
...
@@ -162,103 +153,6 @@ class ThreadAdapter(
}
}
private
fun
copyToClipboard
()
{
val
firstItem
=
getSelectedItems
().
firstOrNull
()
as
?
Message
?:
return
activity
.
copyToClipboard
(
firstItem
.
body
)
}
private
fun
saveAs
()
{
val
firstItem
=
getSelectedItems
().
firstOrNull
()
as
?
Message
?:
return
val
attachment
=
firstItem
.
attachment
?.
attachments
?.
first
()
?:
return
(
activity
as
ThreadActivity
).
saveMMS
(
attachment
.
mimetype
,
attachment
.
uriString
)
}
private
fun
shareText
()
{
val
firstItem
=
getSelectedItems
().
firstOrNull
()
as
?
Message
?:
return
activity
.
shareTextIntent
(
firstItem
.
body
)
}
private
fun
selectText
()
{
val
firstItem
=
getSelectedItems
().
firstOrNull
()
as
?
Message
?:
return
if
(
firstItem
.
body
.
trim
().
isNotEmpty
())
{
SelectTextDialog
(
activity
,
firstItem
.
body
)
}
}
private
fun
showMessageDetails
()
{
val
message
=
getSelectedItems
().
firstOrNull
()
as
?
Message
?:
return
MessageDetailsDialog
(
activity
,
message
)
}
private
fun
askConfirmDelete
()
{
val
itemsCnt
=
selectedKeys
.
size
// not sure how we can get UnknownFormatConversionException here, so show the error and hope that someone reports it
val
items
=
try
{
resources
.
getQuantityString
(
R
.
plurals
.
delete_messages
,
itemsCnt
,
itemsCnt
)
}
catch
(
e
:
Exception
)
{
activity
.
showErrorToast
(
e
)
return
}
val
baseString
=
if
(
activity
.
config
.
useRecycleBin
&&
!
isRecycleBin
)
{
com
.
simplemobiletools
.
commons
.
R
.
string
.
move_to_recycle_bin_confirmation
}
else
{
com
.
simplemobiletools
.
commons
.
R
.
string
.
deletion_confirmation
}
val
question
=
String
.
format
(
resources
.
getString
(
baseString
),
items
)
DeleteConfirmationDialog
(
activity
,
question
,
activity
.
config
.
useRecycleBin
&&
!
isRecycleBin
)
{
skipRecycleBin
->
ensureBackgroundThread
{
val
messagesToRemove
=
getSelectedItems
()
if
(
messagesToRemove
.
isNotEmpty
())
{
val
toRecycleBin
=
!
skipRecycleBin
&&
activity
.
config
.
useRecycleBin
&&
!
isRecycleBin
deleteMessages
(
messagesToRemove
.
filterIsInstance
<
Message
>(),
toRecycleBin
,
false
)
}
}
}
}
private
fun
askConfirmRestore
()
{
val
itemsCnt
=
selectedKeys
.
size
// not sure how we can get UnknownFormatConversionException here, so show the error and hope that someone reports it
val
items
=
try
{
resources
.
getQuantityString
(
R
.
plurals
.
delete_messages
,
itemsCnt
,
itemsCnt
)
}
catch
(
e
:
Exception
)
{
activity
.
showErrorToast
(
e
)
return
}
val
baseString
=
R
.
string
.
restore_confirmation
val
question
=
String
.
format
(
resources
.
getString
(
baseString
),
items
)
ConfirmationDialog
(
activity
,
question
)
{
ensureBackgroundThread
{
val
messagesToRestore
=
getSelectedItems
()
if
(
messagesToRestore
.
isNotEmpty
())
{
deleteMessages
(
messagesToRestore
.
filterIsInstance
<
Message
>(),
false
,
true
)
}
}
}
}
private
fun
forwardMessage
()
{
val
message
=
getSelectedItems
().
firstOrNull
()
as
?
Message
?:
return
val
attachment
=
message
.
attachment
?.
attachments
?.
firstOrNull
()
Intent
(
activity
,
NewConversationActivity
::
class
.
java
).
apply
{
action
=
Intent
.
ACTION_SEND
putExtra
(
Intent
.
EXTRA_TEXT
,
message
.
body
)
if
(
attachment
!=
null
)
{
putExtra
(
Intent
.
EXTRA_STREAM
,
attachment
.
getUri
())
}
activity
.
startActivity
(
this
)
}
}
private
fun
getSelectedItems
()
=
currentList
.
filter
{
selectedKeys
.
contains
((
it
as
?
Message
)
?.
hashCode
()
?:
0
)
}
as
ArrayList
<
ThreadItem
>
private
fun
isThreadDateTime
(
position
:
Int
)
=
currentList
.
getOrNull
(
position
)
is
ThreadItem
.
ThreadDateTime
...
...
@@ -456,28 +350,6 @@ class ThreadAdapter(
}
}
/* private fun setupVCardView(holder: ViewHolder, parent: LinearLayout, message: Message, attachment: Attachment) {
val uri = attachment.getUri()
val vCardView = ItemAttachmentVcardBinding.inflate(layoutInflater).apply {
setupVCardPreview(
activity = activity,
uri = uri,
onClick = {
if (actModeCallback.isSelectable) {
holder.viewClicked(message)
} else {
val intent = Intent(activity, VCardViewerActivity::class.java).also {
it.putExtra(EXTRA_VCARD_URI, uri)
}
activity.startActivity(intent)
}
},
onLongClick = { holder.viewLongClicked() }
)
}.root
parent.addView(vCardView)
}*/
private
fun
setupFileView
(
holder
:
ViewHolder
,
parent
:
LinearLayout
,
message
:
Message
,
attachment
:
Attachment
)
{
val
mimetype
=
attachment
.
mimetype
...
...
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