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
6cd577a3
Commit
6cd577a3
authored
Jul 24, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds reset avatar feature.
parent
55ec0626
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
1 deletion
+40
-1
ProfilePresenter.kt
...t/rocket/android/profile/presentation/ProfilePresenter.kt
+19
-0
ProfileFragment.kt
...in/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+5
-0
update_avatar_options.xml
app/src/main/res/layout/update_avatar_options.xml
+10
-0
strings.xml
app/src/main/res/values-es/strings.xml
+1
-1
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-pt-rBR/strings.xml
+1
-0
strings.xml
app/src/main/res/values-ru/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/profile/presentation/ProfilePresenter.kt
View file @
6cd577a3
...
@@ -15,6 +15,7 @@ import chat.rocket.android.util.retryIO
...
@@ -15,6 +15,7 @@ import chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.util.ifNull
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.rest.resetAvatar
import
chat.rocket.core.internal.rest.setAvatar
import
chat.rocket.core.internal.rest.setAvatar
import
chat.rocket.core.internal.rest.updateProfile
import
chat.rocket.core.internal.rest.updateProfile
import
java.util.*
import
java.util.*
...
@@ -128,4 +129,22 @@ class ProfilePresenter @Inject constructor(
...
@@ -128,4 +129,22 @@ class ProfilePresenter @Inject constructor(
}
}
}
}
}
}
fun
resetAvatar
()
{
launchUI
(
strategy
)
{
view
.
showLoading
()
try
{
retryIO
{
client
.
resetAvatar
(
myselfId
)
}
view
.
reloadUserAvatar
(
serverUrl
.
avatarUrl
(
myselfUsername
))
}
catch
(
exception
:
RocketChatException
)
{
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
}
finally
{
view
.
hideLoading
()
}
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
View file @
6cd577a3
...
@@ -183,6 +183,11 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
...
@@ -183,6 +183,11 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
dispatchTakePicture
(
REQUEST_CODE_FOR_PERFORM_CAMERA
)
dispatchTakePicture
(
REQUEST_CODE_FOR_PERFORM_CAMERA
)
hideUpdateAvatarOptions
()
hideUpdateAvatarOptions
()
}
}
button_reset_avatar
.
setOnClickListener
{
hideUpdateAvatarOptions
()
presenter
.
resetAvatar
()
}
}
}
private
fun
showUpdateAvatarOptions
()
{
private
fun
showUpdateAvatarOptions
()
{
...
...
app/src/main/res/layout/update_avatar_options.xml
View file @
6cd577a3
...
@@ -25,4 +25,14 @@
...
@@ -25,4 +25,14 @@
android:gravity=
"start|center"
android:gravity=
"start|center"
android:text=
"@string/action_take_photo"
/>
android:text=
"@string/action_take_photo"
/>
<Button
android:id=
"@+id/button_reset_avatar"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:drawableStart=
"@drawable/ic_close_black_24dp"
android:drawablePadding=
"20dp"
android:gravity=
"start|center"
android:text=
"@string/action_reset_avatar"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values-es/strings.xml
View file @
6cd577a3
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<string
name=
"action_save_to_gallery"
>
Guardar en la galería
</string>
<string
name=
"action_save_to_gallery"
>
Guardar en la galería
</string>
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_reset_avatar"
>
Reset avatar
</string>
<!-- TODO Add translation -->
<!-- Settings List -->
<!-- Settings List -->
<string-array
name=
"settings_actions"
>
<string-array
name=
"settings_actions"
>
...
...
app/src/main/res/values-fr/strings.xml
View file @
6cd577a3
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
<string
name=
"action_save_to_gallery"
>
Save to gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_save_to_gallery"
>
Save to gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_reset_avatar"
>
Reset avatar
</string>
<!-- TODO Add translation -->
<!-- Settings List -->
<!-- Settings List -->
<string-array
name=
"settings_actions"
>
<string-array
name=
"settings_actions"
>
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
6cd577a3
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
<string
name=
"action_drawing"
>
चित्रकारी
</string>
<string
name=
"action_drawing"
>
चित्रकारी
</string>
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_reset_avatar"
>
Reset avatar
</string>
<!-- TODO Add translation -->
<!-- Settings List -->
<!-- Settings List -->
<string-array
name=
"settings_actions"
>
<string-array
name=
"settings_actions"
>
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
6cd577a3
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
<string
name=
"action_save_to_gallery"
>
Salvar na galeria
</string>
<string
name=
"action_save_to_gallery"
>
Salvar na galeria
</string>
<string
name=
"action_select_photo_from_gallery"
>
Escolher foto da galeria
</string>
<string
name=
"action_select_photo_from_gallery"
>
Escolher foto da galeria
</string>
<string
name=
"action_take_photo"
>
Tirar foto
</string>
<string
name=
"action_take_photo"
>
Tirar foto
</string>
<string
name=
"action_reset_avatar"
>
Resetar avatar
</string>
<!-- Settings List -->
<!-- Settings List -->
<string-array
name=
"settings_actions"
>
<string-array
name=
"settings_actions"
>
...
...
app/src/main/res/values-ru/strings.xml
View file @
6cd577a3
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
<string
name=
"action_save_to_gallery"
>
Сохранить в галерею
</string>
<string
name=
"action_save_to_gallery"
>
Сохранить в галерею
</string>
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_take_photo"
>
Select photo from gallery
</string>
<!-- TODO Add translation -->
<string
name=
"action_reset_avatar"
>
Reset avatar
</string>
<!-- TODO Add translation -->
<!-- Settings List -->
<!-- Settings List -->
<string-array
name=
"settings_actions"
>
<string-array
name=
"settings_actions"
>
...
...
app/src/main/res/values/strings.xml
View file @
6cd577a3
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
<string
name=
"action_save_to_gallery"
>
Save to gallery
</string>
<string
name=
"action_save_to_gallery"
>
Save to gallery
</string>
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<string
name=
"action_select_photo_from_gallery"
>
Select photo from gallery
</string>
<string
name=
"action_take_photo"
>
Take photo
</string>
<string
name=
"action_take_photo"
>
Take photo
</string>
<string
name=
"action_reset_avatar"
>
Reset avatar
</string>
<!-- Settings List -->
<!-- Settings List -->
<string-array
name=
"settings_actions"
>
<string-array
name=
"settings_actions"
>
...
...
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