Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
AloqaIM-Android
Commits
f25e08a5
Commit
f25e08a5
authored
Feb 07, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some markdown issues
parent
a0486d28
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
15 deletions
+19
-15
ActionSnackbar.kt
...in/java/chat/rocket/android/chatroom/ui/ActionSnackbar.kt
+14
-12
BottomSheet.kt
.../main/java/chat/rocket/android/chatroom/ui/BottomSheet.kt
+0
-0
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+3
-1
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+2
-2
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ActionSnackbar.kt
View file @
f25e08a5
...
...
@@ -14,26 +14,28 @@ import chat.rocket.android.R
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.content
import
ru.noties.markwon.Markwon
import
javax.inject.Inject
class
ActionSnackbar
:
BaseTransientBottomBar
<
ActionSnackbar
>
{
companion
object
{
fun
make
(
parentViewGroup
:
ViewGroup
,
content
:
String
):
ActionSnackbar
{
fun
make
(
parentViewGroup
:
ViewGroup
,
content
:
String
=
""
,
parser
:
MessageParser
):
ActionSnackbar
{
val
context
=
parentViewGroup
.
context
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
message_action_bar
,
parentViewGroup
,
false
)
val
cita
tionSnackbar
=
ActionSnackbar
(
parentViewGroup
,
view
,
CallbackImpl
(
view
))
citationSnackbar
.
messageTextView
=
view
.
findViewById
(
R
.
id
.
text_view_action_text
)
as
TextView
citationSnackbar
.
titleTextView
=
view
.
findViewById
(
R
.
id
.
text_view_action_title
)
as
TextView
citationSnackbar
.
cancelView
=
view
.
findViewById
(
R
.
id
.
image_view_action_cancel_quote
)
as
Image
View
citationSnackbar
.
duration
=
BaseTransientBottomBar
.
LENGTH_INDEFINITE
val
spannable
=
SpannableString
(
content
)
citationSnackbar
.
marginDrawable
=
context
.
getDrawable
(
R
.
drawable
.
quote
)
spannable
.
setSpan
(
MessageParser
.
QuoteMarginSpan
(
citationSnackbar
.
marginDrawable
,
10
),
0
,
content
.
length
,
0
)
cita
tionSnackbar
.
messageTextView
.
content
=
spannable
return
cita
tionSnackbar
val
ac
tionSnackbar
=
ActionSnackbar
(
parentViewGroup
,
view
,
CallbackImpl
(
view
))
actionSnackbar
.
parser
=
parser
actionSnackbar
.
messageTextView
=
view
.
findViewById
(
R
.
id
.
text_view_action_text
)
as
TextView
actionSnackbar
.
titleTextView
=
view
.
findViewById
(
R
.
id
.
text_view_action_title
)
as
Text
View
actionSnackbar
.
cancelView
=
view
.
findViewById
(
R
.
id
.
image_view_action_cancel_quote
)
as
ImageView
actionSnackbar
.
duration
=
BaseTransientBottomBar
.
LENGTH_INDEFINITE
val
spannable
=
Markwon
.
markdown
(
context
,
content
).
trim
(
)
actionSnackbar
.
marginDrawable
=
context
.
getDrawable
(
R
.
drawable
.
quote
)
ac
tionSnackbar
.
messageTextView
.
content
=
spannable
return
ac
tionSnackbar
}
}
lateinit
var
parser
:
MessageParser
lateinit
var
cancelView
:
View
private
lateinit
var
messageTextView
:
TextView
private
lateinit
var
titleTextView
:
TextView
...
...
@@ -41,7 +43,7 @@ class ActionSnackbar : BaseTransientBottomBar<ActionSnackbar> {
var
text
:
String
=
""
set
(
value
)
{
val
spannable
=
Markwon
.
markdown
(
this
.
context
,
value
)
as
Spannable
val
spannable
=
parser
.
renderMarkdown
(
value
)
as
Spannable
spannable
.
setSpan
(
MessageParser
.
QuoteMarginSpan
(
marginDrawable
,
10
),
0
,
spannable
.
length
,
0
)
messageTextView
.
content
=
spannable
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/
ListBottomSheetAdapter
.kt
→
app/src/main/java/chat/rocket/android/chatroom/ui/
BottomSheet
.kt
View file @
f25e08a5
File moved
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
f25e08a5
...
...
@@ -16,6 +16,7 @@ import chat.rocket.android.chatroom.presentation.ChatRoomPresenter
import
chat.rocket.android.chatroom.presentation.ChatRoomView
import
chat.rocket.android.chatroom.viewmodel.MessageViewModel
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.inflate
import
chat.rocket.android.util.setVisible
import
chat.rocket.android.util.textContent
...
...
@@ -43,6 +44,7 @@ private const val BUNDLE_IS_CHAT_ROOM_READ_ONLY = "is_chat_room_read_only"
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
{
@Inject
lateinit
var
presenter
:
ChatRoomPresenter
@Inject
lateinit
var
parser
:
MessageParser
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomName
:
String
private
lateinit
var
chatRoomType
:
String
...
...
@@ -205,7 +207,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
}
private
fun
setupActionSnackbar
()
{
actionSnackbar
=
ActionSnackbar
.
make
(
message_list_container
,
""
)
actionSnackbar
=
ActionSnackbar
.
make
(
message_list_container
,
parser
=
parser
)
actionSnackbar
.
cancelView
.
setOnClickListener
({
clearActionMessage
()
})
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
f25e08a5
...
...
@@ -45,14 +45,14 @@ class MessageParser @Inject constructor(val context: Application, private val co
var
content
:
String
=
text
// Replace all url links to markdown url syntax.
urls
?.
let
{
if
(
urls
!=
null
)
{
for
(
url
in
urls
)
{
content
=
content
.
replace
(
url
.
url
,
"[${url.url}](${url.url})"
)
}
}
val
parentNode
=
parser
.
parse
(
toLenientMarkdown
(
content
))
parentNode
.
accept
(
SpannableMarkdownVisitor
(
configuration
,
builder
))
parentNode
.
accept
(
QuoteMessageBodyVisitor
(
context
,
configuration
,
builder
))
quote
?.
apply
{
var
quoteNode
=
parser
.
parse
(
"> $sender $time"
)
parentNode
.
appendChild
(
quoteNode
)
...
...
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