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
d9f9adb6
Unverified
Commit
d9f9adb6
authored
Dec 27, 2017
by
Leonardo Aramaki
Committed by
GitHub
Dec 27, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into patch-5
parents
7504c46b
8b7da88d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
RoomListPresenter.kt
...ocket/android/fragment/chatroom/list/RoomListPresenter.kt
+10
-5
strings.xml
app/src/main/res/values/strings.xml
+2
-2
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/list/RoomListPresenter.kt
View file @
d9f9adb6
...
...
@@ -23,13 +23,14 @@ import java.sql.Timestamp
* Created by Filipe de Lima Brito (filipedelimabrito@gmail.com) on 9/22/17.
*/
class
RoomListPresenter
(
val
context
:
Context
,
val
view
:
RoomListContract
.
View
)
:
RoomListContract
.
Presenter
{
private
lateinit
var
TAG
:
String
override
fun
requestPinnedMessages
(
roomId
:
String
,
roomType
:
String
,
hostname
:
String
,
token
:
String
,
userId
:
String
,
offset
:
Int
)
{
TAG
=
"pinned"
view
.
showWaitingView
(
true
)
OkHttpHelper
.
getClient
()
.
newCall
(
RestApiHelper
.
getRequestForPinnedMessages
(
roomId
,
...
...
@@ -53,7 +54,7 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View) :
if
(
response
.
isSuccessful
)
{
val
result
=
response
.
body
()
?.
string
()
if
(
result
!=
null
)
{
handleMessagesJson
(
result
,
true
)
handleMessagesJson
(
result
,
true
,
TAG
)
}
}
else
{
showErrorMessage
(
response
.
message
())
...
...
@@ -68,6 +69,7 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View) :
token
:
String
,
userId
:
String
,
offset
:
Int
)
{
TAG
=
"favorite"
view
.
showWaitingView
(
true
)
OkHttpHelper
.
getClient
()
.
newCall
(
RestApiHelper
.
getRequestForFavoriteMessages
(
roomId
,
...
...
@@ -91,7 +93,7 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View) :
if
(
response
.
isSuccessful
)
{
val
result
=
response
.
body
()
?.
string
()
if
(
result
!=
null
)
{
handleMessagesJson
(
result
,
false
)
handleMessagesJson
(
result
,
false
,
TAG
)
}
}
else
{
showErrorMessage
(
response
.
message
())
...
...
@@ -180,7 +182,7 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View) :
OkHttpHelper
.
getClient
().
dispatcher
().
cancelAll
()
}
private
fun
handleMessagesJson
(
json
:
String
,
isPinnedMessage
:
Boolean
)
{
private
fun
handleMessagesJson
(
json
:
String
,
isPinnedMessage
:
Boolean
,
TAG
:
String
)
{
try
{
val
jSONObject
=
JSONObject
(
json
)
val
messagesJSONArray
=
jSONObject
.
getJSONArray
(
"messages"
)
...
...
@@ -204,7 +206,10 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View) :
}
if
(
dataSet
.
isEmpty
()
&&
!
hasItem
)
{
showEmptyViewMessage
(
context
.
getString
(
R
.
string
.
fragment_room_list_no_favorite_message_to_show
))
if
(
TAG
.
equals
(
"favorite"
))
showEmptyViewMessage
(
context
.
getString
(
R
.
string
.
fragment_room_list_no_favorite_message_to_show
))
else
if
(
TAG
.
equals
(
"pinned"
))
showEmptyViewMessage
(
context
.
getString
(
R
.
string
.
fragment_room_list_no_pinned_message_to_show
))
}
else
{
if
(
dataSet
.
isNotEmpty
())
{
hasItem
=
true
...
...
app/src/main/res/values/strings.xml
View file @
d9f9adb6
...
...
@@ -18,8 +18,8 @@
<string
name=
"fragment_room_list_file_list_title"
>
File list (%s)
</string>
<string
name=
"fragment_room_list_member_list_title"
>
Member list (%s)
</string>
<string
name=
"fragment_room_list_could_not_load_your_request"
>
Could not load your request.\n%s.
</string>
<string
name=
"fragment_room_list_no_pinned_message_to_show"
>
No pinned message to show
</string>
<string
name=
"fragment_room_list_no_favorite_message_to_show"
>
No favorite message to show
</string>
<string
name=
"fragment_room_list_no_pinned_message_to_show"
>
No pinned message
s
to show
</string>
<string
name=
"fragment_room_list_no_favorite_message_to_show"
>
No favorite message
s
to show
</string>
<string
name=
"fragment_room_list_no_file_list_to_show"
>
No file list to show
</string>
<string
name=
"fragment_room_list_no_member_list_to_show"
>
No member list to show
</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