Unverified Commit 29edff96 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge pull request #2231 from HusseinElFeky/patch-2

[FIX] Fixed profile avatar not updating when changed
parents d01a94f4 a6e2523e
...@@ -23,7 +23,6 @@ import chat.rocket.android.settings.presentation.SettingsView ...@@ -23,7 +23,6 @@ import chat.rocket.android.settings.presentation.SettingsView
import chat.rocket.android.util.extensions.inflate import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.showToast import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.invalidateFirebaseToken import chat.rocket.android.util.invalidateFirebaseToken
import com.bumptech.glide.Glide
import dagger.android.support.AndroidSupportInjection import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.app_bar.* import kotlinx.android.synthetic.main.app_bar.*
import kotlinx.android.synthetic.main.fragment_settings.* import kotlinx.android.synthetic.main.fragment_settings.*
...@@ -65,7 +64,7 @@ class SettingsFragment : Fragment(), SettingsView { ...@@ -65,7 +64,7 @@ class SettingsFragment : Fragment(), SettingsView {
isDeleteAccountEnabled: Boolean, isDeleteAccountEnabled: Boolean,
serverVersion: String serverVersion: String
) { ) {
context?.let { Glide.with(it).load(avatar).into(image_avatar) } image_avatar.setImageURI(avatar)
text_display_name.text = displayName text_display_name.text = displayName
...@@ -89,7 +88,7 @@ class SettingsFragment : Fragment(), SettingsView { ...@@ -89,7 +88,7 @@ class SettingsFragment : Fragment(), SettingsView {
text_server_version.text = getString(R.string.msg_server_version, serverVersion) text_server_version.text = getString(R.string.msg_server_version, serverVersion)
text_logout.setOnClickListener { showLogoutDialog()} text_logout.setOnClickListener { showLogoutDialog() }
with(text_administration) { with(text_administration) {
isVisible = isAdministrationEnabled isVisible = isAdministrationEnabled
...@@ -143,8 +142,8 @@ class SettingsFragment : Fragment(), SettingsView { ...@@ -143,8 +142,8 @@ class SettingsFragment : Fragment(), SettingsView {
private fun contactSupport() { private fun contactSupport() {
val uriText = "mailto:${"support@rocket.chat"}" + val uriText = "mailto:${"support@rocket.chat"}" +
"?subject=" + Uri.encode(getString(R.string.msg_android_app_support)) + "?subject=" + Uri.encode(getString(R.string.msg_android_app_support)) +
"&body=" + Uri.encode(getDeviceAndAppInformation()) "&body=" + Uri.encode(getDeviceAndAppInformation())
with(Intent(Intent.ACTION_SENDTO)) { with(Intent(Intent.ACTION_SENDTO)) {
data = uriText.toUri() data = uriText.toUri()
...@@ -177,7 +176,7 @@ class SettingsFragment : Fragment(), SettingsView { ...@@ -177,7 +176,7 @@ class SettingsFragment : Fragment(), SettingsView {
context?.let { context?.let {
val builder = AlertDialog.Builder(it) val builder = AlertDialog.Builder(it)
builder.setTitle(R.string.title_are_you_sure) builder.setTitle(R.string.title_are_you_sure)
.setPositiveButton(R.string.action_logout) { _, _ -> presenter.logout()} .setPositiveButton(R.string.action_logout) { _, _ -> presenter.logout() }
.setNegativeButton(android.R.string.no) { dialog, _ -> dialog.cancel() } .setNegativeButton(android.R.string.no) { dialog, _ -> dialog.cancel() }
.create() .create()
.show() .show()
......
...@@ -20,6 +20,7 @@ import chat.rocket.android.util.extensions.showToast ...@@ -20,6 +20,7 @@ import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.ui import chat.rocket.android.util.extensions.ui
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.MultiTransformation import com.bumptech.glide.load.MultiTransformation
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.bitmap.CenterCrop import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.RequestOptions
...@@ -86,6 +87,8 @@ class UserDetailsFragment : Fragment(), UserDetailsView { ...@@ -86,6 +87,8 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
isVideoCallAllowed: Boolean 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))
requestBuilder.apply( requestBuilder.apply(
RequestOptions.bitmapTransform(MultiTransformation(BlurTransformation(), CenterCrop())) RequestOptions.bitmapTransform(MultiTransformation(BlurTransformation(), CenterCrop()))
...@@ -147,4 +150,4 @@ class UserDetailsFragment : Fragment(), UserDetailsView { ...@@ -147,4 +150,4 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
private fun setupListeners() { private fun setupListeners() {
image_arrow_back.setOnClickListener { activity?.onBackPressed() } image_arrow_back.setOnClickListener { activity?.onBackPressed() }
} }
} }
\ No newline at end of file
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:roundedCornerRadius="2dp" /> app:roundedCornerRadius="4dp" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="16dp"
tools:context="preferences.ui.PreferencesFragment">
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/view_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:indicatorColor="@color/colorBlack"
app:indicatorName="BallPulseIndicator"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<TextView
android:id="@+id/text_analytics_tracking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_analytics_tracking"
android:textColor="@color/colorPrimaryText"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_analytics_tracking_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_send_analytics_tracking"
android:textColor="@color/colorSecondaryText"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_analytics_tracking" />
<Switch
android:id="@+id/switch_analytics_tracking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
app:layout_constraintBottom_toBottomOf="@+id/text_analytics_tracking_description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/text_analytics_tracking" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -34,14 +34,13 @@ ...@@ -34,14 +34,13 @@
android:paddingBottom="5dp" android:paddingBottom="5dp"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/image_avatar" android:id="@+id/image_avatar"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="@drawable/bg_border_user_details_avatar"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/avatars[6]" /> app:roundedCornerRadius="4dp" />
<TextView <TextView
android:id="@+id/text_display_name" android:id="@+id/text_display_name"
...@@ -248,7 +247,6 @@ ...@@ -248,7 +247,6 @@
android:textColor="#DE000000" android:textColor="#DE000000"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="normal" android:textStyle="normal"
app:layout_constraintEnd_toStartOf="@id/switch_analytics_tracking"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment