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
e826fd78
Unverified
Commit
e826fd78
authored
Oct 23, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Oct 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into n_1715
parents
7a5dc36a
2bd72661
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
28 deletions
+60
-28
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+5
-8
Dialog.kt
app/src/main/java/chat/rocket/android/chatroom/ui/Dialog.kt
+27
-16
Menu.kt
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
+11
-0
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+6
-1
MembersAdapter.kt
...ava/chat/rocket/android/members/adapter/MembersAdapter.kt
+1
-0
MemberUiModel.kt
...java/chat/rocket/android/members/uimodel/MemberUiModel.kt
+5
-0
item_member.xml
app/src/main/res/layout/item_member.xml
+5
-3
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
e826fd78
...
@@ -266,16 +266,16 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -266,16 +266,16 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
onPause
()
{
override
fun
onPause
()
{
super
.
onPause
()
super
.
onPause
()
setReactionButtonIcon
(
R
.
drawable
.
ic_reaction_24dp
)
dismissEmojiKeyboard
()
dismissEmojiKeyboard
()
activity
?.
invalidateOptionsMenu
()
activity
?.
invalidateOptionsMenu
()
}
}
private
fun
dismissEmojiKeyboard
()
{
fun
dismissEmojiKeyboard
()
{
// Check if the keyboard was ever initialized.
// Check if the keyboard was ever initialized.
// It may be the case when you are looking a not joined room
// It may be the case when you are looking a not joined room
if
(
::
emojiKeyboardPopup
.
isInitialized
)
{
if
(
::
emojiKeyboardPopup
.
isInitialized
)
{
emojiKeyboardPopup
.
dismiss
()
emojiKeyboardPopup
.
dismiss
()
setReactionButtonIcon
(
R
.
drawable
.
ic_reaction_24dp
)
}
}
}
}
...
@@ -784,8 +784,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -784,8 +784,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
context
:
Context
context
:
Context
)
{
)
{
if
(
f
is
MessageActionsBottomSheet
)
{
if
(
f
is
MessageActionsBottomSheet
)
{
setReactionButtonIcon
(
R
.
drawable
.
ic_reaction_24dp
)
dismissEmojiKeyboard
()
emojiKeyboardPopup
.
dismiss
()
}
}
}
}
},
},
...
@@ -805,9 +804,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -805,9 +804,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
it
.
onBackPressed
()
it
.
onBackPressed
()
}
}
KeyboardHelper
.
hideSoftKeyboard
(
it
)
KeyboardHelper
.
hideSoftKeyboard
(
it
)
emojiKeyboardPopup
.
dismiss
()
dismissEmojiKeyboard
()
}
}
setReactionButtonIcon
(
R
.
drawable
.
ic_reaction_24dp
)
}
}
}
}
...
@@ -917,8 +915,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -917,8 +915,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
setReactionButtonIcon
(
R
.
drawable
.
ic_keyboard_black_24dp
)
setReactionButtonIcon
(
R
.
drawable
.
ic_keyboard_black_24dp
)
}
else
{
}
else
{
// If popup is showing, simply dismiss it to show the underlying text keyboard
// If popup is showing, simply dismiss it to show the underlying text keyboard
emojiKeyboardPopup
.
dismiss
()
dismissEmojiKeyboard
()
setReactionButtonIcon
(
R
.
drawable
.
ic_reaction_24dp
)
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/Dialog.kt
View file @
e826fd78
...
@@ -7,6 +7,7 @@ import androidx.core.view.isVisible
...
@@ -7,6 +7,7 @@ import androidx.core.view.isVisible
import
chat.rocket.android.emoji.internal.GlideApp
import
chat.rocket.android.emoji.internal.GlideApp
import
chat.rocket.android.util.extensions.getFileName
import
chat.rocket.android.util.extensions.getFileName
import
chat.rocket.android.util.extensions.getMimeType
import
chat.rocket.android.util.extensions.getMimeType
import
com.bumptech.glide.load.resource.gif.GifDrawable
import
com.bumptech.glide.request.target.SimpleTarget
import
com.bumptech.glide.request.target.SimpleTarget
import
com.bumptech.glide.request.transition.Transition
import
com.bumptech.glide.request.transition.Transition
...
@@ -21,22 +22,32 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) {
...
@@ -21,22 +22,32 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) {
description
.
text
.
clear
()
description
.
text
.
clear
()
when
{
when
{
mimeType
.
startsWith
(
"image"
)
->
{
mimeType
.
startsWith
(
"image"
)
->
{
GlideApp
if
(
mimeType
.
contains
(
"gif"
))
{
.
with
(
context
)
GlideApp
.
asBitmap
()
.
with
(
context
)
.
load
(
uri
)
.
asGif
()
.
override
(
imagePreview
.
width
,
imagePreview
.
height
)
.
load
(
uri
)
.
fitCenter
()
.
override
(
imagePreview
.
width
,
imagePreview
.
height
)
.
into
(
object
:
SimpleTarget
<
Bitmap
>()
{
.
fitCenter
()
override
fun
onResourceReady
(
.
into
(
imagePreview
)
resource
:
Bitmap
,
}
else
{
transition
:
Transition
<
in
Bitmap
>?
GlideApp
)
{
.
with
(
context
)
bitmap
=
resource
.
asBitmap
()
imagePreview
.
setImageBitmap
(
resource
)
.
load
(
uri
)
imagePreview
.
isVisible
=
true
.
override
(
imagePreview
.
width
,
imagePreview
.
height
)
}
.
fitCenter
()
})
.
into
(
object
:
SimpleTarget
<
Bitmap
>()
{
override
fun
onResourceReady
(
resource
:
Bitmap
,
transition
:
Transition
<
in
Bitmap
>?
)
{
bitmap
=
resource
imagePreview
.
setImageBitmap
(
resource
)
}
})
}
imagePreview
.
isVisible
=
true
}
}
mimeType
.
startsWith
(
"video"
)
->
audioVideoAttachment
.
isVisible
=
true
mimeType
.
startsWith
(
"video"
)
->
audioVideoAttachment
.
isVisible
=
true
else
->
{
else
->
{
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
View file @
e826fd78
...
@@ -79,6 +79,17 @@ private fun ChatRoomFragment.setupSearchMessageMenuItem(menu: Menu, context: Con
...
@@ -79,6 +79,17 @@ private fun ChatRoomFragment.setupSearchMessageMenuItem(menu: Menu, context: Con
.
setShowAsActionFlags
(
.
setShowAsActionFlags
(
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
or
MenuItem
.
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
or
MenuItem
.
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
)
)
.
setOnActionExpandListener
(
object
:
MenuItem
.
OnActionExpandListener
{
override
fun
onMenuItemActionExpand
(
item
:
MenuItem
?):
Boolean
{
dismissEmojiKeyboard
()
return
true
}
override
fun
onMenuItemActionCollapse
(
item
:
MenuItem
?):
Boolean
{
dismissEmojiKeyboard
()
return
true
}
})
(
searchItem
?.
actionView
as
?
SearchView
)
?.
let
{
(
searchItem
?.
actionView
as
?
SearchView
)
?.
let
{
// TODO: Check why we need to stylize the search text programmatically instead of by defining it in the styles.xml (ChatRoom.SearchView)
// TODO: Check why we need to stylize the search text programmatically instead of by defining it in the styles.xml (ChatRoom.SearchView)
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
e826fd78
...
@@ -13,7 +13,6 @@ import android.text.style.ReplacementSpan
...
@@ -13,7 +13,6 @@ import android.text.style.ReplacementSpan
import
android.view.View
import
android.view.View
import
androidx.core.content.res.ResourcesCompat
import
androidx.core.content.res.ResourcesCompat
import
androidx.core.util.PatternsCompat
import
androidx.core.util.PatternsCompat
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.ui.StrikethroughDelimiterProcessor
import
chat.rocket.android.chatroom.ui.StrikethroughDelimiterProcessor
import
chat.rocket.android.emoji.EmojiParser
import
chat.rocket.android.emoji.EmojiParser
import
chat.rocket.android.emoji.EmojiRepository
import
chat.rocket.android.emoji.EmojiRepository
...
@@ -32,6 +31,7 @@ import org.commonmark.node.Emphasis
...
@@ -32,6 +31,7 @@ import org.commonmark.node.Emphasis
import
org.commonmark.node.ListItem
import
org.commonmark.node.ListItem
import
org.commonmark.node.Node
import
org.commonmark.node.Node
import
org.commonmark.node.OrderedList
import
org.commonmark.node.OrderedList
import
org.commonmark.node.SoftLineBreak
import
org.commonmark.node.StrongEmphasis
import
org.commonmark.node.StrongEmphasis
import
org.commonmark.parser.Parser
import
org.commonmark.parser.Parser
import
ru.noties.markwon.SpannableBuilder
import
ru.noties.markwon.SpannableBuilder
...
@@ -219,6 +219,11 @@ class MessageParser @Inject constructor(
...
@@ -219,6 +219,11 @@ class MessageParser @Inject constructor(
builder
.
append
(
'\n'
)
builder
.
append
(
'\n'
)
}
}
}
}
override
fun
visit
(
softLineBreak
:
SoftLineBreak
)
{
super
.
visit
(
softLineBreak
)
builder
.
append
(
"\n"
)
}
}
}
class
LinkVisitor
(
private
val
builder
:
SpannableBuilder
)
:
AbstractVisitor
()
{
class
LinkVisitor
(
private
val
builder
:
SpannableBuilder
)
:
AbstractVisitor
()
{
...
...
app/src/main/java/chat/rocket/android/members/adapter/MembersAdapter.kt
View file @
e826fd78
...
@@ -43,6 +43,7 @@ class MembersAdapter(private val listener: (MemberUiModel) -> Unit) :
...
@@ -43,6 +43,7 @@ class MembersAdapter(private val listener: (MemberUiModel) -> Unit) :
fun
bind
(
memberUiModel
:
MemberUiModel
,
listener
:
(
MemberUiModel
)
->
Unit
)
=
with
(
itemView
)
{
fun
bind
(
memberUiModel
:
MemberUiModel
,
listener
:
(
MemberUiModel
)
->
Unit
)
=
with
(
itemView
)
{
image_avatar
.
setImageURI
(
memberUiModel
.
avatarUri
)
image_avatar
.
setImageURI
(
memberUiModel
.
avatarUri
)
text_member
.
content
=
memberUiModel
.
displayName
text_member
.
content
=
memberUiModel
.
displayName
text_member
.
setCompoundDrawablesRelativeWithIntrinsicBounds
(
DrawableHelper
.
getUserStatusDrawable
(
memberUiModel
.
status
,
context
),
null
,
null
,
null
)
setOnClickListener
{
listener
(
memberUiModel
)
}
setOnClickListener
{
listener
(
memberUiModel
)
}
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/members/uimodel/MemberUiModel.kt
View file @
e826fd78
...
@@ -3,6 +3,7 @@ package chat.rocket.android.members.uimodel
...
@@ -3,6 +3,7 @@ package chat.rocket.android.members.uimodel
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.common.model.User
import
chat.rocket.common.model.User
import
chat.rocket.common.model.UserStatus
import
chat.rocket.core.model.Value
import
chat.rocket.core.model.Value
class
MemberUiModel
(
class
MemberUiModel
(
...
@@ -16,6 +17,7 @@ class MemberUiModel(
...
@@ -16,6 +17,7 @@ class MemberUiModel(
val
username
:
String
?
val
username
:
String
?
val
email
:
String
?
val
email
:
String
?
val
utcOffset
:
Float
?
val
utcOffset
:
Float
?
val
status
:
UserStatus
?
init
{
init
{
avatarUri
=
getUserAvatar
()
avatarUri
=
getUserAvatar
()
...
@@ -24,6 +26,7 @@ class MemberUiModel(
...
@@ -24,6 +26,7 @@ class MemberUiModel(
username
=
getUserUsername
()
username
=
getUserUsername
()
email
=
getUserEmail
()
email
=
getUserEmail
()
utcOffset
=
getUserUtcOffset
()
utcOffset
=
getUserUtcOffset
()
status
=
getUserStatus
()
}
}
private
fun
getUserAvatar
():
String
?
{
private
fun
getUserAvatar
():
String
?
{
...
@@ -47,4 +50,6 @@ class MemberUiModel(
...
@@ -47,4 +50,6 @@ class MemberUiModel(
private
fun
getUserEmail
():
String
?
=
member
.
emails
?.
get
(
0
)
?.
address
private
fun
getUserEmail
():
String
?
=
member
.
emails
?.
get
(
0
)
?.
address
private
fun
getUserUtcOffset
():
Float
?
=
member
.
utcOffset
private
fun
getUserUtcOffset
():
Float
?
=
member
.
utcOffset
private
fun
getUserStatus
():
UserStatus
?
=
member
.
status
}
}
\ No newline at end of file
app/src/main/res/layout/item_member.xml
View file @
e826fd78
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"?android:attr/selectableItemBackground"
android:background=
"?android:attr/selectableItemBackground"
android:paddingBottom=
"@dimen/member_item_top_and_bottom_padding"
android:paddingEnd=
"@dimen/screen_edge_left_and_right_padding"
android:paddingStart=
"@dimen/screen_edge_left_and_right_padding"
android:paddingStart=
"@dimen/screen_edge_left_and_right_padding"
android:paddingTop=
"@dimen/member_item_top_and_bottom_padding"
>
android:paddingTop=
"@dimen/member_item_top_and_bottom_padding"
android:paddingEnd=
"@dimen/screen_edge_left_and_right_padding"
android:paddingBottom=
"@dimen/member_item_top_and_bottom_padding"
>
<include
<include
android:id=
"@+id/layout_avatar"
android:id=
"@+id/layout_avatar"
...
@@ -24,9 +24,11 @@
...
@@ -24,9 +24,11 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
android:drawablePadding=
"@dimen/text_view_drawable_padding"
app:layout_constraintBottom_toBottomOf=
"@+id/layout_avatar"
app:layout_constraintBottom_toBottomOf=
"@+id/layout_avatar"
app:layout_constraintLeft_toRightOf=
"@+id/layout_avatar"
app:layout_constraintLeft_toRightOf=
"@+id/layout_avatar"
app:layout_constraintTop_toTopOf=
"@+id/layout_avatar"
app:layout_constraintTop_toTopOf=
"@+id/layout_avatar"
tools:drawableStart=
"@drawable/ic_status_invisible_12dp"
tools:text=
"Ronald Perkins"
/>
tools:text=
"Ronald Perkins"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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