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
2034a665
Commit
2034a665
authored
Jul 13, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add search view inside the chat room.
parent
3f2148d1
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
284 additions
and
122 deletions
+284
-122
build.gradle
app/build.gradle
+0
-1
ChatRoomAdapter.kt
...a/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
+5
-0
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+44
-11
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+9
-2
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+30
-82
Dialog.kt
app/src/main/java/chat/rocket/android/chatroom/ui/Dialog.kt
+0
-0
Menu.kt
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
+126
-0
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+2
-9
CreateChannelFragment.kt
.../rocket/android/createchannel/ui/CreateChannelFragment.kt
+1
-2
ProfileFragment.kt
...in/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+1
-0
PasswordFragment.kt
...t/rocket/android/settings/password/ui/PasswordFragment.kt
+1
-1
ic_search_white_24dp.xml
app/src/main/res/drawable/ic_search_white_24dp.xml
+4
-3
chatrooms.xml
app/src/main/res/menu/chatrooms.xml
+1
-1
strings.xml
app/src/main/res/values-es/strings.xml
+5
-1
strings.xml
app/src/main/res/values-fr/strings.xml
+6
-1
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+6
-1
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+4
-2
strings.xml
app/src/main/res/values-uk-rRU/strings.xml
+6
-1
strings.xml
app/src/main/res/values/strings.xml
+3
-0
styles.xml
app/src/main/res/values/styles.xml
+8
-3
build.gradle
util/build.gradle
+4
-0
Rx.kt
util/src/main/java/chat/rocket/android/util/extension/Rx.kt
+1
-1
Widget.kt
...rc/main/java/chat/rocket/android/util/extension/Widget.kt
+17
-0
No files found.
app/build.gradle
View file @
2034a665
...
...
@@ -108,7 +108,6 @@ dependencies {
implementation
libraries
.
timber
implementation
libraries
.
threeTenABP
implementation
libraries
.
rxBinding
implementation
libraries
.
fresco
api
libraries
.
frescoOkHttp
...
...
app/src/main/java/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
View file @
2034a665
...
...
@@ -139,6 +139,11 @@ class ChatRoomAdapter(
}
}
fun
clearData
()
{
dataSet
.
clear
()
notifyDataSetChanged
()
}
fun
appendData
(
dataSet
:
List
<
BaseUiModel
<*
>>)
{
val
previousDataSetSize
=
this
.
dataSet
.
size
this
.
dataSet
.
addAll
(
dataSet
)
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
2034a665
package
chat.rocket.android.chatroom.presentation
import
android.graphics.BitmapFactory
import
android.net.Uri
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.adapter.AutoCompleteType
...
...
@@ -64,6 +63,7 @@ import chat.rocket.core.internal.rest.unstarMessage
import
chat.rocket.core.internal.rest.updateMessage
import
chat.rocket.core.internal.rest.uploadFile
import
chat.rocket.core.internal.rest.favorite
import
chat.rocket.core.internal.rest.searchMessages
import
chat.rocket.core.model.ChatRoomRole
import
chat.rocket.core.model.Command
import
chat.rocket.core.model.Message
...
...
@@ -158,7 +158,12 @@ class ChatRoomPresenter @Inject constructor(
}
?:
false
}
fun
loadMessages
(
chatRoomId
:
String
,
chatRoomType
:
String
,
offset
:
Long
=
0
)
{
fun
loadMessages
(
chatRoomId
:
String
,
chatRoomType
:
String
,
offset
:
Long
=
0
,
clearDataSet
:
Boolean
=
false
)
{
this
.
chatRoomId
=
chatRoomId
this
.
chatRoomType
=
chatRoomType
launchUI
(
strategy
)
{
...
...
@@ -173,13 +178,13 @@ class ChatRoomPresenter @Inject constructor(
)
)
if
(
oldMessages
.
isNotEmpty
())
{
view
.
showMessages
(
oldMessages
)
view
.
showMessages
(
oldMessages
,
clearDataSet
)
loadMissingMessages
()
}
else
{
loadAndShowMessages
(
chatRoomId
,
chatRoomType
,
offset
)
loadAndShowMessages
(
chatRoomId
,
chatRoomType
,
offset
,
clearDataSet
)
}
}
else
{
loadAndShowMessages
(
chatRoomId
,
chatRoomType
,
offset
)
loadAndShowMessages
(
chatRoomId
,
chatRoomType
,
offset
,
clearDataSet
)
}
// TODO: For now we are marking the room as read if we can get the messages (I mean, no exception occurs)
...
...
@@ -206,21 +211,49 @@ class ChatRoomPresenter @Inject constructor(
private
suspend
fun
loadAndShowMessages
(
chatRoomId
:
String
,
chatRoomType
:
String
,
offset
:
Long
=
0
offset
:
Long
=
0
,
clearDataSet
:
Boolean
)
{
val
messages
=
retryIO
(
description
=
"messages chatRoom: $chatRoomId, type: $chatRoomType, offset:
$offset"
)
{
retryIO
(
"loadAndShowMessages($chatRoomId, $chatRoomType,
$offset"
)
{
client
.
messages
(
chatRoomId
,
roomTypeOf
(
chatRoomType
),
offset
,
30
).
result
}
messagesRepository
.
saveAll
(
messages
)
view
.
showMessages
(
mapper
.
map
(
messages
,
RoomUiModel
(
roles
=
chatRoles
,
isBroadcast
=
chatIsBroadcast
,
isRoom
=
true
))
mapper
.
map
(
messages
,
RoomUiModel
(
roles
=
chatRoles
,
isBroadcast
=
chatIsBroadcast
,
isRoom
=
true
)
),
clearDataSet
)
}
fun
searchMessages
(
chatRoomId
:
String
,
searchText
:
String
)
{
launchUI
(
strategy
)
{
try
{
view
.
showLoading
()
val
messages
=
retryIO
(
"searchMessages($chatRoomId, $searchText)"
)
{
client
.
searchMessages
(
chatRoomId
,
searchText
).
result
}
view
.
showSearchedMessages
(
mapper
.
map
(
messages
,
RoomUiModel
(
chatRoles
,
chatIsBroadcast
,
true
)
)
)
}
catch
(
ex
:
Exception
)
{
Timber
.
e
(
ex
)
ex
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
}
finally
{
view
.
hideLoading
()
}
}
}
fun
sendMessage
(
chatRoomId
:
String
,
text
:
String
,
messageId
:
String
?)
{
launchUI
(
strategy
)
{
try
{
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
2034a665
package
chat.rocket.android.chatroom.presentation
import
android.net.Uri
import
chat.rocket.android.chatroom.uimodel.BaseUiModel
import
chat.rocket.android.chatroom.uimodel.suggestion.ChatRoomSuggestionUiModel
import
chat.rocket.android.chatroom.uimodel.suggestion.CommandSuggestionUiModel
...
...
@@ -23,8 +22,16 @@ interface ChatRoomView : LoadingView, MessageView {
* Shows the chat room messages.
*
* @param dataSet The data set to show.
* @param clearDataSet If true it will clear the previous data set.
*/
fun
showMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>)
fun
showMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>,
clearDataSet
:
Boolean
)
/**
* Shows the chat room messages in the basis of a search term.
*
* @param dataSet The data set to show.
*/
fun
showSearchedMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>)
/**
* Send a message to a chat room.
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
2034a665
...
...
@@ -53,7 +53,7 @@ import chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.helper.ImageHelper
import
chat.rocket.android.util.extension
s
.asObservable
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.circularRevealOrUnreveal
import
chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
...
...
@@ -117,12 +117,12 @@ private const val BUNDLE_CHAT_ROOM_IS_CREATOR = "chat_room_is_creator"
private
const
val
BUNDLE_CHAT_ROOM_IS_FAVORITE
=
"chat_room_is_favorite"
private
const
val
BUNDLE_CHAT_ROOM_MESSAGE
=
"chat_room_message"
private
const
val
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
=
1
private
const
val
MENU_ACTION_MEMBER
=
2
private
const
val
MENU_ACTION_MENTIONS
=
3
private
const
val
MENU_ACTION_PINNED_MESSAGES
=
4
private
const
val
MENU_ACTION_FAVORITE_MESSAGES
=
5
private
const
val
MENU_ACTION_FILES
=
6
internal
const
val
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
=
1
internal
const
val
MENU_ACTION_MEMBER
=
2
internal
const
val
MENU_ACTION_MENTIONS
=
3
internal
const
val
MENU_ACTION_PINNED_MESSAGES
=
4
internal
const
val
MENU_ACTION_FAVORITE_MESSAGES
=
5
internal
const
val
MENU_ACTION_FILES
=
6
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
,
EmojiKeyboardListener
,
EmojiReactionListener
{
@Inject
...
...
@@ -132,13 +132,13 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
lateinit
var
adapter
:
ChatRoomAdapter
internal
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomName
:
String
private
lateinit
var
chatRoomType
:
String
internal
lateinit
var
chatRoomType
:
String
private
var
newMessageCount
:
Int
=
0
private
var
chatRoomMessage
:
String
?
=
null
private
var
isSubscribed
:
Boolean
=
true
private
var
isReadOnly
:
Boolean
=
false
private
var
isCreator
:
Boolean
=
false
private
var
isFavorite
:
Boolean
=
false
internal
var
isFavorite
:
Boolean
=
false
private
var
isBroadcastChannel
:
Boolean
=
false
private
lateinit
var
emojiKeyboardPopup
:
EmojiKeyboardPopup
private
var
chatRoomLastSeen
:
Long
=
-
1
...
...
@@ -149,6 +149,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
val
compositeDisposable
=
CompositeDisposable
()
private
var
playComposeMessageButtonsAnimation
=
true
internal
var
isSearchTermQueried
=
false
// For reveal and unreveal anim.
private
val
hypotenuse
by
lazy
{
Math
.
hypot
(
...
...
@@ -245,87 +247,22 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
resultData
:
Intent
?)
{
if
(
resultData
!=
null
&&
resultCode
==
Activity
.
RESULT_OK
)
{
when
(
requestCode
)
{
REQUEST_CODE_FOR_PERFORM_SAF
->
{
showFileAttachmentDialog
(
resultData
.
data
)
}
REQUEST_CODE_FOR_DRAW
->
{
showDrawAttachmentDialog
(
REQUEST_CODE_FOR_PERFORM_SAF
->
showFileAttachmentDialog
(
resultData
.
data
)
REQUEST_CODE_FOR_DRAW
->
showDrawAttachmentDialog
(
resultData
.
getByteArrayExtra
(
DRAWING_BYTE_ARRAY_EXTRA_DATA
)
)
}
}
}
}
override
fun
onPrepareOptionsMenu
(
menu
:
Menu
)
{
menu
.
clear
()
if
(
isFavorite
)
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
,
Menu
.
NONE
,
R
.
string
.
title_unfavorite_chat
)
.
setIcon
(
R
.
drawable
.
ic_star_yellow_24dp
)
.
setShowAsAction
(
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
)
}
else
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
,
Menu
.
NONE
,
R
.
string
.
title_favorite_chat
)
.
setIcon
(
R
.
drawable
.
ic_star_border_white_24dp
)
.
setShowAsAction
(
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
)
}
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_MEMBER
,
Menu
.
NONE
,
R
.
string
.
title_members_list
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_MENTIONS
,
Menu
.
NONE
,
R
.
string
.
msg_mentions
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_PINNED_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_pinned_messages
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_favorite_messages
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FILES
,
Menu
.
NONE
,
R
.
string
.
title_files
)
setupMenu
(
menu
)
super
.
onPrepareOptionsMenu
(
menu
)
}
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
when
(
item
.
itemId
)
{
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
->
{
presenter
.
toggleFavoriteChatRoom
(
chatRoomId
,
isFavorite
)
}
MENU_ACTION_MEMBER
->
presenter
.
toMembersList
(
chatRoomId
)
MENU_ACTION_MENTIONS
->
presenter
.
toMentions
(
chatRoomId
)
MENU_ACTION_PINNED_MESSAGES
->
presenter
.
toPinnedMessageList
(
chatRoomId
)
MENU_ACTION_FAVORITE_MESSAGES
->
presenter
.
toFavoriteMessageList
(
chatRoomId
)
MENU_ACTION_FILES
->
presenter
.
toFileList
(
chatRoomId
)
}
setOnMenuItemClickListener
(
item
)
return
true
}
...
...
@@ -334,8 +271,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
activity
?.
invalidateOptionsMenu
()
}
override
fun
showMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>)
{
override
fun
showMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>
,
clearDataSet
:
Boolean
)
{
ui
{
if
(
clearDataSet
)
{
adapter
.
clearData
()
}
// track the message sent immediately after the current message
var
prevMessageUiModel
:
MessageUiModel
?
=
null
...
...
@@ -384,6 +325,13 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
override
fun
showSearchedMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>)
{
recycler_view
.
removeOnScrollListener
(
endlessRecyclerViewScrollListener
)
adapter
.
clearData
()
adapter
.
prependData
(
dataSet
)
empty_chat_view
.
isVisible
=
adapter
.
itemCount
==
0
}
override
fun
onRoomUpdated
(
userCanPost
:
Boolean
,
channelIsBroadcast
:
Boolean
,
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/
Attachment
.kt
→
app/src/main/java/chat/rocket/android/chatroom/ui/
Dialog
.kt
View file @
2034a665
File moved
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
0 → 100644
View file @
2034a665
package
chat.rocket.android.chatroom.ui
import
android.content.Context
import
android.view.Menu
import
android.view.MenuItem
import
android.widget.EditText
import
androidx.appcompat.widget.SearchView
import
androidx.core.content.res.ResourcesCompat
import
chat.rocket.android.R
import
chat.rocket.android.util.extension.onQueryTextListener
internal
fun
ChatRoomFragment
.
setupMenu
(
menu
:
Menu
)
{
setupSearchMessageMenuItem
(
menu
,
requireContext
())
setupFavoriteMenuItem
(
menu
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_MEMBER
,
Menu
.
NONE
,
R
.
string
.
title_members_list
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_MENTIONS
,
Menu
.
NONE
,
R
.
string
.
msg_mentions
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_PINNED_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_pinned_messages
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_MESSAGES
,
Menu
.
NONE
,
R
.
string
.
title_favorite_messages
)
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FILES
,
Menu
.
NONE
,
R
.
string
.
title_files
)
}
internal
fun
ChatRoomFragment
.
setOnMenuItemClickListener
(
item
:
MenuItem
)
{
when
(
item
.
itemId
)
{
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
->
presenter
.
toggleFavoriteChatRoom
(
chatRoomId
,
isFavorite
)
MENU_ACTION_MEMBER
->
presenter
.
toMembersList
(
chatRoomId
)
MENU_ACTION_MENTIONS
->
presenter
.
toMentions
(
chatRoomId
)
MENU_ACTION_PINNED_MESSAGES
->
presenter
.
toPinnedMessageList
(
chatRoomId
)
MENU_ACTION_FAVORITE_MESSAGES
->
presenter
.
toFavoriteMessageList
(
chatRoomId
)
MENU_ACTION_FILES
->
presenter
.
toFileList
(
chatRoomId
)
}
}
private
fun
ChatRoomFragment
.
setupSearchMessageMenuItem
(
menu
:
Menu
,
context
:
Context
)
{
val
searchItem
=
menu
.
add
(
Menu
.
NONE
,
Menu
.
NONE
,
Menu
.
NONE
,
R
.
string
.
title_search_message
).
setActionView
(
SearchView
(
context
))
.
setIcon
(
R
.
drawable
.
ic_search_white_24dp
)
.
setShowAsActionFlags
(
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
or
MenuItem
.
SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
)
(
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)
stylizeSearchView
(
it
,
context
)
setupSearchViewTextListener
(
it
)
if
(
it
.
isIconified
)
{
isSearchTermQueried
=
false
}
}
}
private
fun
stylizeSearchView
(
searchView
:
SearchView
,
context
:
Context
)
{
val
searchText
=
searchView
.
findViewById
<
EditText
>(
androidx
.
appcompat
.
R
.
id
.
search_src_text
)
searchText
.
setTextColor
(
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
color_white
,
null
))
searchText
.
setHintTextColor
(
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
color_white
,
null
)
)
}
private
fun
ChatRoomFragment
.
setupSearchViewTextListener
(
searchView
:
SearchView
)
{
searchView
.
onQueryTextListener
{
// TODO: We use isSearchTermQueried to avoid querying when the search view is expanded but the user doesn't start typing. Check for a native solution.
if
(
it
.
isEmpty
()
&&
isSearchTermQueried
)
{
presenter
.
loadMessages
(
chatRoomId
,
chatRoomType
,
clearDataSet
=
true
)
}
else
if
(
it
.
isNotEmpty
()){
presenter
.
searchMessages
(
chatRoomId
,
it
)
isSearchTermQueried
=
true
}
}
}
private
fun
ChatRoomFragment
.
setupFavoriteMenuItem
(
menu
:
Menu
)
{
if
(
isFavorite
)
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
,
Menu
.
NONE
,
R
.
string
.
title_unfavorite_chat
).
setIcon
(
R
.
drawable
.
ic_star_yellow_24dp
)
.
setShowAsAction
(
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
)
}
else
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
,
Menu
.
NONE
,
R
.
string
.
title_favorite_chat
).
setIcon
(
R
.
drawable
.
ic_star_border_white_24dp
)
.
setShowAsAction
(
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
2034a665
...
...
@@ -32,6 +32,7 @@ import chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.helper.ChatRoomsSortOrder
import
chat.rocket.android.helper.Constants
import
chat.rocket.android.helper.SharedPreferenceHelper
import
chat.rocket.android.util.extension.onQueryTextListener
import
chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.inflate
...
...
@@ -164,15 +165,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
searchView
=
searchItem
?.
actionView
as
?
SearchView
searchView
?.
setIconifiedByDefault
(
false
)
searchView
?.
maxWidth
=
Integer
.
MAX_VALUE
searchView
?.
setOnQueryTextListener
(
object
:
SearchView
.
OnQueryTextListener
{
override
fun
onQueryTextSubmit
(
query
:
String
?):
Boolean
{
return
queryChatRoomsByName
(
query
)
}
override
fun
onQueryTextChange
(
newText
:
String
?):
Boolean
{
return
queryChatRoomsByName
(
newText
)
}
})
searchView
?.
onQueryTextListener
{
queryChatRoomsByName
(
it
)
}
val
expandListener
=
object
:
MenuItem
.
OnActionExpandListener
{
override
fun
onMenuItemActionCollapse
(
item
:
MenuItem
):
Boolean
{
...
...
app/src/main/java/chat/rocket/android/createchannel/ui/CreateChannelFragment.kt
View file @
2034a665
...
...
@@ -20,7 +20,7 @@ import chat.rocket.android.createchannel.presentation.CreateChannelView
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.uimodel.MemberUiModel
import
chat.rocket.android.util.extension
s
.asObservable
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
...
...
@@ -221,7 +221,6 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback
LinearLayoutManager
(
context
,
RecyclerView
.
VERTICAL
,
false
)
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
it
,
DividerItemDecoration
.
HORIZONTAL
))
recycler_view
.
adapter
=
adapter
}
}
...
...
app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
View file @
2034a665
...
...
@@ -11,6 +11,7 @@ import chat.rocket.android.R
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.profile.presentation.ProfilePresenter
import
chat.rocket.android.profile.presentation.ProfileView
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.*
import
dagger.android.support.AndroidSupportInjection
import
io.reactivex.disposables.Disposable
...
...
app/src/main/java/chat/rocket/android/settings/password/ui/PasswordFragment.kt
View file @
2034a665
...
...
@@ -9,7 +9,7 @@ import chat.rocket.android.settings.password.presentation.PasswordPresenter
import
chat.rocket.android.settings.password.presentation.PasswordView
import
chat.rocket.android.util.extensions.inflate
import
androidx.appcompat.view.ActionMode
import
chat.rocket.android.util.extension
s
.asObservable
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
dagger.android.support.AndroidSupportInjection
...
...
app/src/main/res/drawable/ic_search_white_24
px
.xml
→
app/src/main/res/drawable/ic_search_white_24
dp
.xml
View file @
2034a665
...
...
@@ -2,8 +2,9 @@
android:width=
"24dp"
android:height=
"24dp"
android:autoMirrored=
"true"
android:viewportHeight=
"24.0"
android:viewportWidth=
"24.0"
>
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FFFFFF"
android:pathData=
"M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"
/>
...
...
app/src/main/res/menu/chatrooms.xml
View file @
2034a665
...
...
@@ -4,7 +4,7 @@
<item
android:id=
"@+id/action_search"
android:icon=
"@drawable/ic_search_white_24
px
"
android:icon=
"@drawable/ic_search_white_24
dp
"
android:title=
"@string/action_search"
app:actionViewClass=
"androidx.appcompat.widget.SearchView"
app:showAsAction=
"ifRoom|collapseActionView"
/>
...
...
app/src/main/res/values-es/strings.xml
View file @
2034a665
...
...
@@ -191,6 +191,10 @@
// TODO: Add proper translation.
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<!-- Search message -->
<!-- TODO Add proper translation-->
<string
name=
"title_search_message"
>
Search message
</string>
<!-- Favorite/Unfavorite chat room -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
...
...
@@ -284,5 +288,5 @@
<string
name=
"notif_action_reply_hint"
>
RESPUESTA
</string>
<string
name=
"notif_error_sending"
>
La respuesta ha fallado. Inténtalo de nuevo.
</string>
<string
name=
"notif_success_sending"
>
Mensaje enviado a %1$s!
</string>
<string
name=
"msg_log_out"
>
Saliendo de tu cuenta
...
</string>
<string
name=
"msg_log_out"
>
Saliendo de tu cuenta
…
</string>
</resources>
app/src/main/res/values-fr/strings.xml
View file @
2034a665
...
...
@@ -193,6 +193,10 @@
// TODO: Add proper translation.
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<!-- Search message -->
<!-- TODO Add proper translation-->
<string
name=
"title_search_message"
>
Search message
</string>
<!-- Favorite/Unfavorite chat room -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
...
...
@@ -286,5 +290,6 @@
<string
name=
"notif_action_reply_hint"
>
RÉPONDRE
</string>
<string
name=
"notif_error_sending"
>
La réponse a échoué. Veuillez réessayer.
</string>
<string
name=
"notif_success_sending"
>
Message envoyé à %1$s!
</string>
<string
name=
"msg_log_out"
>
Logging out...
</string>
<!-- TODO Add proper translation-->
<string
name=
"msg_log_out"
>
Logging out…
</string>
</resources>
app/src/main/res/values-hi-rIN/strings.xml
View file @
2034a665
...
...
@@ -174,6 +174,10 @@
<string
name=
"permission_pinning_not_allowed"
>
पिनि करने की अनुमति नहीं है
</string>
<string
name=
"permission_starring_not_allowed"
>
तारांकित की अनुमति नहीं है
</string>
<!-- Search message -->
<!-- TODO Add proper translation-->
<string
name=
"title_search_message"
>
Search message
</string>
<!-- Favorite/Unfavorite chat room -->
<string
name=
"title_favorite_chat"
>
पसंदीदा चैट
</string>
<string
name=
"title_unfavorite_chat"
>
नापसंद चैट
</string>
...
...
@@ -263,5 +267,6 @@
<string
name=
"notif_action_reply_hint"
>
जवाब
</string>
<string
name=
"notif_error_sending"
>
उत्तर विफल हुआ है। कृपया फिर से प्रयास करें।
</string>
<string
name=
"notif_success_sending"
>
संदेश भेजा गया %1$s!
</string>
<string
name=
"msg_log_out"
>
Logging out...
</string>
<!-- TODO Add proper translation-->
<string
name=
"msg_log_out"
>
Logging out…
</string>
</resources>
\ No newline at end of file
app/src/main/res/values-pt-rBR/strings.xml
View file @
2034a665
...
...
@@ -155,7 +155,6 @@
// TODO:Add proper translation.
<string
name=
"message_credentials_saved_successfully"
>
Credentials saved successfully
</string>
<!-- Message actions -->
<string
name=
"action_msg_reply"
>
Responder
</string>
<string
name=
"action_msg_edit"
>
Editar
</string>
...
...
@@ -176,6 +175,9 @@
<string
name=
"permission_pinning_not_allowed"
>
Pinagem não permitida
</string>
<string
name=
"permission_starring_not_allowed"
>
Favoritar não permitido
</string>
<!-- Search message -->
<string
name=
"title_search_message"
>
Procurar mensagem
</string>
<!-- Favorite/Unfavorite chat room -->
<string
name=
"title_favorite_chat"
>
Favoritar canal
</string>
<string
name=
"title_unfavorite_chat"
>
Desfavoritar canal
</string>
...
...
@@ -265,5 +267,5 @@
<string
name=
"notif_action_reply_hint"
>
RESPONDER
</string>
<string
name=
"notif_error_sending"
>
Falha ao enviar a mensagem.
</string>
<string
name=
"notif_success_sending"
>
Mensagem enviada para %1$s!
</string>
<string
name=
"msg_log_out"
>
Deslogando
...
</string>
<string
name=
"msg_log_out"
>
Deslogando
…
</string>
</resources>
app/src/main/res/values-uk-rRU/strings.xml
View file @
2034a665
...
...
@@ -171,6 +171,10 @@
<string
name=
"permission_pinning_not_allowed"
>
Прикрепление запрещено
</string>
<string
name=
"permission_starring_not_allowed"
>
Отмечивание запрещено
</string>
<!-- Search message -->
<!-- TODO Add proper translation-->
<string
name=
"title_search_message"
>
Search message
</string>
<!-- Favorite/Unfavorite chat room -->
<string
name=
"title_favorite_chat"
>
Добавить чат в избранное
</string>
<string
name=
"title_unfavorite_chat"
>
Удалить чат из избранного
</string>
...
...
@@ -260,5 +264,6 @@
<string
name=
"notif_action_reply_hint"
>
ОТВЕТИТЬ
</string>
<string
name=
"notif_error_sending"
>
Ошибка ответа. Пожалуйста, попробуйте еще раз.
</string>
<string
name=
"notif_success_sending"
>
Сообщение отправлено %1$s!
</string>
<string
name=
"msg_log_out"
>
Logging out...
</string>
<!-- TODO Add proper translation-->
<string
name=
"msg_log_out"
>
Logging out…
</string>
</resources>
app/src/main/res/values/strings.xml
View file @
2034a665
...
...
@@ -175,6 +175,9 @@
<string
name=
"permission_pinning_not_allowed"
>
Pinning is not allowed
</string>
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<!-- Search message -->
<string
name=
"title_search_message"
>
Search message
</string>
<!-- Favorite/Unfavorite chat room -->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
<string
name=
"title_unfavorite_chat"
>
Unfavorite chat
</string>
...
...
app/src/main/res/values/styles.xml
View file @
2034a665
...
...
@@ -9,10 +9,8 @@
<item
name=
"android:statusBarColor"
>
@color/colorPrimaryDark
</item>
<item
name=
"windowActionModeOverlay"
>
true
</item>
</style>
<style
name=
"ToolbarTheme"
parent=
"Base.Widget.AppCompat.Toolbar"
>
<item
name=
"android:colorAccent"
>
@color/colorLightTheme
</item>
<item
name=
"searchViewStyle"
>
@style/ChatRoom.SearchView
</item>
</style>
<style
name=
"AuthenticationTheme"
parent=
"Theme.AppCompat.NoActionBar"
>
...
...
@@ -75,6 +73,13 @@
<item
name=
"android:paddingStart"
>
@dimen/edit_text_margin
</item>
</style>
<style
name=
"ChatRoom.SearchView"
parent=
"Widget.AppCompat.SearchView"
>
<item
name=
"queryHint"
>
@string/title_search_message
</item>
<item
name=
"searchIcon"
>
@drawable/ic_search_white_24dp
</item>
<item
name=
"searchHintIcon"
>
@drawable/ic_search_white_24dp
</item>
<item
name=
"closeIcon"
>
@drawable/ic_close_white_24dp
</item>
</style>
<style
name=
"ChatRooms.Header"
parent=
"TextAppearance.AppCompat.Headline"
>
<item
name=
"android:textSize"
>
16sp
</item>
</style>
...
...
util/build.gradle
View file @
2034a665
...
...
@@ -29,6 +29,10 @@ dependencies {
implementation
libraries
.
coroutines
implementation
libraries
.
coroutinesAndroid
implementation
libraries
.
appCompat
implementation
libraries
.
rxBinding
// TODO This is a dependency from the core module, but the util module are unable to get that dependencies. Check why it is occurring since transitive is enable by default
implementation
libraries
.
lifecycleExtensions
kapt
libraries
.
lifecycleCompiler
...
...
app/src/main/java/chat/rocket/android/util/extensions
/Rx.kt
→
util/src/main/java/chat/rocket/android/util/extension
/Rx.kt
View file @
2034a665
package
chat.rocket.android.util.extension
s
package
chat.rocket.android.util.extension
import
android.widget.EditText
import
com.jakewharton.rxbinding2.widget.RxTextView
...
...
util/src/main/java/chat/rocket/android/util/extension/Widget.kt
0 → 100644
View file @
2034a665
package
chat.rocket.android.util.extension
import
androidx.appcompat.widget.SearchView
fun
SearchView
.
onQueryTextListener
(
queryListener
:
(
String
)
->
Unit
)
{
return
this
.
setOnQueryTextListener
(
object
:
SearchView
.
OnQueryTextListener
{
override
fun
onQueryTextSubmit
(
query
:
String
):
Boolean
{
queryListener
(
query
)
return
true
}
override
fun
onQueryTextChange
(
newText
:
String
):
Boolean
{
queryListener
(
newText
)
return
true
}
})
}
\ 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