Upgraded user account images

This commit is contained in:
Pierre 2018-04-19 16:16:39 +02:00
parent a3913d572f
commit 2dc07aba13
2 changed files with 7 additions and 11 deletions

View File

@ -18,6 +18,7 @@ import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper;
import org.communiquons.android.comunic.client.data.models.UserInfo; import org.communiquons.android.comunic.client.data.models.UserInfo;
import org.communiquons.android.comunic.client.data.models.ConversationMessage; import org.communiquons.android.comunic.client.data.models.ConversationMessage;
import org.communiquons.android.comunic.client.ui.utils.UiUtils; import org.communiquons.android.comunic.client.ui.utils.UiUtils;
import org.communiquons.android.comunic.client.ui.views.WebUserAccountImage;
import java.util.ArrayList; import java.util.ArrayList;
@ -97,7 +98,7 @@ public class ConversationMessageAdapter extends ArrayAdapter<ConversationMessage
findViewById(R.id.fragment_conversation_message_item_content); findViewById(R.id.fragment_conversation_message_item_content);
ImageView messageImageView = convertView. ImageView messageImageView = convertView.
findViewById(R.id.fragment_conversation_message_item_messageimage); findViewById(R.id.fragment_conversation_message_item_messageimage);
ImageView accountImageView; WebUserAccountImage accountImageView;
TextView userNameView = convertView. TextView userNameView = convertView.
findViewById(R.id.fragment_conversation_message_item_username); findViewById(R.id.fragment_conversation_message_item_username);
@ -217,18 +218,13 @@ public class ConversationMessageAdapter extends ArrayAdapter<ConversationMessage
/* /*
Update account image Update account image
*/ */
//Cancel any load pending operation
ImageLoadHelper.remove(accountImageView);
//Set the default image
accountImageView.setImageResource(R.drawable.default_account_image);
accountImageView.setVisibility(View.VISIBLE);
//Check if we can load a specific image //Check if we can load a specific image
if(user != null) { if(user != null) {
String imageURL = user.getAcountImageURL(); accountImageView.setUser(user);
ImageLoadHelper.load(getContext(), imageURL, accountImageView);
} }
else
accountImageView.removeUser();
return convertView; return convertView;

View File

@ -23,7 +23,7 @@
android:padding="5dp" android:padding="5dp"
android:background="@drawable/fragment_conversation_message_otheruser_bg"> android:background="@drawable/fragment_conversation_message_otheruser_bg">
<ImageView <org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
android:id="@+id/fragment_conversation_message_item_left_account_image" android:id="@+id/fragment_conversation_message_item_left_account_image"
android:layout_width="26dp" android:layout_width="26dp"
android:layout_height="26dp" android:layout_height="26dp"
@ -53,7 +53,7 @@
tools:layout_height="40dp" tools:layout_height="40dp"
tools:layout_width="40dp"/> tools:layout_width="40dp"/>
<ImageView <org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
android:id="@+id/fragment_conversation_message_item_right_account_image" android:id="@+id/fragment_conversation_message_item_right_account_image"
android:layout_width="26dp" android:layout_width="26dp"
android:layout_height="26dp" android:layout_height="26dp"