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
723d155d
Unverified
Commit
723d155d
authored
May 14, 2019
by
Filipe Brito
Committed by
GitHub
May 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2273 from Cool-fire/issue-profile-render
[FIX] Fixes unable to see other User profile details
parents
1fd253cc
0c89d0b6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
45 deletions
+38
-45
UserDetailsPresenter.kt
.../android/userdetails/presentation/UserDetailsPresenter.kt
+12
-22
UserDetailsView.kt
...ocket/android/userdetails/presentation/UserDetailsView.kt
+5
-5
UserDetailsFragment.kt
...chat/rocket/android/userdetails/ui/UserDetailsFragment.kt
+20
-17
fragment_user_details.xml
app/src/main/res/layout/fragment_user_details.xml
+1
-1
No files found.
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsPresenter.kt
View file @
723d155d
...
...
@@ -47,31 +47,21 @@ class UserDetailsPresenter @Inject constructor(
view
.
showLoading
()
dbManager
.
getUser
(
userId
)
?.
let
{
userEntity
=
it
val
avatarUrl
=
userEntity
.
username
?.
let
{
username
->
currentServer
.
avatarUrl
(
username
,
token
?.
userId
,
token
?.
authToken
)
}
val
avatarUrl
=
userEntity
.
username
?.
let
{
username
->
currentServer
.
avatarUrl
(
username
,
token
?.
userId
,
token
?.
authToken
)
}
val
username
=
userEntity
.
username
val
name
=
userEntity
.
name
val
utcOffset
=
userEntity
.
utcOffset
// TODO Convert UTC and display like the mockup
val
utcOffset
=
userEntity
.
utcOffset
// FIXME Convert UTC
if
(
avatarUrl
!=
null
&&
username
!=
null
&&
name
!=
null
&&
utcOffset
!=
null
)
{
view
.
showUserDetailsAndActions
(
avatarUrl
=
avatarUrl
,
name
=
name
,
username
=
username
,
status
=
userEntity
.
status
,
utcOffset
=
utcOffset
.
toString
(),
isVideoCallAllowed
=
settings
.
isJitsiEnabled
()
)
}
else
{
throw
Exception
()
}
view
.
showUserDetailsAndActions
(
avatarUrl
=
avatarUrl
,
name
=
name
,
username
=
username
,
status
=
userEntity
.
status
,
utcOffset
=
utcOffset
.
toString
(),
isVideoCallAllowed
=
settings
.
isJitsiEnabled
()
)
}
}
catch
(
ex
:
Exception
)
{
Timber
.
e
(
ex
)
...
...
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsView.kt
View file @
723d155d
...
...
@@ -16,11 +16,11 @@ interface UserDetailsView : LoadingView, MessageView {
* @param isVideoCallAllowed True if the video call is allowed, false otherwise.
*/
fun
showUserDetailsAndActions
(
avatarUrl
:
String
,
name
:
String
,
username
:
String
,
status
:
String
,
utcOffset
:
String
,
avatarUrl
:
String
?
,
name
:
String
?
,
username
:
String
?
,
status
:
String
?
,
utcOffset
:
String
?
,
isVideoCallAllowed
:
Boolean
)
}
app/src/main/java/chat/rocket/android/userdetails/ui/UserDetailsFragment.kt
View file @
723d155d
...
...
@@ -79,14 +79,15 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
}
override
fun
showUserDetailsAndActions
(
avatarUrl
:
String
,
name
:
String
,
username
:
String
,
status
:
String
,
utcOffset
:
String
,
avatarUrl
:
String
?
,
name
:
String
?
,
username
:
String
?
,
status
:
String
?
,
utcOffset
:
String
?
,
isVideoCallAllowed
:
Boolean
)
{
val
requestBuilder
=
Glide
.
with
(
this
).
load
(
avatarUrl
)
val
requestBuilder
=
Glide
.
with
(
this
)
.
load
(
avatarUrl
)
.
apply
(
RequestOptions
.
skipMemoryCacheOf
(
true
))
.
apply
(
RequestOptions
.
diskCacheStrategyOf
(
DiskCacheStrategy
.
NONE
))
...
...
@@ -97,19 +98,21 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
requestBuilder
.
apply
(
RequestOptions
.
bitmapTransform
(
RoundedCorners
(
14
)))
.
into
(
image_avatar
)
text_name
.
text
=
name
text_username
.
text
=
username
text_description_status
.
text
=
status
.
substring
(
0
,
1
).
toUpperCase
()
+
status
.
substring
(
1
)
text_description_timezone
.
text
=
utcOffset
text_name
.
text
=
name
?:
getString
(
R
.
string
.
msg_unknown
)
text_username
.
text
=
username
?:
getString
(
R
.
string
.
msg_unknown
)
// We should also setup the user details listeners.
text_message
.
setOnClickListener
{
presenter
.
createDirectMessage
(
username
)
}
text_description_status
.
text
=
status
?.
capitalize
()
?:
getString
(
R
.
string
.
msg_unknown
)
text_description_timezone
.
text
=
utcOffset
?:
getString
(
R
.
string
.
msg_unknown
)
text_video_call
.
isVisible
=
isVideoCallAllowed
if
(
isVideoCallAllowed
)
{
text_video_call
.
isVisible
=
true
text_video_call
.
setOnClickListener
{
presenter
.
toVideoConference
(
username
)
}
}
else
{
text_video_call
.
isVisible
=
false
// We should also setup the user details listeners.
username
?.
run
{
text_message
.
setOnClickListener
{
presenter
.
createDirectMessage
(
this
)
}
if
(
isVideoCallAllowed
)
{
text_video_call
.
setOnClickListener
{
presenter
.
toVideoConference
(
this
)
}
}
}
}
...
...
app/src/main/res/layout/fragment_user_details.xml
View file @
723d155d
...
...
@@ -143,6 +143,6 @@
android:id=
"@+id/group_user_details"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:constraint_referenced_ids=
"image_blur, image_avatar, text_name, text_username, text_message, text_title_status, text_description_status, text_title_timezone, text_description_timezone"
/>
app:constraint_referenced_ids=
"image_blur, image_avatar, text_name, text_username, text_message, text_title_status, text_description_status, text_title_timezone, text_description_timezone
, text_video_call
"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
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