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
c654a070
Unverified
Commit
c654a070
authored
Mar 08, 2019
by
Filipe de Lima Brito
Committed by
GitHub
Mar 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1959 from shubhsherl/I_1395
[NEW] Group chats by favorites
parents
92d3243b
85740ad5
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
38 additions
and
6 deletions
+38
-6
RoomUiModelMapper.kt
...hat/rocket/android/chatrooms/adapter/RoomUiModelMapper.kt
+24
-6
RoomUiModel.kt
...hat/rocket/android/chatrooms/adapter/model/RoomUiModel.kt
+1
-0
strings.xml
app/src/main/res/values-de/strings.xml
+1
-0
strings.xml
app/src/main/res/values-es/strings.xml
+1
-0
strings.xml
app/src/main/res/values-fa/strings.xml
+1
-0
strings.xml
app/src/main/res/values-fr/strings.xml
+1
-0
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+1
-0
strings.xml
app/src/main/res/values-it/strings.xml
+1
-0
strings.xml
app/src/main/res/values-ja/strings.xml
+1
-0
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+1
-0
strings.xml
app/src/main/res/values-ru-rRU/strings.xml
+1
-0
strings.xml
app/src/main/res/values-tr/strings.xml
+1
-0
strings.xml
app/src/main/res/values-uk/strings.xml
+1
-0
strings.xml
app/src/main/res/values-zh-rCN/strings.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/chat/rocket/android/chatrooms/adapter/RoomUiModelMapper.kt
View file @
c654a070
...
@@ -36,14 +36,29 @@ class RoomUiModelMapper(
...
@@ -36,14 +36,29 @@ class RoomUiModelMapper(
grouped
:
Boolean
=
false
,
grouped
:
Boolean
=
false
,
showLastMessage
:
Boolean
=
true
showLastMessage
:
Boolean
=
true
):
List
<
ItemHolder
<*
>>
{
):
List
<
ItemHolder
<*
>>
{
val
list
=
ArrayList
<
ItemHolder
<*>>(
rooms
.
size
+
4
)
val
list
=
ArrayList
<
ItemHolder
<*>>(
rooms
.
size
+
5
)
var
lastType
:
String
?
=
null
var
lastType
:
String
?
=
null
rooms
.
forEach
{
room
->
if
(
grouped
)
{
if
(
grouped
&&
lastType
!=
room
.
chatRoom
.
type
)
{
val
favRooms
=
rooms
.
filter
{
it
.
chatRoom
.
favorite
==
true
}
list
.
add
(
HeaderItemHolder
(
roomType
(
room
.
chatRoom
.
type
)))
val
unfavRooms
=
rooms
.
filterNot
{
it
.
chatRoom
.
favorite
==
true
}
if
(
favRooms
.
isNotEmpty
())
{
list
.
add
(
HeaderItemHolder
(
context
.
resources
.
getString
(
R
.
string
.
header_favorite
)))
}
favRooms
.
forEach
{
room
->
list
.
add
(
RoomItemHolder
(
map
(
room
,
showLastMessage
)))
}
unfavRooms
.
forEach
{
room
->
if
(
lastType
!=
room
.
chatRoom
.
type
)
{
list
.
add
(
HeaderItemHolder
(
roomType
(
room
.
chatRoom
.
type
)))
}
list
.
add
(
RoomItemHolder
(
map
(
room
,
showLastMessage
)))
lastType
=
room
.
chatRoom
.
type
}
}
else
{
rooms
.
forEach
{
room
->
list
.
add
(
RoomItemHolder
(
map
(
room
,
showLastMessage
)))
}
}
list
.
add
(
RoomItemHolder
(
map
(
room
,
showLastMessage
)))
lastType
=
room
.
chatRoom
.
type
}
}
return
list
return
list
...
@@ -108,6 +123,7 @@ class RoomUiModelMapper(
...
@@ -108,6 +123,7 @@ class RoomUiModelMapper(
val
type
=
roomTypeOf
(
type
)
val
type
=
roomTypeOf
(
type
)
val
status
=
chatRoom
.
status
?.
let
{
userStatusOf
(
it
)
}
val
status
=
chatRoom
.
status
?.
let
{
userStatusOf
(
it
)
}
val
roomName
=
mapName
(
name
,
fullname
)
val
roomName
=
mapName
(
name
,
fullname
)
val
favorite
=
favorite
val
timestamp
=
mapDate
(
lastMessageTimestamp
?:
updatedAt
)
val
timestamp
=
mapDate
(
lastMessageTimestamp
?:
updatedAt
)
val
avatar
=
if
(
type
is
RoomType
.
DirectMessage
)
{
val
avatar
=
if
(
type
is
RoomType
.
DirectMessage
)
{
serverUrl
.
avatarUrl
(
name
)
serverUrl
.
avatarUrl
(
name
)
...
@@ -140,6 +156,7 @@ class RoomUiModelMapper(
...
@@ -140,6 +156,7 @@ class RoomUiModelMapper(
date
=
timestamp
,
date
=
timestamp
,
unread
=
unread
,
unread
=
unread
,
mentions
=
hasMentions
,
mentions
=
hasMentions
,
favorite
=
favorite
,
alert
=
isUnread
,
alert
=
isUnread
,
lastMessage
=
lastMessageMarkdown
,
lastMessage
=
lastMessageMarkdown
,
status
=
status
,
status
=
status
,
...
@@ -157,6 +174,7 @@ class RoomUiModelMapper(
...
@@ -157,6 +174,7 @@ class RoomUiModelMapper(
private
fun
roomType
(
type
:
String
):
String
{
private
fun
roomType
(
type
:
String
):
String
{
val
resources
=
context
.
resources
val
resources
=
context
.
resources
return
when
(
type
)
{
return
when
(
type
)
{
RoomType
.
CHANNEL
->
resources
.
getString
(
R
.
string
.
header_channel
)
RoomType
.
CHANNEL
->
resources
.
getString
(
R
.
string
.
header_channel
)
RoomType
.
PRIVATE_GROUP
->
resources
.
getString
(
R
.
string
.
header_private_groups
)
RoomType
.
PRIVATE_GROUP
->
resources
.
getString
(
R
.
string
.
header_private_groups
)
...
...
app/src/main/java/chat/rocket/android/chatrooms/adapter/model/RoomUiModel.kt
View file @
c654a070
...
@@ -12,6 +12,7 @@ data class RoomUiModel(
...
@@ -12,6 +12,7 @@ data class RoomUiModel(
val
date
:
CharSequence
?
=
null
,
val
date
:
CharSequence
?
=
null
,
val
unread
:
String
?
=
null
,
val
unread
:
String
?
=
null
,
val
alert
:
Boolean
=
false
,
val
alert
:
Boolean
=
false
,
val
favorite
:
Boolean
?
=
false
,
val
mentions
:
Boolean
=
false
,
val
mentions
:
Boolean
=
false
,
val
lastMessage
:
CharSequence
?
=
null
,
val
lastMessage
:
CharSequence
?
=
null
,
val
status
:
UserStatus
?
=
null
,
val
status
:
UserStatus
?
=
null
,
...
...
app/src/main/res/values-de/strings.xml
View file @
c654a070
...
@@ -324,6 +324,7 @@
...
@@ -324,6 +324,7 @@
<string
name=
"chatroom_header"
>
Kopf
</string>
<string
name=
"chatroom_header"
>
Kopf
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
Räume
</string>
<string
name=
"header_channel"
>
Räume
</string>
<string
name=
"header_private_groups"
>
Private Räume
</string>
<string
name=
"header_private_groups"
>
Private Räume
</string>
<string
name=
"header_direct_messages"
>
Direkt Nachrichten
</string>
<string
name=
"header_direct_messages"
>
Direkt Nachrichten
</string>
...
...
app/src/main/res/values-es/strings.xml
View file @
c654a070
...
@@ -315,6 +315,7 @@
...
@@ -315,6 +315,7 @@
<string
name=
"chatroom_header"
>
Cabezazo
</string>
<string
name=
"chatroom_header"
>
Cabezazo
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
Canales
</string>
<string
name=
"header_channel"
>
Canales
</string>
<string
name=
"header_private_groups"
>
Grupos privados
</string>
<string
name=
"header_private_groups"
>
Grupos privados
</string>
<string
name=
"header_direct_messages"
>
Mensajes directos
</string>
<string
name=
"header_direct_messages"
>
Mensajes directos
</string>
...
...
app/src/main/res/values-fa/strings.xml
View file @
c654a070
...
@@ -318,6 +318,7 @@
...
@@ -318,6 +318,7 @@
<string
name=
"chatroom_header"
>
سرپیام
</string>
<string
name=
"chatroom_header"
>
سرپیام
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
کانالها
</string>
<string
name=
"header_channel"
>
کانالها
</string>
<string
name=
"header_private_groups"
>
گروههای خصوصی
</string>
<string
name=
"header_private_groups"
>
گروههای خصوصی
</string>
<string
name=
"header_direct_messages"
>
پیامهای خصوصی
</string>
<string
name=
"header_direct_messages"
>
پیامهای خصوصی
</string>
...
...
app/src/main/res/values-fr/strings.xml
View file @
c654a070
...
@@ -319,6 +319,7 @@
...
@@ -319,6 +319,7 @@
<string
name=
"chatroom_header"
>
Entête
</string>
<string
name=
"chatroom_header"
>
Entête
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
Salons
</string>
<string
name=
"header_channel"
>
Salons
</string>
<string
name=
"header_private_groups"
>
Groupes privés
</string>
<string
name=
"header_private_groups"
>
Groupes privés
</string>
<string
name=
"header_direct_messages"
>
Messages directs
</string>
<string
name=
"header_direct_messages"
>
Messages directs
</string>
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
c654a070
...
@@ -319,6 +319,7 @@
...
@@ -319,6 +319,7 @@
<string
name=
"chatroom_header"
>
हैडर
</string>
<string
name=
"chatroom_header"
>
हैडर
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
चैनलों
</string>
<string
name=
"header_channel"
>
चैनलों
</string>
<string
name=
"header_private_groups"
>
निजी समूहों
</string>
<string
name=
"header_private_groups"
>
निजी समूहों
</string>
<string
name=
"header_direct_messages"
>
प्रत्यक्ष संदेश
</string>
<string
name=
"header_direct_messages"
>
प्रत्यक्ष संदेश
</string>
...
...
app/src/main/res/values-it/strings.xml
View file @
c654a070
...
@@ -315,6 +315,7 @@
...
@@ -315,6 +315,7 @@
<string
name=
"chatroom_header"
>
Intestazione
</string>
<string
name=
"chatroom_header"
>
Intestazione
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
Canali
</string>
<string
name=
"header_channel"
>
Canali
</string>
<string
name=
"header_private_groups"
>
Gruppi Privati
</string>
<string
name=
"header_private_groups"
>
Gruppi Privati
</string>
<string
name=
"header_direct_messages"
>
Messaggi Diretti
</string>
<string
name=
"header_direct_messages"
>
Messaggi Diretti
</string>
...
...
app/src/main/res/values-ja/strings.xml
View file @
c654a070
...
@@ -319,6 +319,7 @@
...
@@ -319,6 +319,7 @@
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
チャンネル
</string>
<string
name=
"header_channel"
>
チャンネル
</string>
<string
name=
"header_private_groups"
>
プライベートグループ
</string>
<string
name=
"header_private_groups"
>
プライベートグループ
</string>
<string
name=
"header_direct_messages"
>
ダイレクトメッセージ
</string>
<string
name=
"header_direct_messages"
>
ダイレクトメッセージ
</string>
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
c654a070
...
@@ -317,6 +317,7 @@
...
@@ -317,6 +317,7 @@
<string
name=
"chatroom_header"
>
Cabeçalho
</string>
<string
name=
"chatroom_header"
>
Cabeçalho
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favoritos
</string>
<string
name=
"header_channel"
>
Canais
</string>
<string
name=
"header_channel"
>
Canais
</string>
<string
name=
"header_private_groups"
>
Grupos Privados
</string>
<string
name=
"header_private_groups"
>
Grupos Privados
</string>
<string
name=
"header_direct_messages"
>
Mensagens diretas
</string>
<string
name=
"header_direct_messages"
>
Mensagens diretas
</string>
...
...
app/src/main/res/values-ru-rRU/strings.xml
View file @
c654a070
...
@@ -315,6 +315,7 @@
...
@@ -315,6 +315,7 @@
<string
name=
"chatroom_header"
>
Заголовок
</string>
<string
name=
"chatroom_header"
>
Заголовок
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
Каналы
</string>
<string
name=
"header_channel"
>
Каналы
</string>
<string
name=
"header_private_groups"
>
Приватные каналы
</string>
<string
name=
"header_private_groups"
>
Приватные каналы
</string>
<string
name=
"header_direct_messages"
>
Личная переписка
</string>
<string
name=
"header_direct_messages"
>
Личная переписка
</string>
...
...
app/src/main/res/values-tr/strings.xml
View file @
c654a070
...
@@ -320,6 +320,7 @@
...
@@ -320,6 +320,7 @@
<string
name=
"chatroom_header"
>
Başlık
</string>
<string
name=
"chatroom_header"
>
Başlık
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
Kanallar
</string>
<string
name=
"header_channel"
>
Kanallar
</string>
<string
name=
"header_private_groups"
>
Gizli Gruplar
</string>
<string
name=
"header_private_groups"
>
Gizli Gruplar
</string>
<string
name=
"header_direct_messages"
>
Direkt Mesajlar
</string>
<string
name=
"header_direct_messages"
>
Direkt Mesajlar
</string>
...
...
app/src/main/res/values-uk/strings.xml
View file @
c654a070
...
@@ -316,6 +316,7 @@
...
@@ -316,6 +316,7 @@
<string
name=
"chatroom_header"
>
Заголовок
</string>
<string
name=
"chatroom_header"
>
Заголовок
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
Канали
</string>
<string
name=
"header_channel"
>
Канали
</string>
<string
name=
"header_private_groups"
>
Приватні канали
</string>
<string
name=
"header_private_groups"
>
Приватні канали
</string>
<string
name=
"header_direct_messages"
>
Особисті повідомлення
</string>
<string
name=
"header_direct_messages"
>
Особисті повідомлення
</string>
...
...
app/src/main/res/values-zh-rCN/strings.xml
View file @
c654a070
...
@@ -315,6 +315,7 @@
...
@@ -315,6 +315,7 @@
<string
name=
"chatroom_header"
>
头部
</string>
<string
name=
"chatroom_header"
>
头部
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<!-- TODO - Add proper translation -->
<string
name=
"header_channel"
>
频道
</string>
<string
name=
"header_channel"
>
频道
</string>
<string
name=
"header_private_groups"
>
私人组
</string>
<string
name=
"header_private_groups"
>
私人组
</string>
<string
name=
"header_direct_messages"
>
直接对话
</string>
<string
name=
"header_direct_messages"
>
直接对话
</string>
...
...
app/src/main/res/values/strings.xml
View file @
c654a070
...
@@ -331,6 +331,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
...
@@ -331,6 +331,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<string
name=
"chatroom_header"
>
Header
</string>
<string
name=
"chatroom_header"
>
Header
</string>
<!--ChatRooms Headers-->
<!--ChatRooms Headers-->
<string
name=
"header_favorite"
>
Favorites
</string>
<string
name=
"header_channel"
>
Channels
</string>
<string
name=
"header_channel"
>
Channels
</string>
<string
name=
"header_private_groups"
>
Private Groups
</string>
<string
name=
"header_private_groups"
>
Private Groups
</string>
<string
name=
"header_direct_messages"
>
Direct Messages
</string>
<string
name=
"header_direct_messages"
>
Direct Messages
</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