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
3fca09b7
Unverified
Commit
3fca09b7
authored
Jun 28, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Jun 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1410 from RocketChat/new/star-unstar-chatroom
[NEW] Favorite/Unfavorite chatroom
parents
847d6e6f
3cc4aa53
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
215 additions
and
81 deletions
+215
-81
ChatRoomNavigator.kt
...rocket/android/chatroom/presentation/ChatRoomNavigator.kt
+2
-0
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+21
-0
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+7
-0
ChatRoomActivity.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
+23
-11
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+89
-27
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+11
-3
MainNavigator.kt
...va/chat/rocket/android/main/presentation/MainNavigator.kt
+8
-6
ic_star_border_white_24dp.xml
app/src/main/res/drawable/ic_star_border_white_24dp.xml
+10
-0
ic_star_yellow_24dp.xml
app/src/main/res/drawable/ic_star_yellow_24dp.xml
+10
-0
chatroom_actions.xml
app/src/main/res/menu/chatroom_actions.xml
+0
-28
strings.xml
app/src/main/res/values-es/strings.xml
+6
-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
+5
-1
strings.xml
app/src/main/res/values-uk-rRU/strings.xml
+6
-1
strings.xml
app/src/main/res/values/strings.xml
+5
-1
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomNavigator.kt
View file @
3fca09b7
...
@@ -51,6 +51,7 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
...
@@ -51,6 +51,7 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
chatRoomLastSeen
:
Long
,
chatRoomLastSeen
:
Long
,
isChatRoomSubscribed
:
Boolean
,
isChatRoomSubscribed
:
Boolean
,
isChatRoomCreator
:
Boolean
,
isChatRoomCreator
:
Boolean
,
isChatRoomFavorite
:
Boolean
,
chatRoomMessage
:
String
chatRoomMessage
:
String
)
{
)
{
activity
.
startActivity
(
activity
.
startActivity
(
...
@@ -62,6 +63,7 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
...
@@ -62,6 +63,7 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
chatRoomLastSeen
,
chatRoomLastSeen
,
isChatRoomSubscribed
,
isChatRoomSubscribed
,
isChatRoomCreator
,
isChatRoomCreator
,
isChatRoomFavorite
,
chatRoomMessage
chatRoomMessage
)
)
)
)
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
3fca09b7
...
@@ -62,6 +62,7 @@ import chat.rocket.core.internal.rest.unpinMessage
...
@@ -62,6 +62,7 @@ import chat.rocket.core.internal.rest.unpinMessage
import
chat.rocket.core.internal.rest.unstarMessage
import
chat.rocket.core.internal.rest.unstarMessage
import
chat.rocket.core.internal.rest.updateMessage
import
chat.rocket.core.internal.rest.updateMessage
import
chat.rocket.core.internal.rest.uploadFile
import
chat.rocket.core.internal.rest.uploadFile
import
chat.rocket.core.internal.rest.favorite
import
chat.rocket.core.model.ChatRoomRole
import
chat.rocket.core.model.ChatRoomRole
import
chat.rocket.core.model.Command
import
chat.rocket.core.model.Command
import
chat.rocket.core.model.Message
import
chat.rocket.core.model.Message
...
@@ -723,6 +724,25 @@ class ChatRoomPresenter @Inject constructor(
...
@@ -723,6 +724,25 @@ class ChatRoomPresenter @Inject constructor(
}
}
}
}
fun
toggleFavoriteChatRoom
(
roomId
:
String
,
isFavorite
:
Boolean
)
{
launchUI
(
strategy
)
{
try
{
// Note that if it is favorite then the user wants to unfavorite - and vice versa.
retryIO
(
"favorite($roomId, $isFavorite)"
)
{
client
.
favorite
(
roomId
,
!
isFavorite
)
}
view
.
showFavoriteIcon
(!
isFavorite
)
}
catch
(
e
:
RocketChatException
)
{
Timber
.
e
(
e
,
"Error while trying to favorite/unfavorite chat room."
)
e
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
}
}
}
fun
toMembersList
(
chatRoomId
:
String
)
=
fun
toMembersList
(
chatRoomId
:
String
)
=
navigator
.
toMembersList
(
chatRoomId
)
navigator
.
toMembersList
(
chatRoomId
)
...
@@ -785,6 +805,7 @@ class ChatRoomPresenter @Inject constructor(
...
@@ -785,6 +805,7 @@ class ChatRoomPresenter @Inject constructor(
chatRoomLastSeen
=
it
.
lastSeen
?:
-
1
,
chatRoomLastSeen
=
it
.
lastSeen
?:
-
1
,
chatRoomName
=
roomName
,
chatRoomName
=
roomName
,
isChatRoomCreator
=
false
,
isChatRoomCreator
=
false
,
isChatRoomFavorite
=
false
,
isChatRoomReadOnly
=
false
,
isChatRoomReadOnly
=
false
,
isChatRoomSubscribed
=
it
.
open
,
isChatRoomSubscribed
=
it
.
open
,
chatRoomMessage
=
message
chatRoomMessage
=
message
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
3fca09b7
...
@@ -12,6 +12,13 @@ import chat.rocket.core.model.ChatRoom
...
@@ -12,6 +12,13 @@ import chat.rocket.core.model.ChatRoom
interface
ChatRoomView
:
LoadingView
,
MessageView
{
interface
ChatRoomView
:
LoadingView
,
MessageView
{
/**
* Shows the Favorite/Unfavorite chat room icon.
*
* @param isFavorite Shows the favorite icon if true, otherwise shows the unfavorite icon.
*/
fun
showFavoriteIcon
(
isFavorite
:
Boolean
)
/**
/**
* Shows the chat room messages.
* Shows the chat room messages.
*
*
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
View file @
3fca09b7
...
@@ -27,20 +27,22 @@ fun Context.chatRoomIntent(
...
@@ -27,20 +27,22 @@ fun Context.chatRoomIntent(
chatRoomId
:
String
,
chatRoomId
:
String
,
chatRoomName
:
String
,
chatRoomName
:
String
,
chatRoomType
:
String
,
chatRoomType
:
String
,
is
ChatRoom
ReadOnly
:
Boolean
,
isReadOnly
:
Boolean
,
chatRoomLastSeen
:
Long
,
chatRoomLastSeen
:
Long
,
isChatRoomSubscribed
:
Boolean
=
true
,
isSubscribed
:
Boolean
=
true
,
isChatRoomCreator
:
Boolean
=
false
,
isCreator
:
Boolean
=
false
,
isFavorite
:
Boolean
=
false
,
chatRoomMessage
:
String
?
=
null
chatRoomMessage
:
String
?
=
null
):
Intent
{
):
Intent
{
return
Intent
(
this
,
ChatRoomActivity
::
class
.
java
).
apply
{
return
Intent
(
this
,
ChatRoomActivity
::
class
.
java
).
apply
{
putExtra
(
INTENT_CHAT_ROOM_ID
,
chatRoomId
)
putExtra
(
INTENT_CHAT_ROOM_ID
,
chatRoomId
)
putExtra
(
INTENT_CHAT_ROOM_NAME
,
chatRoomName
)
putExtra
(
INTENT_CHAT_ROOM_NAME
,
chatRoomName
)
putExtra
(
INTENT_CHAT_ROOM_TYPE
,
chatRoomType
)
putExtra
(
INTENT_CHAT_ROOM_TYPE
,
chatRoomType
)
putExtra
(
INTENT_CHAT_ROOM_IS_READ_ONLY
,
is
ChatRoom
ReadOnly
)
putExtra
(
INTENT_CHAT_ROOM_IS_READ_ONLY
,
isReadOnly
)
putExtra
(
INTENT_CHAT_ROOM_LAST_SEEN
,
chatRoomLastSeen
)
putExtra
(
INTENT_CHAT_ROOM_LAST_SEEN
,
chatRoomLastSeen
)
putExtra
(
INTENT_CHAT_IS_SUBSCRIBED
,
isChatRoomSubscribed
)
putExtra
(
INTENT_CHAT_IS_SUBSCRIBED
,
isSubscribed
)
putExtra
(
INTENT_CHAT_ROOM_IS_CREATOR
,
isChatRoomCreator
)
putExtra
(
INTENT_CHAT_ROOM_IS_CREATOR
,
isCreator
)
putExtra
(
INTENT_CHAT_ROOM_IS_FAVORITE
,
isFavorite
)
putExtra
(
INTENT_CHAT_ROOM_MESSAGE
,
chatRoomMessage
)
putExtra
(
INTENT_CHAT_ROOM_MESSAGE
,
chatRoomMessage
)
}
}
}
}
...
@@ -50,6 +52,7 @@ private const val INTENT_CHAT_ROOM_NAME = "chat_room_name"
...
@@ -50,6 +52,7 @@ private const val INTENT_CHAT_ROOM_NAME = "chat_room_name"
private
const
val
INTENT_CHAT_ROOM_TYPE
=
"chat_room_type"
private
const
val
INTENT_CHAT_ROOM_TYPE
=
"chat_room_type"
private
const
val
INTENT_CHAT_ROOM_IS_READ_ONLY
=
"chat_room_is_read_only"
private
const
val
INTENT_CHAT_ROOM_IS_READ_ONLY
=
"chat_room_is_read_only"
private
const
val
INTENT_CHAT_ROOM_IS_CREATOR
=
"chat_room_is_creator"
private
const
val
INTENT_CHAT_ROOM_IS_CREATOR
=
"chat_room_is_creator"
private
const
val
INTENT_CHAT_ROOM_IS_FAVORITE
=
"chat_room_is_favorite"
private
const
val
INTENT_CHAT_ROOM_LAST_SEEN
=
"chat_room_last_seen"
private
const
val
INTENT_CHAT_ROOM_LAST_SEEN
=
"chat_room_last_seen"
private
const
val
INTENT_CHAT_IS_SUBSCRIBED
=
"is_chat_room_subscribed"
private
const
val
INTENT_CHAT_IS_SUBSCRIBED
=
"is_chat_room_subscribed"
private
const
val
INTENT_CHAT_ROOM_MESSAGE
=
"chat_room_message"
private
const
val
INTENT_CHAT_ROOM_MESSAGE
=
"chat_room_message"
...
@@ -89,13 +92,15 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
...
@@ -89,13 +92,15 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
val
chatRoomType
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_TYPE
)
val
chatRoomType
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_TYPE
)
requireNotNull
(
chatRoomType
)
{
"no chat_room_type provided in Intent extras"
}
requireNotNull
(
chatRoomType
)
{
"no chat_room_type provided in Intent extras"
}
val
is
ChatRoom
ReadOnly
=
intent
.
getBooleanExtra
(
INTENT_CHAT_ROOM_IS_READ_ONLY
,
true
)
val
isReadOnly
=
intent
.
getBooleanExtra
(
INTENT_CHAT_ROOM_IS_READ_ONLY
,
true
)
val
isChatRoomCreator
=
intent
.
getBooleanExtra
(
INTENT_CHAT_ROOM_IS_CREATOR
,
false
)
val
isCreator
=
intent
.
getBooleanExtra
(
INTENT_CHAT_ROOM_IS_CREATOR
,
false
)
val
isFavorite
=
intent
.
getBooleanExtra
(
INTENT_CHAT_ROOM_IS_FAVORITE
,
false
)
val
chatRoomLastSeen
=
intent
.
getLongExtra
(
INTENT_CHAT_ROOM_LAST_SEEN
,
-
1
)
val
chatRoomLastSeen
=
intent
.
getLongExtra
(
INTENT_CHAT_ROOM_LAST_SEEN
,
-
1
)
val
is
ChatRoom
Subscribed
=
intent
.
getBooleanExtra
(
INTENT_CHAT_IS_SUBSCRIBED
,
true
)
val
isSubscribed
=
intent
.
getBooleanExtra
(
INTENT_CHAT_IS_SUBSCRIBED
,
true
)
val
chatRoomMessage
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_MESSAGE
)
val
chatRoomMessage
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_MESSAGE
)
...
@@ -104,8 +109,15 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
...
@@ -104,8 +109,15 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
if
(
supportFragmentManager
.
findFragmentByTag
(
TAG_CHAT_ROOM_FRAGMENT
)
==
null
)
{
if
(
supportFragmentManager
.
findFragmentByTag
(
TAG_CHAT_ROOM_FRAGMENT
)
==
null
)
{
addFragment
(
TAG_CHAT_ROOM_FRAGMENT
,
R
.
id
.
fragment_container
)
{
addFragment
(
TAG_CHAT_ROOM_FRAGMENT
,
R
.
id
.
fragment_container
)
{
newInstance
(
newInstance
(
chatRoomId
,
chatRoomName
,
chatRoomType
,
isChatRoomReadOnly
,
chatRoomLastSeen
,
chatRoomId
,
isChatRoomSubscribed
,
isChatRoomCreator
,
chatRoomMessage
chatRoomName
,
chatRoomType
,
isReadOnly
,
chatRoomLastSeen
,
isSubscribed
,
isCreator
,
isFavorite
,
chatRoomMessage
)
)
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
3fca09b7
...
@@ -76,10 +76,11 @@ fun newInstance(
...
@@ -76,10 +76,11 @@ fun newInstance(
chatRoomId
:
String
,
chatRoomId
:
String
,
chatRoomName
:
String
,
chatRoomName
:
String
,
chatRoomType
:
String
,
chatRoomType
:
String
,
is
ChatRoom
ReadOnly
:
Boolean
,
isReadOnly
:
Boolean
,
chatRoomLastSeen
:
Long
,
chatRoomLastSeen
:
Long
,
isSubscribed
:
Boolean
=
true
,
isSubscribed
:
Boolean
=
true
,
isChatRoomCreator
:
Boolean
=
false
,
isCreator
:
Boolean
=
false
,
isFavorite
:
Boolean
=
false
,
chatRoomMessage
:
String
?
=
null
chatRoomMessage
:
String
?
=
null
):
Fragment
{
):
Fragment
{
return
ChatRoomFragment
().
apply
{
return
ChatRoomFragment
().
apply
{
...
@@ -87,10 +88,11 @@ fun newInstance(
...
@@ -87,10 +88,11 @@ fun newInstance(
putString
(
BUNDLE_CHAT_ROOM_ID
,
chatRoomId
)
putString
(
BUNDLE_CHAT_ROOM_ID
,
chatRoomId
)
putString
(
BUNDLE_CHAT_ROOM_NAME
,
chatRoomName
)
putString
(
BUNDLE_CHAT_ROOM_NAME
,
chatRoomName
)
putString
(
BUNDLE_CHAT_ROOM_TYPE
,
chatRoomType
)
putString
(
BUNDLE_CHAT_ROOM_TYPE
,
chatRoomType
)
putBoolean
(
BUNDLE_IS_CHAT_ROOM_READ_ONLY
,
is
ChatRoom
ReadOnly
)
putBoolean
(
BUNDLE_IS_CHAT_ROOM_READ_ONLY
,
isReadOnly
)
putLong
(
BUNDLE_CHAT_ROOM_LAST_SEEN
,
chatRoomLastSeen
)
putLong
(
BUNDLE_CHAT_ROOM_LAST_SEEN
,
chatRoomLastSeen
)
putBoolean
(
BUNDLE_CHAT_ROOM_IS_SUBSCRIBED
,
isSubscribed
)
putBoolean
(
BUNDLE_CHAT_ROOM_IS_SUBSCRIBED
,
isSubscribed
)
putBoolean
(
BUNDLE_CHAT_ROOM_IS_CREATOR
,
isChatRoomCreator
)
putBoolean
(
BUNDLE_CHAT_ROOM_IS_CREATOR
,
isCreator
)
putBoolean
(
BUNDLE_CHAT_ROOM_IS_FAVORITE
,
isFavorite
)
putString
(
BUNDLE_CHAT_ROOM_MESSAGE
,
chatRoomMessage
)
putString
(
BUNDLE_CHAT_ROOM_MESSAGE
,
chatRoomMessage
)
}
}
}
}
...
@@ -104,8 +106,16 @@ private const val REQUEST_CODE_FOR_PERFORM_SAF = 42
...
@@ -104,8 +106,16 @@ private const val REQUEST_CODE_FOR_PERFORM_SAF = 42
private
const
val
BUNDLE_CHAT_ROOM_LAST_SEEN
=
"chat_room_last_seen"
private
const
val
BUNDLE_CHAT_ROOM_LAST_SEEN
=
"chat_room_last_seen"
private
const
val
BUNDLE_CHAT_ROOM_IS_SUBSCRIBED
=
"chat_room_is_subscribed"
private
const
val
BUNDLE_CHAT_ROOM_IS_SUBSCRIBED
=
"chat_room_is_subscribed"
private
const
val
BUNDLE_CHAT_ROOM_IS_CREATOR
=
"chat_room_is_creator"
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
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
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
,
EmojiKeyboardListener
,
EmojiReactionListener
{
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
,
EmojiKeyboardListener
,
EmojiReactionListener
{
@Inject
@Inject
...
@@ -118,8 +128,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -118,8 +128,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
lateinit
var
chatRoomType
:
String
private
lateinit
var
chatRoomType
:
String
private
var
chatRoomMessage
:
String
?
=
null
private
var
chatRoomMessage
:
String
?
=
null
private
var
isSubscribed
:
Boolean
=
true
private
var
isSubscribed
:
Boolean
=
true
private
var
isChatRoomReadOnly
:
Boolean
=
false
private
var
isReadOnly
:
Boolean
=
false
private
var
isChatRoomCreator
:
Boolean
=
false
private
var
isCreator
:
Boolean
=
false
private
var
isFavorite
:
Boolean
=
false
private
var
isBroadcastChannel
:
Boolean
=
false
private
var
isBroadcastChannel
:
Boolean
=
false
private
lateinit
var
emojiKeyboardPopup
:
EmojiKeyboardPopup
private
lateinit
var
emojiKeyboardPopup
:
EmojiKeyboardPopup
private
var
chatRoomLastSeen
:
Long
=
-
1
private
var
chatRoomLastSeen
:
Long
=
-
1
...
@@ -158,10 +169,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -158,10 +169,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
chatRoomId
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_ID
)
chatRoomId
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_ID
)
chatRoomName
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_NAME
)
chatRoomName
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_NAME
)
chatRoomType
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_TYPE
)
chatRoomType
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_TYPE
)
is
ChatRoom
ReadOnly
=
bundle
.
getBoolean
(
BUNDLE_IS_CHAT_ROOM_READ_ONLY
)
isReadOnly
=
bundle
.
getBoolean
(
BUNDLE_IS_CHAT_ROOM_READ_ONLY
)
isSubscribed
=
bundle
.
getBoolean
(
BUNDLE_CHAT_ROOM_IS_SUBSCRIBED
)
isSubscribed
=
bundle
.
getBoolean
(
BUNDLE_CHAT_ROOM_IS_SUBSCRIBED
)
chatRoomLastSeen
=
bundle
.
getLong
(
BUNDLE_CHAT_ROOM_LAST_SEEN
)
chatRoomLastSeen
=
bundle
.
getLong
(
BUNDLE_CHAT_ROOM_LAST_SEEN
)
isChatRoomCreator
=
bundle
.
getBoolean
(
BUNDLE_CHAT_ROOM_IS_CREATOR
)
isCreator
=
bundle
.
getBoolean
(
BUNDLE_CHAT_ROOM_IS_CREATOR
)
isFavorite
=
bundle
.
getBoolean
(
BUNDLE_CHAT_ROOM_IS_FAVORITE
)
chatRoomMessage
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_MESSAGE
)
chatRoomMessage
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_MESSAGE
)
}
else
{
}
else
{
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
...
@@ -221,33 +233,83 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -221,33 +233,83 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
}
}
override
fun
onCreateOptionsMenu
(
menu
:
Menu
,
inflater
:
MenuInflater
)
{
override
fun
onPrepareOptionsMenu
(
menu
:
Menu
)
{
super
.
onCreateOptionsMenu
(
menu
,
inflater
)
menu
.
clear
()
inflater
.
inflate
(
R
.
menu
.
chatroom_actions
,
menu
)
if
(
isFavorite
)
{
menu
.
findItem
(
R
.
id
.
action_members_list
)
?.
isVisible
=
!
isBroadcastChannel
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
)
super
.
onPrepareOptionsMenu
(
menu
)
}
}
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
when
(
item
.
itemId
)
{
when
(
item
.
itemId
)
{
R
.
id
.
action_members_list
->
{
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
->
{
presenter
.
toMembersList
(
chatRoomId
)
presenter
.
toggleFavoriteChatRoom
(
chatRoomId
,
isFavorite
)
}
R
.
id
.
action_mentions
->
{
presenter
.
toMentions
(
chatRoomId
)
}
R
.
id
.
action_pinned_messages
->
{
presenter
.
toPinnedMessageList
(
chatRoomId
)
}
R
.
id
.
action_favorite_messages
->
{
presenter
.
toFavoriteMessageList
(
chatRoomId
)
}
R
.
id
.
action_files
->
{
presenter
.
toFileList
(
chatRoomId
)
}
}
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
)
}
}
return
true
return
true
}
}
override
fun
showFavoriteIcon
(
isFavorite
:
Boolean
)
{
this
.
isFavorite
=
isFavorite
activity
?.
invalidateOptionsMenu
()
}
override
fun
showMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>)
{
override
fun
showMessages
(
dataSet
:
List
<
BaseUiModel
<*
>>)
{
ui
{
ui
{
// track the message sent immediately after the current message
// track the message sent immediately after the current message
...
@@ -666,7 +728,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -666,7 +728,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
}
private
fun
setupMessageComposer
(
canPost
:
Boolean
)
{
private
fun
setupMessageComposer
(
canPost
:
Boolean
)
{
if
(
is
ChatRoom
ReadOnly
&&
!
canPost
)
{
if
(
isReadOnly
&&
!
canPost
)
{
text_room_is_read_only
.
isVisible
=
true
text_room_is_read_only
.
isVisible
=
true
input_container
.
isVisible
=
false
input_container
.
isVisible
=
false
}
else
if
(!
isSubscribed
&&
roomTypeOf
(
chatRoomType
)
!
is
RoomType
.
DirectMessage
)
{
}
else
if
(!
isSubscribed
&&
roomTypeOf
(
chatRoomType
)
!
is
RoomType
.
DirectMessage
)
{
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
3fca09b7
...
@@ -60,9 +60,17 @@ class ChatRoomsPresenter @Inject constructor(
...
@@ -60,9 +60,17 @@ class ChatRoomsPresenter @Inject constructor(
}
else
{
}
else
{
id
id
}
}
val
isChatRoomOwner
=
ownerId
==
myself
.
id
||
isDirectMessage
navigator
.
toChatRoom
(
id
,
roomName
,
type
,
readonly
?:
false
,
navigator
.
toChatRoom
(
lastSeen
?:
-
1
,
open
,
isChatRoomOwner
)
chatRoomId
=
id
,
chatRoomName
=
roomName
,
chatRoomType
=
type
,
isReadOnly
=
readonly
?:
false
,
chatRoomLastSeen
=
lastSeen
?:
-
1
,
isSubscribed
=
open
,
isCreator
=
ownerId
==
myself
.
id
||
isDirectMessage
,
isFavorite
=
favorite
?:
false
)
}
}
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt
View file @
3fca09b7
...
@@ -41,20 +41,22 @@ class MainNavigator(internal val activity: MainActivity) {
...
@@ -41,20 +41,22 @@ class MainNavigator(internal val activity: MainActivity) {
chatRoomId
:
String
,
chatRoomId
:
String
,
chatRoomName
:
String
,
chatRoomName
:
String
,
chatRoomType
:
String
,
chatRoomType
:
String
,
is
ChatRoom
ReadOnly
:
Boolean
,
isReadOnly
:
Boolean
,
chatRoomLastSeen
:
Long
,
chatRoomLastSeen
:
Long
,
isChatRoomSubscribed
:
Boolean
,
isSubscribed
:
Boolean
,
isChatRoomCreator
:
Boolean
isCreator
:
Boolean
,
isFavorite
:
Boolean
)
{
)
{
activity
.
startActivity
(
activity
.
startActivity
(
activity
.
chatRoomIntent
(
activity
.
chatRoomIntent
(
chatRoomId
,
chatRoomId
,
chatRoomName
,
chatRoomName
,
chatRoomType
,
chatRoomType
,
is
ChatRoom
ReadOnly
,
isReadOnly
,
chatRoomLastSeen
,
chatRoomLastSeen
,
isChatRoomSubscribed
,
isSubscribed
,
isChatRoomCreator
isCreator
,
isFavorite
)
)
)
)
activity
.
overridePendingTransition
(
R
.
anim
.
open_enter
,
R
.
anim
.
open_exit
)
activity
.
overridePendingTransition
(
R
.
anim
.
open_enter
,
R
.
anim
.
open_exit
)
...
...
app/src/main/res/drawable/ic_star_border_white_24dp.xml
0 → 100644
View file @
3fca09b7
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FFFFFFFF"
android:pathData=
"M22,9.24l-7.19,-0.62L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.63,-7.03L22,9.24zM12,15.4l-3.76,2.27 1,-4.28 -3.32,-2.88 4.38,-0.38L12,6.1l1.71,4.04 4.38,0.38 -3.32,2.88 1,4.28L12,15.4z"
/>
</vector>
app/src/main/res/drawable/ic_star_yellow_24dp.xml
0 → 100644
View file @
3fca09b7
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FFFFF59D"
android:pathData=
"M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"
/>
</vector>
app/src/main/res/menu/chatroom_actions.xml
deleted
100644 → 0
View file @
847d6e6f
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@+id/action_members_list"
android:title=
"@string/title_members_list"
android:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_mentions"
android:title=
"@string/msg_mentions"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_pinned_messages"
android:title=
"@string/title_pinned_messages"
android:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_favorite_messages"
android:title=
"@string/title_favorite_messages"
android:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_files"
android:title=
"@string/msg_files"
android:showAsAction=
"never"
/>
</menu>
\ No newline at end of file
app/src/main/res/values-es/strings.xml
View file @
3fca09b7
...
@@ -188,6 +188,11 @@
...
@@ -188,6 +188,11 @@
// TODO: Add proper translation.
// TODO: Add proper translation.
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<!-- Favorite/Unfavorite chat room -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
<string
name=
"title_unfavorite_chat"
>
Unfavorite chat
</string>
<!-- Members List -->
<!-- Members List -->
<string
name=
"title_members_list"
>
Miembros
</string>
<string
name=
"title_members_list"
>
Miembros
</string>
...
@@ -210,7 +215,7 @@
...
@@ -210,7 +215,7 @@
<!-- Files -->
<!-- Files -->
<!-- TODO Add proper translation-->
<!-- TODO Add proper translation-->
<string
name=
"
msg
_files"
>
Files
</string>
<string
name=
"
title
_files"
>
Files
</string>
<string
name=
"title_files_total"
>
Files (%d)
</string>
<string
name=
"title_files_total"
>
Files (%d)
</string>
<string
name=
"msg_no_files"
>
No files
</string>
<string
name=
"msg_no_files"
>
No files
</string>
<string
name=
"msg_all_files_appear_here"
>
All the files appear here
</string>
<string
name=
"msg_all_files_appear_here"
>
All the files appear here
</string>
...
...
app/src/main/res/values-fr/strings.xml
View file @
3fca09b7
...
@@ -189,6 +189,11 @@
...
@@ -189,6 +189,11 @@
// TODO: Add proper translation.
// TODO: Add proper translation.
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<!-- Favorite/Unfavorite chat room -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
<string
name=
"title_unfavorite_chat"
>
Unfavorite chat
</string>
<!-- Members List -->
<!-- Members List -->
<string
name=
"title_members_list"
>
Membres
</string>
<string
name=
"title_members_list"
>
Membres
</string>
...
@@ -211,7 +216,7 @@
...
@@ -211,7 +216,7 @@
<!-- Files -->
<!-- Files -->
<!-- TODO Add proper translation-->
<!-- TODO Add proper translation-->
<string
name=
"
msg
_files"
>
Files
</string>
<string
name=
"
title
_files"
>
Files
</string>
<string
name=
"title_files_total"
>
Files (%d)
</string>
<string
name=
"title_files_total"
>
Files (%d)
</string>
<string
name=
"msg_no_files"
>
No files
</string>
<string
name=
"msg_no_files"
>
No files
</string>
<string
name=
"msg_all_files_appear_here"
>
All the files appear here
</string>
<string
name=
"msg_all_files_appear_here"
>
All the files appear here
</string>
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
3fca09b7
...
@@ -175,6 +175,11 @@
...
@@ -175,6 +175,11 @@
<string
name=
"permission_pinning_not_allowed"
>
पिनि करने की अनुमति नहीं है
</string>
<string
name=
"permission_pinning_not_allowed"
>
पिनि करने की अनुमति नहीं है
</string>
<string
name=
"permission_starring_not_allowed"
>
तारांकित की अनुमति नहीं है
</string>
<string
name=
"permission_starring_not_allowed"
>
तारांकित की अनुमति नहीं है
</string>
<!-- Favorite/Unfavorite chat room -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
<string
name=
"title_unfavorite_chat"
>
Unfavorite chat
</string>
<!-- Members List -->
<!-- Members List -->
<string
name=
"title_members_list"
>
सदस्य
</string>
<string
name=
"title_members_list"
>
सदस्य
</string>
...
@@ -195,7 +200,7 @@
...
@@ -195,7 +200,7 @@
<string
name=
"no_favorite_description"
>
सभी पसंदीदा संदेश यहां\nदिखाई देते हैं
</string>
<string
name=
"no_favorite_description"
>
सभी पसंदीदा संदेश यहां\nदिखाई देते हैं
</string>
<!-- Files -->
<!-- Files -->
<string
name=
"
msg
_files"
>
फ़ाइलें
</string>
<string
name=
"
title
_files"
>
फ़ाइलें
</string>
<string
name=
"title_files_total"
>
फ़ाइलें (%d)
</string>
<string
name=
"title_files_total"
>
फ़ाइलें (%d)
</string>
<string
name=
"msg_no_files"
>
कोई फाइल नहीं है
</string>
<string
name=
"msg_no_files"
>
कोई फाइल नहीं है
</string>
<string
name=
"msg_all_files_appear_here"
>
सभी फाइलें यहां दिखाई देती हैं
</string>
<string
name=
"msg_all_files_appear_here"
>
सभी फाइलें यहां दिखाई देती हैं
</string>
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
3fca09b7
...
@@ -172,6 +172,10 @@
...
@@ -172,6 +172,10 @@
<string
name=
"permission_pinning_not_allowed"
>
Pinagem não permitida
</string>
<string
name=
"permission_pinning_not_allowed"
>
Pinagem não permitida
</string>
<string
name=
"permission_starring_not_allowed"
>
Favoritar não permitido
</string>
<string
name=
"permission_starring_not_allowed"
>
Favoritar não permitido
</string>
<!-- Favorite/Unfavorite chat room -->
<string
name=
"title_favorite_chat"
>
Favoritar canal
</string>
<string
name=
"title_unfavorite_chat"
>
Desfavoritar canal
</string>
<!-- Members List -->
<!-- Members List -->
<string
name=
"title_members_list"
>
Membros
</string>
<string
name=
"title_members_list"
>
Membros
</string>
...
@@ -191,7 +195,7 @@
...
@@ -191,7 +195,7 @@
<string
name=
"no_favorite_description"
>
Todas mensagens favoritas\naparecerão aqui
</string>
<string
name=
"no_favorite_description"
>
Todas mensagens favoritas\naparecerão aqui
</string>
<!-- Files -->
<!-- Files -->
<string
name=
"
msg
_files"
>
Arquivos
</string>
<string
name=
"
title
_files"
>
Arquivos
</string>
<string
name=
"title_files_total"
>
Arquivos (%d)
</string>
<string
name=
"title_files_total"
>
Arquivos (%d)
</string>
<string
name=
"msg_no_files"
>
Nenhum arquivo
</string>
<string
name=
"msg_no_files"
>
Nenhum arquivo
</string>
<string
name=
"msg_all_files_appear_here"
>
Todos arquivos aparecerão aqui
</string>
<string
name=
"msg_all_files_appear_here"
>
Todos arquivos aparecerão aqui
</string>
...
...
app/src/main/res/values-uk-rRU/strings.xml
View file @
3fca09b7
...
@@ -168,6 +168,11 @@
...
@@ -168,6 +168,11 @@
<string
name=
"permission_pinning_not_allowed"
>
Прикрепление запрещено
</string>
<string
name=
"permission_pinning_not_allowed"
>
Прикрепление запрещено
</string>
<string
name=
"permission_starring_not_allowed"
>
Отмечивание запрещено
</string>
<string
name=
"permission_starring_not_allowed"
>
Отмечивание запрещено
</string>
<!-- Favorite/Unfavorite chat room -->
<!-- TODO Add proper translation-->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
<string
name=
"title_unfavorite_chat"
>
Unfavorite chat
</string>
<!-- Members List -->
<!-- Members List -->
<string
name=
"title_members_list"
>
Пользователи
</string>
<string
name=
"title_members_list"
>
Пользователи
</string>
...
@@ -187,7 +192,7 @@
...
@@ -187,7 +192,7 @@
<string
name=
"no_favorite_description"
>
Все избранные сообщения\nотображаются здесь
</string>
<string
name=
"no_favorite_description"
>
Все избранные сообщения\nотображаются здесь
</string>
<!-- Files -->
<!-- Files -->
<string
name=
"
msg
_files"
>
Файлы
</string>
<string
name=
"
title
_files"
>
Файлы
</string>
<string
name=
"title_files_total"
>
Файлы (%d)
</string>
<string
name=
"title_files_total"
>
Файлы (%d)
</string>
<string
name=
"msg_no_files"
>
Нет файлов
</string>
<string
name=
"msg_no_files"
>
Нет файлов
</string>
<string
name=
"msg_all_files_appear_here"
>
Все файлы отображаются здесь
</string>
<string
name=
"msg_all_files_appear_here"
>
Все файлы отображаются здесь
</string>
...
...
app/src/main/res/values/strings.xml
View file @
3fca09b7
...
@@ -171,6 +171,10 @@
...
@@ -171,6 +171,10 @@
<string
name=
"permission_pinning_not_allowed"
>
Pinning is not allowed
</string>
<string
name=
"permission_pinning_not_allowed"
>
Pinning is not allowed
</string>
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<string
name=
"permission_starring_not_allowed"
>
Starring is not allowed
</string>
<!-- Favorite/Unfavorite chat room -->
<string
name=
"title_favorite_chat"
>
Favorite chat
</string>
<string
name=
"title_unfavorite_chat"
>
Unfavorite chat
</string>
<!-- Members List -->
<!-- Members List -->
<string
name=
"title_members_list"
>
Members
</string>
<string
name=
"title_members_list"
>
Members
</string>
...
@@ -190,7 +194,7 @@
...
@@ -190,7 +194,7 @@
<string
name=
"no_favorite_description"
>
All the favorite messages\nappear here
</string>
<string
name=
"no_favorite_description"
>
All the favorite messages\nappear here
</string>
<!-- Files -->
<!-- Files -->
<string
name=
"
msg
_files"
>
Files
</string>
<string
name=
"
title
_files"
>
Files
</string>
<string
name=
"title_files_total"
>
Files (%d)
</string>
<string
name=
"title_files_total"
>
Files (%d)
</string>
<string
name=
"msg_no_files"
>
No files
</string>
<string
name=
"msg_no_files"
>
No files
</string>
<string
name=
"msg_all_files_appear_here"
>
All the files appear here
</string>
<string
name=
"msg_all_files_appear_here"
>
All the files appear here
</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