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
9f6519b9
Commit
9f6519b9
authored
May 11, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shows favorite message list.
parent
1ceb0a2d
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
413 additions
and
41 deletions
+413
-41
ChatRoomNavigator.kt
...rocket/android/chatroom/presentation/ChatRoomNavigator.kt
+8
-2
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+7
-2
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+4
-1
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+12
-6
ActivityBuilder.kt
...java/chat/rocket/android/dagger/module/ActivityBuilder.kt
+10
-4
FavoriteMessagesFragmentModule.kt
...oid/favoritemessages/di/FavoriteMessagesFragmentModule.kt
+30
-0
FavoriteMessagesFragmentProvider.kt
...d/favoritemessages/di/FavoriteMessagesFragmentProvider.kt
+12
-0
FavoriteMessagesPresenter.kt
...avoritemessages/presentation/FavoriteMessagesPresenter.kt
+54
-0
FavoriteMessagesView.kt
...oid/favoritemessages/presentation/FavoriteMessagesView.kt
+15
-0
FavoriteMessagesFragment.kt
...t/android/favoritemessages/ui/FavoriteMessagesFragment.kt
+119
-0
PinnedMessagesFragment.kt
...ocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
+24
-21
fragment_favorite_messages.xml
app/src/main/res/layout/fragment_favorite_messages.xml
+72
-0
fragment_pinned_messages.xml
app/src/main/res/layout/fragment_pinned_messages.xml
+2
-1
chatroom_actions.xml
app/src/main/res/menu/chatroom_actions.xml
+5
-0
strings.xml
app/src/main/res/values-es/strings.xml
+7
-1
strings.xml
app/src/main/res/values-fr/strings.xml
+7
-1
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+6
-0
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+6
-0
strings.xml
app/src/main/res/values-uk-rUA/strings.xml
+7
-1
strings.xml
app/src/main/res/values/strings.xml
+6
-1
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomNavigator.kt
View file @
9f6519b9
...
...
@@ -15,8 +15,14 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
}
fun
toPinnedMessageList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
{
activity
.
addFragmentBackStack
(
"PinnedMessages"
,
R
.
id
.
fragment_container
){
chat
.
rocket
.
android
.
pinnedmessages
.
ui
.
newInstance
(
chatRoomId
,
chatRoomType
)
activity
.
addFragmentBackStack
(
"PinnedMessages"
,
R
.
id
.
fragment_container
)
{
chat
.
rocket
.
android
.
pinnedmessages
.
ui
.
newInstance
(
chatRoomId
,
chatRoomType
)
}
}
fun
toFavoriteMessageList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
{
activity
.
addFragmentBackStack
(
"FavoriteMessages"
,
R
.
id
.
fragment_container
)
{
chat
.
rocket
.
android
.
favoritemessages
.
ui
.
newInstance
(
chatRoomId
,
chatRoomType
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
9f6519b9
...
...
@@ -568,9 +568,14 @@ class ChatRoomPresenter @Inject constructor(
}
}
fun
toMembersList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toMembersList
(
chatRoomId
,
chatRoomType
)
fun
toMembersList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toMembersList
(
chatRoomId
,
chatRoomType
)
fun
toPinnedMessageList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toPinnedMessageList
(
chatRoomId
,
chatRoomType
)
fun
toPinnedMessageList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toPinnedMessageList
(
chatRoomId
,
chatRoomType
)
fun
toFavoriteMessageList
(
chatRoomId
:
String
,
chatRoomType
:
String
)
=
navigator
.
toFavoriteMessageList
(
chatRoomId
,
chatRoomType
)
fun
loadChatRooms
()
{
launchUI
(
strategy
)
{
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
9f6519b9
...
...
@@ -198,7 +198,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
presenter
.
toMembersList
(
chatRoomId
,
chatRoomType
)
}
R
.
id
.
action_pinned_messages
->
{
presenter
.
toPinnedMessageList
(
chatRoomId
,
chatRoomType
)
presenter
.
toPinnedMessageList
(
chatRoomId
,
chatRoomType
)
}
R
.
id
.
action_favorite_messages
->
{
presenter
.
toFavoriteMessageList
(
chatRoomId
,
chatRoomType
)
}
}
return
true
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
9f6519b9
...
...
@@ -211,7 +211,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
null
,
groupMentions
=
0L
,
lastMessage
=
null
,
client
=
client
client
=
client
,
broadcast
=
false
)
}
}
...
...
@@ -244,7 +245,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
null
,
groupMentions
=
0L
,
lastMessage
=
it
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
false
)
}
}
...
...
@@ -335,7 +337,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
it
.
userMentions
,
groupMentions
=
it
.
groupMentions
,
lastMessage
=
it
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
false
)
chatRoomsList
.
add
(
newRoom
)
}
...
...
@@ -478,7 +481,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
userMentions
,
groupMentions
=
groupMentions
,
lastMessage
=
room
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
false
)
removeRoom
(
room
.
id
,
chatRooms
)
chatRooms
.
add
(
newRoom
)
...
...
@@ -517,7 +521,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
subscription
.
userMentions
,
groupMentions
=
subscription
.
groupMentions
,
lastMessage
=
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
false
)
removeRoom
(
subscription
.
roomId
,
chatRooms
)
chatRooms
.
add
(
newRoom
)
...
...
@@ -591,7 +596,8 @@ class ChatRoomsPresenter @Inject constructor(
userMentions
=
it
.
userMentions
,
groupMentions
=
it
.
groupMentions
,
lastMessage
=
it
.
lastMessage
,
client
=
client
client
=
client
,
broadcast
=
false
)
getChatRoomsInteractor
.
remove
(
currentServer
,
it
)
...
...
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
9f6519b9
...
...
@@ -10,6 +10,7 @@ import chat.rocket.android.authentication.twofactor.di.TwoFAFragmentProvider
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.chatroom.di.ChatRoomFragmentProvider
import
chat.rocket.android.chatroom.di.ChatRoomModule
import
chat.rocket.android.chatroom.di.FavoriteMessagesFragmentProvider
import
chat.rocket.android.chatroom.di.PinnedMessagesFragmentProvider
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatrooms.di.ChatRoomsFragmentProvider
...
...
@@ -47,10 +48,15 @@ abstract class ActivityBuilder {
abstract
fun
bindMainActivity
():
MainActivity
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
ChatRoomModule
::
class
,
ChatRoomFragmentProvider
::
class
,
MembersFragmentProvider
::
class
,
PinnedMessagesFragmentProvider
::
class
])
@ContributesAndroidInjector
(
modules
=
[
ChatRoomModule
::
class
,
ChatRoomFragmentProvider
::
class
,
MembersFragmentProvider
::
class
,
PinnedMessagesFragmentProvider
::
class
,
FavoriteMessagesFragmentProvider
::
class
]
)
abstract
fun
bindChatRoomActivity
():
ChatRoomActivity
@PerActivity
...
...
app/src/main/java/chat/rocket/android/favoritemessages/di/FavoriteMessagesFragmentModule.kt
0 → 100644
View file @
9f6519b9
package
chat.rocket.android.chatroom.di
import
android.arch.lifecycle.LifecycleOwner
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.favoritemessages.presentation.FavoriteMessagesView
import
chat.rocket.android.favoritemessages.ui.FavoriteMessagesFragment
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.experimental.Job
@Module
@PerFragment
class
FavoriteMessagesFragmentModule
{
@Provides
fun
provideLifecycleOwner
(
frag
:
FavoriteMessagesFragment
):
LifecycleOwner
{
return
frag
}
@Provides
fun
provideCancelStrategy
(
owner
:
LifecycleOwner
,
jobs
:
Job
):
CancelStrategy
{
return
CancelStrategy
(
owner
,
jobs
)
}
@Provides
fun
provideFavoriteMessagesView
(
frag
:
FavoriteMessagesFragment
):
FavoriteMessagesView
{
return
frag
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/favoritemessages/di/FavoriteMessagesFragmentProvider.kt
0 → 100644
View file @
9f6519b9
package
chat.rocket.android.chatroom.di
import
chat.rocket.android.favoritemessages.ui.FavoriteMessagesFragment
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
@Module
abstract
class
FavoriteMessagesFragmentProvider
{
@ContributesAndroidInjector
(
modules
=
[
FavoriteMessagesFragmentModule
::
class
])
abstract
fun
provideFavoriteMessageFragment
():
FavoriteMessagesFragment
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/favoritemessages/presentation/FavoriteMessagesPresenter.kt
0 → 100644
View file @
9f6519b9
package
chat.rocket.android.favoritemessages.presentation
import
chat.rocket.android.chatroom.viewmodel.ViewModelMapper
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.server.domain.GetChatRoomsInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.internal.rest.getFavoriteMessages
import
chat.rocket.core.model.isSystemMessage
import
timber.log.Timber
import
javax.inject.Inject
class
FavoriteMessagesPresenter
@Inject
constructor
(
private
val
view
:
FavoriteMessagesView
,
private
val
strategy
:
CancelStrategy
,
private
val
serverInteractor
:
GetCurrentServerInteractor
,
private
val
roomsInteractor
:
GetChatRoomsInteractor
,
private
val
mapper
:
ViewModelMapper
,
factory
:
RocketChatClientFactory
)
{
private
val
client
=
factory
.
create
(
serverInteractor
.
get
()
!!
)
private
var
favoriteMessagesListOffset
:
Int
=
0
/**
* Loads all favorite messages for room. the given room id.
*
* @param roomId The id of the room to get its favorite messages.
*/
fun
loadFavoriteMessages
(
roomId
:
String
)
{
launchUI
(
strategy
)
{
try
{
val
serverUrl
=
serverInteractor
.
get
()
!!
val
chatRoom
=
roomsInteractor
.
getById
(
serverUrl
,
roomId
)
chatRoom
?.
let
{
room
->
view
.
showLoading
()
val
favoriteMessages
=
client
.
getFavoriteMessages
(
roomId
,
room
.
type
,
favoriteMessagesListOffset
)
favoriteMessagesListOffset
=
favoriteMessages
.
offset
.
toInt
()
val
messageList
=
mapper
.
map
(
favoriteMessages
.
result
.
filterNot
{
it
.
isSystemMessage
()
})
view
.
showFavoriteMessages
(
messageList
)
view
.
hideLoading
()
}.
ifNull
{
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
}
}
catch
(
e
:
RocketChatException
)
{
Timber
.
e
(
e
)
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/favoritemessages/presentation/FavoriteMessagesView.kt
0 → 100644
View file @
9f6519b9
package
chat.rocket.android.favoritemessages.presentation
import
chat.rocket.android.chatroom.viewmodel.BaseViewModel
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
interface
FavoriteMessagesView
:
MessageView
,
LoadingView
{
/**
* Shows the list of favorite messages for the current room.
*
* @param favoriteMessages The list of favorite messages to show.
*/
fun
showFavoriteMessages
(
favoriteMessages
:
List
<
BaseViewModel
<*
>>)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/favoritemessages/ui/FavoriteMessagesFragment.kt
0 → 100644
View file @
9f6519b9
package
chat.rocket.android.favoritemessages.ui
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v7.widget.DefaultItemAnimator
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.core.view.isVisible
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatroom.viewmodel.BaseViewModel
import
chat.rocket.android.favoritemessages.presentation.FavoriteMessagesPresenter
import
chat.rocket.android.favoritemessages.presentation.FavoriteMessagesView
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_favorite_messages.*
import
javax.inject.Inject
fun
newInstance
(
chatRoomId
:
String
,
chatRoomType
:
String
):
Fragment
{
return
FavoriteMessagesFragment
().
apply
{
arguments
=
Bundle
(
1
).
apply
{
putString
(
INTENT_CHAT_ROOM_ID
,
chatRoomId
)
putString
(
INTENT_CHAT_ROOM_TYPE
,
chatRoomType
)
}
}
}
private
const
val
INTENT_CHAT_ROOM_ID
=
"chat_room_id"
private
const
val
INTENT_CHAT_ROOM_TYPE
=
"chat_room_type"
class
FavoriteMessagesFragment
:
Fragment
(),
FavoriteMessagesView
{
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomType
:
String
private
lateinit
var
adapter
:
ChatRoomAdapter
@Inject
lateinit
var
presenter
:
FavoriteMessagesPresenter
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
AndroidSupportInjection
.
inject
(
this
)
val
bundle
=
arguments
if
(
bundle
!=
null
)
{
chatRoomId
=
bundle
.
getString
(
INTENT_CHAT_ROOM_ID
)
chatRoomType
=
bundle
.
getString
(
INTENT_CHAT_ROOM_TYPE
)
}
else
{
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_favorite_messages
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
setupToolbar
()
presenter
.
loadFavoriteMessages
(
chatRoomId
)
}
override
fun
showFavoriteMessages
(
favoriteMessages
:
List
<
BaseViewModel
<*
>>)
{
ui
{
if
(
recycler_view
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
chatRoomType
,
""
,
null
,
false
)
recycler_view
.
adapter
=
adapter
val
linearLayoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
false
)
recycler_view
.
layoutManager
=
linearLayoutManager
recycler_view
.
itemAnimator
=
DefaultItemAnimator
()
if
(
favoriteMessages
.
size
>
10
)
{
recycler_view
.
addOnScrollListener
(
object
:
EndlessRecyclerViewScrollListener
(
linearLayoutManager
)
{
override
fun
onLoadMore
(
page
:
Int
,
totalItemsCount
:
Int
,
recyclerView
:
RecyclerView
?
)
{
presenter
.
loadFavoriteMessages
(
chatRoomId
)
}
})
}
no_messages_view
.
isVisible
=
favoriteMessages
.
isEmpty
()
}
adapter
.
appendData
(
favoriteMessages
)
}
}
override
fun
showMessage
(
resId
:
Int
)
{
ui
{
showToast
(
resId
)
}
}
override
fun
showMessage
(
message
:
String
)
{
ui
{
showToast
(
message
)
}
}
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
override
fun
showLoading
()
{
ui
{
view_loading
.
isVisible
=
true
}
}
override
fun
hideLoading
()
{
ui
{
view_loading
.
isVisible
=
false
}
}
private
fun
setupToolbar
()
{
(
activity
as
ChatRoomActivity
).
setupToolbarTitle
(
getString
(
R
.
string
.
title_favorite_messages
))
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
View file @
9f6519b9
...
...
@@ -9,6 +9,7 @@ import android.support.v7.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.core.view.isVisible
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
...
...
@@ -24,7 +25,7 @@ import dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_pinned_messages.*
import
javax.inject.Inject
fun
newInstance
(
chatRoomId
:
String
,
chatRoomType
:
String
)
:
Fragment
{
fun
newInstance
(
chatRoomId
:
String
,
chatRoomType
:
String
):
Fragment
{
return
PinnedMessagesFragment
().
apply
{
arguments
=
Bundle
(
1
).
apply
{
putString
(
BUNDLE_CHAT_ROOM_ID
,
chatRoomId
)
...
...
@@ -49,15 +50,19 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
AndroidSupportInjection
.
inject
(
this
)
val
bundle
=
arguments
if
(
bundle
!=
null
){
if
(
bundle
!=
null
)
{
chatRoomId
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_ID
)
chatRoomType
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_TYPE
)
}
else
{
}
else
{
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_pinned_messages
)
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_pinned_messages
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
...
...
@@ -69,21 +74,27 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
override
fun
showPinnedMessages
(
pinnedMessages
:
List
<
BaseViewModel
<*
>>)
{
ui
{
if
(
recycler_view_pinned
.
adapter
==
null
){
adapter
=
ChatRoomAdapter
(
chatRoomType
,
""
,
null
,
false
)
if
(
recycler_view_pinned
.
adapter
==
null
)
{
adapter
=
ChatRoomAdapter
(
chatRoomType
,
""
,
null
,
false
)
recycler_view_pinned
.
adapter
=
adapter
val
linearLayoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
false
)
val
linearLayoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
false
)
recycler_view_pinned
.
layoutManager
=
linearLayoutManager
recycler_view_pinned
.
itemAnimator
=
DefaultItemAnimator
()
if
(
pinnedMessages
.
size
>
10
){
recycler_view_pinned
.
addOnScrollListener
(
object
:
EndlessRecyclerViewScrollListener
(
linearLayoutManager
){
override
fun
onLoadMore
(
page
:
Int
,
totalItemsCount
:
Int
,
recyclerView
:
RecyclerView
?)
{
if
(
pinnedMessages
.
size
>
10
)
{
recycler_view_pinned
.
addOnScrollListener
(
object
:
EndlessRecyclerViewScrollListener
(
linearLayoutManager
)
{
override
fun
onLoadMore
(
page
:
Int
,
totalItemsCount
:
Int
,
recyclerView
:
RecyclerView
?
)
{
presenter
.
loadPinnedMessages
(
chatRoomId
)
}
})
}
togglePinView
(
pinnedMessages
.
size
)
pin_view
.
isVisible
=
pinnedMessages
.
isEmpty
(
)
}
adapter
.
appendData
(
pinnedMessages
)
}
...
...
@@ -104,22 +115,14 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
override
fun
showLoading
()
{
ui
{
view_loading
.
setVisible
(
true
)
}
ui
{
view_loading
.
isVisible
=
true
}
}
override
fun
hideLoading
()
{
ui
{
view_loading
.
setVisible
(
false
)
}
ui
{
view_loading
.
isVisible
=
false
}
}
private
fun
setupToolbar
()
{
(
activity
as
ChatRoomActivity
).
setupToolbarTitle
(
getString
(
R
.
string
.
title_pinned_messages
))
}
private
fun
togglePinView
(
size
:
Int
){
if
(
size
==
0
){
pin_view
.
setVisible
(
true
)
}
else
{
pin_view
.
setVisible
(
false
)
}
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_favorite_messages.xml
0 → 100644
View file @
9f6519b9
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".favoritemessages.ui.FavoriteMessagesFragment"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<com.wang.avi.AVLoadingIndicatorView
android:id=
"@+id/view_loading"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:visibility=
"gone"
app:indicatorColor=
"@color/black"
app:indicatorName=
"BallPulseIndicator"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:visibility=
"visible"
/>
<ImageView
android:id=
"@+id/image_star"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:src=
"@drawable/ic_action_message_star_24dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/text_no_favorite_messages"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"24dp"
android:text=
"@string/no_favorite_messages"
android:textColor=
"@color/colorSecondaryText"
android:textSize=
"20sp"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/image_star"
/>
<TextView
android:id=
"@+id/text_no_favorite_messages_description"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"@string/no_favorite_description"
android:textAlignment=
"center"
android:textColor=
"@color/colorSecondaryTextLight"
android:textSize=
"16sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_no_favorite_messages"
/>
<android.support.constraint.Group
android:id=
"@+id/no_messages_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
app:constraint_referenced_ids=
"text_no_favorite_messages_description,image_star,text_no_favorite_messages"
tools:visibility=
"visible"
/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_pinned_messages.xml
View file @
9f6519b9
...
...
@@ -3,7 +3,8 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
tools:context=
".pinnedmessages.ui.PinnedMessagesFragment"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recycler_view_pinned"
...
...
app/src/main/res/menu/chatroom_actions.xml
View file @
9f6519b9
...
...
@@ -11,4 +11,9 @@
android:id=
"@+id/action_pinned_messages"
android:title=
"@string/title_pinned_messages"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_favorite_messages"
android:title=
"@string/title_favorite_messages"
app:showAsAction=
"never"
/>
</menu>
\ No newline at end of file
app/src/main/res/values-es/strings.xml
View file @
9f6519b9
...
...
@@ -163,7 +163,13 @@
<!-- Pinned Messages -->
<string
name=
"title_pinned_messages"
>
Mensajes fijados
</string>
<string
name=
"no_pinned_messages"
>
Sin mensajes fijadas
</string>
<string
name=
"no_pinned_description"
>
Todas las mensajes fijadas\naparecen aquí.
</string>
<string
name=
"no_pinned_description"
>
Todas las mensajes fijadas\naparecen aquí
</string>
<!-- Favorite Messages -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_messages"
>
Favorite Messages
</string>
<string
name=
"no_favorite_messages"
>
No favorite messages
</string>
<string
name=
"no_favorite_description"
>
All the favorite messages\nappear here
</string>
<!-- Upload Messages -->
<string
name=
"max_file_size_exceeded"
>
Tamaño del archivo (%1$d bytes) excedió el tamaño máximo de carga de %2$d bytes
</string>
...
...
app/src/main/res/values-fr/strings.xml
View file @
9f6519b9
...
...
@@ -164,7 +164,13 @@
<!-- Pinned Messages -->
<string
name=
"title_pinned_messages"
>
Messages épinglés
</string>
<string
name=
"no_pinned_messages"
>
Aucun message épinglé
</string>
<string
name=
"no_pinned_description"
>
Tous les messages épinglés\napparaissent ici.
</string>
<string
name=
"no_pinned_description"
>
Tous les messages épinglés\napparaissent ici
</string>
<!-- Favorite Messages -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_messages"
>
Favorite Messages
</string>
<string
name=
"no_favorite_messages"
>
No favorite messages
</string>
<string
name=
"no_favorite_description"
>
All the favorite messages\nappear here
</string>
<!-- Upload Messages -->
<string
name=
"max_file_size_exceeded"
>
Taille du fichier (%1$d bytes) dépassé la taille de téléchargement maximale de %2$d bytes
</string>
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
9f6519b9
...
...
@@ -167,6 +167,12 @@
<string
name=
"no_pinned_messages"
>
कोई पिन संदेश नहीं
</string>
<string
name=
"no_pinned_description"
>
सभी पिन किए गए संदेश यहां\nदिखाई देते हैं।
</string>
<!-- Favorite Messages -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_messages"
>
Favorite Messages
</string>
<string
name=
"no_favorite_messages"
>
No favorite messages
</string>
<string
name=
"no_favorite_description"
>
All the favorite messages\nappear here
</string>
<!-- Upload Messages -->
<string
name=
"max_file_size_exceeded"
>
फ़ाइल का आकार %1$d बाइट्स ने %2$d बाइट्स के अधिकतम अपलोड आकार को पार कर लिया है
</string>
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
9f6519b9
...
...
@@ -155,6 +155,12 @@
<string
name=
"no_pinned_messages"
>
Nenhuma mensagem pinada
</string>
<string
name=
"no_pinned_description"
>
Todas as mensagens pinadas\naparecerão aqui
</string>
<!-- Favorite Messages -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_messages"
>
Messagens Favoritas
</string>
<string
name=
"no_favorite_messages"
>
Nenhuma messagem favorita
</string>
<string
name=
"no_favorite_description"
>
Todas as mensagens favoritas\naparecerão aqui
</string>
<!-- Upload Messages -->
<string
name=
"max_file_size_exceeded"
>
Tamanho de arquivo (%1$d bytes) excedeu tamanho máximo de upload (%2$d bytes)
</string>
...
...
app/src/main/res/values-uk-rUA/strings.xml
View file @
9f6519b9
...
...
@@ -149,7 +149,13 @@
<!-- Pinned Messages -->
<string
name=
"title_pinned_messages"
>
Pinned Messages
</string>
<string
name=
"no_pinned_messages"
>
No pinned messages
</string>
<string
name=
"no_pinned_description"
>
All the pinned messages\nappear here.
</string>
<string
name=
"no_pinned_description"
>
All the pinned messages\nappear here
</string>
<!-- Favorite Messages -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_messages"
>
Favorite Messages
</string>
<string
name=
"no_favorite_messages"
>
No favorite messages
</string>
<string
name=
"no_favorite_description"
>
All the favorite messages\nappear here
</string>
<!-- Upload Messages -->
<string
name=
"max_file_size_exceeded"
>
File size %1$d bytes exceeded max upload size of %2$d bytes
</string>
...
...
app/src/main/res/values/strings.xml
View file @
9f6519b9
...
...
@@ -154,7 +154,12 @@
<!-- Pinned Messages -->
<string
name=
"title_pinned_messages"
>
Pinned Messages
</string>
<string
name=
"no_pinned_messages"
>
No pinned messages
</string>
<string
name=
"no_pinned_description"
>
All the pinned messages\nappear here.
</string>
<string
name=
"no_pinned_description"
>
All the pinned messages\nappear here
</string>
<!-- Favorite Messages -->
<string
name=
"title_favorite_messages"
>
Favorite Messages
</string>
<string
name=
"no_favorite_messages"
>
No favorite messages
</string>
<string
name=
"no_favorite_description"
>
All the favorite messages\nappear here
</string>
<!-- Upload Messages -->
<string
name=
"max_file_size_exceeded"
>
File size %1$d bytes exceeded max upload size of %2$d bytes
</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