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
17e45a7e
Commit
17e45a7e
authored
Jun 28, 2018
by
divyanshu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made requested changes
parent
bf2533c0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
51 deletions
+78
-51
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+76
-22
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+1
-1
chatroom_actions.xml
app/src/main/res/menu/chatroom_actions.xml
+1
-1
strings.xml
app/src/main/res/values-es/strings.xml
+0
-4
strings.xml
app/src/main/res/values-fr/strings.xml
+0
-4
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+0
-3
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+0
-4
strings.xml
app/src/main/res/values-uk-rRU/strings.xml
+0
-8
strings.xml
app/src/main/res/values/strings.xml
+0
-4
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
17e45a7e
package
chat.rocket.android.chatroom.ui
import
android.app.Activity
import
android.app.AlertDialog
import
android.content.ClipData
import
android.content.ClipboardManager
import
android.content.Context
...
...
@@ -8,17 +9,32 @@ import android.content.Intent
import
android.net.Uri
import
android.os.Bundle
import
android.os.Handler
import
android.text.SpannableStringBuilder
import
android.view.KeyEvent
import
android.view.LayoutInflater
import
android.view.Menu
import
android.view.MenuInflater
import
android.view.MenuItem
import
android.view.View
import
android.view.ViewGroup
import
android.widget.EditText
import
android.widget.Button
import
android.widget.FrameLayout
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.annotation.DrawableRes
import
androidx.core.text.bold
import
androidx.core.view.isVisible
import
androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
android.text.SpannableStringBuilder
import
android.view.*
import
androidx.core.text.bold
import
androidx.core.view.isVisible
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.adapter.*
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.adapter.CommandSuggestionsAdapter
import
chat.rocket.android.chatroom.adapter.PEOPLE
import
chat.rocket.android.chatroom.adapter.PeopleSuggestionsAdapter
import
chat.rocket.android.chatroom.adapter.RoomSuggestionsAdapter
import
chat.rocket.android.chatroom.presentation.ChatRoomPresenter
import
chat.rocket.android.chatroom.presentation.ChatRoomView
import
chat.rocket.android.chatroom.uimodel.BaseUiModel
...
...
@@ -26,20 +42,17 @@ import chat.rocket.android.chatroom.uimodel.MessageUiModel
import
chat.rocket.android.chatroom.uimodel.suggestion.ChatRoomSuggestionUiModel
import
chat.rocket.android.chatroom.uimodel.suggestion.CommandSuggestionUiModel
import
chat.rocket.android.chatroom.uimodel.suggestion.PeopleSuggestionUiModel
import
chat.rocket.android.emoji.ComposerEditText
import
chat.rocket.android.emoji.Emoji
import
chat.rocket.android.emoji.EmojiKeyboardListener
import
chat.rocket.android.emoji.EmojiKeyboardPopup
import
chat.rocket.android.emoji.EmojiParser
import
chat.rocket.android.emoji.EmojiPickerPopup
import
chat.rocket.android.emoji.EmojiReactionListener
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.extensions.asObservable
import
chat.rocket.android.util.extensions.circularRevealOrUnreveal
import
chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.hideKeyboard
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.rotateBy
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.widget.emoji.*
import
chat.rocket.android.util.extensions.*
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.core.internal.realtime.socket.model.State
...
...
@@ -200,9 +213,51 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
resultData
:
Intent
?)
{
if
(
requestCode
==
REQUEST_CODE_FOR_PERFORM_SAF
&&
resultCode
==
Activity
.
RESULT_OK
)
{
if
(
resultData
!=
null
)
{
uploadFile
(
resultData
.
data
)
fileAttachmentDialog
(
resultData
.
data
)
}
}
}
private
fun
fileAttachmentDialog
(
data
:
Uri
)
{
val
builder
=
AlertDialog
.
Builder
(
activity
)
val
dialogView
=
View
.
inflate
(
context
,
R
.
layout
.
file_attachments_dialog
,
null
)
builder
.
setView
(
dialogView
)
val
alertDialog
=
builder
.
create
()
dialogView
?.
let
{
val
imagePreview
=
it
.
findViewById
<
ImageView
>(
R
.
id
.
image_preview
)
val
sendButton
=
it
.
findViewById
<
Button
>(
R
.
id
.
button_send
)
val
cancelButton
:
Button
=
it
.
findViewById
(
R
.
id
.
button_cancel
)
val
description
=
it
.
findViewById
<
EditText
>(
R
.
id
.
text_file_description
)
val
audioVideoAttachment
=
it
.
findViewById
<
FrameLayout
>(
R
.
id
.
audio_video_attachment
)
val
textFile
=
it
.
findViewById
<
TextView
>(
R
.
id
.
text_file_name
)
activity
?.
let
{
data
.
getMimeType
(
it
).
apply
{
when
{
this
.
startsWith
(
"image"
)
->
{
imagePreview
.
isVisible
=
true
imagePreview
.
setImageURI
(
data
)
}
this
.
startsWith
(
"video"
)
->
{
audioVideoAttachment
.
isVisible
=
true
}
else
->
{
textFile
.
isVisible
=
true
textFile
.
text
=
data
.
getFileName
(
it
)
}
}
}
}
sendButton
.
setOnClickListener
{
uploadFile
(
data
,
description
.
text
.
toString
())
alertDialog
.
dismiss
()
}
cancelButton
.
setOnClickListener
{
alertDialog
.
dismiss
()
}
}
alertDialog
.
show
()
}
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
...
...
@@ -399,9 +454,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
override
fun
uploadFile
(
uri
:
Uri
)
{
// TODO Just leaving a blank message that comes with the file for now. In the future lets add the possibility to add a message with the file to be uploaded.
presenter
.
uploadFile
(
chatRoomId
,
uri
,
""
)
override
fun
uploadFile
(
uri
:
Uri
,
msg
:
String
)
{
presenter
.
uploadFile
(
chatRoomId
,
uri
,
msg
)
}
override
fun
showInvalidFileMessage
()
{
...
...
@@ -556,7 +610,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
showReactionsPopup
(
messageId
:
String
)
{
ui
{
val
emojiPickerPopup
=
EmojiPickerPopup
(
it
)
emojiPickerPopup
.
listener
=
object
:
Emoji
ListenerAdapter
()
{
emojiPickerPopup
.
listener
=
object
:
Emoji
KeyboardListener
{
override
fun
onEmojiAdded
(
emoji
:
Emoji
)
{
onReactionAdded
(
messageId
,
emoji
)
}
...
...
@@ -633,7 +687,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
recycler_view
.
layoutManager
=
linearLayoutManager
recycler_view
.
itemAnimator
=
DefaultItemAnimator
()
endlessRecyclerViewScrollListener
=
object
:
EndlessRecyclerViewScrollListener
(
recycler_view
.
layoutManager
as
LinearLayoutManager
)
{
EndlessRecyclerViewScrollListener
(
recycler_view
.
layoutManager
as
LinearLayoutManager
)
{
override
fun
onLoadMore
(
page
:
Int
,
totalItemsCount
:
Int
,
recyclerView
:
RecyclerView
)
{
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
,
page
*
30L
)
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
17e45a7e
...
...
@@ -148,7 +148,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
inflater
.
inflate
(
R
.
menu
.
chatrooms
,
menu
)
val
searchItem
=
menu
.
findItem
(
R
.
id
.
action_search
)
searchView
=
searchItem
?.
actionView
as
SearchView
searchView
=
searchItem
?.
actionView
as
SearchView
?
searchView
?.
maxWidth
=
Integer
.
MAX_VALUE
searchView
?.
setOnQueryTextListener
(
object
:
SearchView
.
OnQueryTextListener
{
override
fun
onQueryTextSubmit
(
query
:
String
?):
Boolean
{
...
...
app/src/main/res/menu/chatroom_actions.xml
View file @
17e45a7e
...
...
@@ -9,7 +9,7 @@
<item
android:id=
"@+id/action_mentions"
android:title=
"@string/msg_mentions"
a
pp
:showAsAction=
"never"
/>
a
ndroid
:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_pinned_messages"
...
...
app/src/main/res/values-es/strings.xml
View file @
17e45a7e
...
...
@@ -140,10 +140,6 @@
// TODO: Add proper translation.
<string
name=
"msg_delete_message"
>
Delete Message
</string>
<string
name=
"msg_delete_description"
>
Are you sure you want to delete this message
</string>
// TODO: Add proper translation.
<string
name=
"msg_upload_file"
>
Upload file
</string>
<string
name=
"msg_file_description"
>
File description
</string>
<string
name=
"msg_send"
>
Send
</string>
<!-- Create channel messages -->
// TODO: Add proper translation.
...
...
app/src/main/res/values-fr/strings.xml
View file @
17e45a7e
...
...
@@ -138,10 +138,6 @@
// TODO: Add proper translation.
<string
name=
"msg_delete_message"
>
Delete Message
</string>
<string
name=
"msg_delete_description"
>
Are you sure you want to delete this message
</string>
// TODO: Add proper translation.
<string
name=
"msg_upload_file"
>
Upload file
</string>
<string
name=
"msg_file_description"
>
File description
</string>
<string
name=
"msg_send"
>
Send
</string>
<!-- Create channel messages -->
// TODO: Add proper translation.
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
17e45a7e
...
...
@@ -128,9 +128,6 @@
<string
name=
"msg_send"
>
भेजें
</string>
<string
name=
"msg_delete_message"
>
संदेश को हटाएं
</string>
<string
name=
"msg_delete_description"
>
क्या आप निश्चित रूप से यह संदेश हटाना चाहते हैं
</string>
<string
name=
"msg_upload_file"
>
फाइल अपलोड करें
</string>
<string
name=
"msg_file_description"
>
फाइल विवरण
</string>
<string
name=
"msg_send"
>
भेजें
</string>
<!-- Create channel messages -->
// TODO: Add proper translation.
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
17e45a7e
...
...
@@ -125,10 +125,6 @@
// TODO: Add proper translation.
<string
name=
"msg_delete_message"
>
Delete Message
</string>
<string
name=
"msg_delete_description"
>
Are you sure you want to delete this message
</string>
// TODO: Add proper translation.
<string
name=
"msg_upload_file"
>
Upload file
</string>
<string
name=
"msg_file_description"
>
File description
</string>
<string
name=
"msg_send"
>
Send
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
Privado
</string>
...
...
app/src/main/res/values-uk-rRU/strings.xml
View file @
17e45a7e
...
...
@@ -120,18 +120,10 @@
<string
name=
"msg_file_description"
>
Описание файла
</string>
<string
name=
"msg_send"
>
послать
</string>
// TODO: Add proper translation.
<string
name=
"msg_delete_message"
>
Delete Message
</string>
<string
name=
"msg_delete_description"
>
Are you sure you want to delete this message
</string>
<string
name=
"msg_channel_name"
>
Назва каналу
</string>
<string
name=
"msg_search"
>
Пошук
</string>
<string
name=
"msg_delete_message"
>
Удалить сообщение
</string>
<string
name=
"msg_delete_description"
>
Вы уверены, что хотите удалить это сообщение?
</string>
<string
name=
"msg_channel_name"
>
Название канала
</string>
<string
name=
"msg_search"
>
Поиск
</string>
// TODO: Add proper translation.
<string
name=
"msg_upload_file"
>
Upload file
</string>
<string
name=
"msg_file_description"
>
File description
</string>
<string
name=
"msg_send"
>
Send
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
Приватный
</string>
...
...
app/src/main/res/values/strings.xml
View file @
17e45a7e
...
...
@@ -134,11 +134,7 @@
<string
name=
"msg_member_already_added"
>
You have already selected this user
</string>
<string
name=
"msg_member_not_found"
>
Member not found
</string>
<string
name=
"msg_channel_created_successfully"
>
Channel created successfully
</string>
<string
name=
"msg_message_copied"
>
Message copied
</string>
<string
name=
"msg_upload_file"
>
Upload file
</string>
<string
name=
"msg_file_description"
>
File description
</string>
<string
name=
"msg_send"
>
Send
</string>
<string
name=
"msg_delete_message"
>
Delete Message
</string>
<string
name=
"msg_delete_description"
>
Are you sure you want to delete this message
</string>
...
...
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