Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-android
Commits
8ed7ae79
Commit
8ed7ae79
authored
1 year ago
by
Pierre Nicolas
Browse files
Options
Downloads
Patches
Plain Diff
conversation: pasting a text overwrites the existing text
Gitlab:
#1117
Change-Id: Ifd93a844061dca388b4a62914b9773239f809e35
parent
11584579
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jami-android/app/src/main/java/cx/ring/fragments/ConversationFragment.kt
+21
-8
21 additions, 8 deletions
...p/src/main/java/cx/ring/fragments/ConversationFragment.kt
with
21 additions
and
8 deletions
jami-android/app/src/main/java/cx/ring/fragments/ConversationFragment.kt
+
21
−
8
View file @
8ed7ae79
...
...
@@ -247,18 +247,31 @@ class ConversationFragment : BaseSupportFragment<ConversationPresenter, Conversa
}
binding
.
ongoingcallPane
.
visibility
=
View
.
GONE
ViewCompat
.
setOnReceiveContentListener
(
binding
.
msgInputTxt
,
SUPPORTED_MIME_TYPES
)
{
_
,
contentInfo
->
for
(
i
in
0
until
contentInfo
.
clip
.
itemCount
)
{
val
item
:
ClipData
.
Item
=
contentInfo
.
clip
.
getItemAt
(
i
)
if
(
item
.
uri
==
null
&&
item
.
text
!=
null
)
{
binding
.
msgInputTxt
.
setText
(
item
.
text
)
}
else
{
startFileSend
(
AndroidFileUtils
.
getCacheFile
(
requireContext
(),
item
.
uri
)
// Content may be both text and non-text (HTML, images, videos, audio files, etc).
ViewCompat
.
setOnReceiveContentListener
(
binding
.
msgInputTxt
,
SUPPORTED_MIME_TYPES
)
{
_
,
payload
->
// Split the incoming content into two groups: content URIs and everything else.
// This way we can implement custom handling for URIs and delegate the rest.
val
split
=
payload
.
partition
{
item
->
item
.
uri
!=
null
}
val
uriContent
=
split
.
first
val
remaining
=
split
.
second
// Handles content URIs.
if
(
uriContent
!=
null
)
{
val
clip
=
uriContent
.
clip
for
(
i
in
0
until
clip
.
itemCount
)
{
val
uri
=
clip
.
getItemAt
(
i
).
uri
startFileSend
(
AndroidFileUtils
.
getCacheFile
(
requireContext
(),
uri
)
.
flatMapCompletable
{
sendFile
(
it
)
})
}
}
null
// Delegates the processing for text and everything else to the platform.
remaining
}
binding
.
msgInputTxt
.
setOnEditorActionListener
{
_
,
actionId
:
Int
,
_
->
actionSendMsgText
(
actionId
)
}
binding
.
msgInputTxt
.
onFocusChangeListener
=
View
.
OnFocusChangeListener
{
_
,
hasFocus
:
Boolean
->
if
(
hasFocus
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment