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
28da0cb6
Commit
28da0cb6
authored
Sep 14, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RoomDialogPresenter.kt
parent
8b4f5e32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
RoomDialogPresenter.kt
...t/android/fragment/chatroom/dialog/RoomDialogPresenter.kt
+20
-7
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/dialog/RoomDialogPresenter.kt
View file @
28da0cb6
package
chat.rocket.android.fragment.chatroom.dialog
import
android.content.Context
import
android.os.Handler
import
android.util.Log
import
chat.rocket.android.R
import
chat.rocket.android.helper.OkHttpHelper
...
...
@@ -13,6 +14,8 @@ import org.json.JSONObject
class
RoomDialogPresenter
(
val
context
:
Context
,
val
view
:
RoomDialogContract
.
View
):
RoomDialogContract
.
Presenter
{
val
mainHandler
=
Handler
(
context
.
mainLooper
)
override
fun
getDataSet
(
roomId
:
String
,
roomName
:
String
,
roomType
:
String
,
...
...
@@ -90,14 +93,24 @@ class RoomDialogPresenter(val context: Context, val view: RoomDialogContract.Vie
override
fun
onResponse
(
call
:
Call
,
response
:
Response
)
{
if
(
response
.
isSuccessful
)
{
val
jSONObject
=
JSONObject
(
response
.
body
()
?.
string
())
Log
.
i
(
"REST"
,
" = "
+
jSONObject
.
toString
())
Log
.
i
(
"REST"
,
" = "
+
jSONObject
)
val
filesJSONArray
=
jSONObject
.
get
(
"files"
)
as
JSONArray
val
total
=
filesJSONArray
.
length
()
val
dataSet
=
ArrayList
<
String
>(
total
)
(
0
until
total
).
mapTo
(
dataSet
)
{
filesJSONArray
.
get
(
it
).
toString
()
}
view
.
showFileList
(
dataSet
)
val
filesJSONArrayLength
=
filesJSONArray
.
length
()
val
amazonS3JSONArray
=
JSONArray
()
for
(
i
in
0
until
filesJSONArrayLength
)
{
amazonS3JSONArray
.
put
(
filesJSONArray
.
getJSONObject
(
i
).
get
(
"AmazonS3"
))
}
val
pathJSONArray
=
JSONArray
()
val
amazonS3JSONArrayLength
=
amazonS3JSONArray
.
length
()
for
(
i
in
0
until
amazonS3JSONArrayLength
)
{
pathJSONArray
.
put
(
amazonS3JSONArray
.
getJSONObject
(
i
).
get
(
"path"
))
}
val
pathJSONArrayLength
=
pathJSONArray
.
length
()
val
dataSet
=
ArrayList
<
String
>(
pathJSONArrayLength
)
(
0
until
pathJSONArrayLength
).
mapTo
(
dataSet
)
{
pathJSONArray
.
get
(
it
).
toString
()
}
mainHandler
.
post
{
view
.
showFileList
(
dataSet
)
}
}
else
{
// TODO("move to strings.xml")
view
.
showMessage
(
"Response is not successful"
)
...
...
@@ -133,7 +146,7 @@ class RoomDialogPresenter(val context: Context, val view: RoomDialogContract.Vie
val
dataSet
=
ArrayList
<
String
>(
total
)
(
0
until
total
).
mapTo
(
dataSet
)
{
membersJSONArray
.
get
(
it
).
toString
()
}
view
.
showMemberList
(
dataSet
)
mainHandler
.
post
{
view
.
showMemberList
(
dataSet
)
}
}
else
{
// TODO("move to strings.xml")
view
.
showMessage
(
"Response is not successful"
)
...
...
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