mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
All remote images views uses WebImageView
This commit is contained in:
parent
68297ae2fd
commit
2cb7bf7eb2
@ -8,19 +8,16 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.R;
|
import org.communiquons.android.comunic.client.R;
|
||||||
import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.GroupInfo;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.Notif;
|
|
||||||
import org.communiquons.android.comunic.client.data.arrays.NotifsList;
|
import org.communiquons.android.comunic.client.data.arrays.NotifsList;
|
||||||
|
import org.communiquons.android.comunic.client.data.models.GroupInfo;
|
||||||
|
import org.communiquons.android.comunic.client.data.models.Notif;
|
||||||
|
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
||||||
import org.communiquons.android.comunic.client.data.utils.NotifsUtils;
|
import org.communiquons.android.comunic.client.data.utils.NotifsUtils;
|
||||||
import org.communiquons.android.comunic.client.data.utils.Utilities;
|
import org.communiquons.android.comunic.client.data.utils.Utilities;
|
||||||
|
import org.communiquons.android.comunic.client.ui.views.WebUserAccountImage;
|
||||||
import java.lang.reflect.Array;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifications list adapter
|
* Notifications list adapter
|
||||||
@ -77,10 +74,8 @@ public class NotificationsAdapter extends ArrayAdapter<Notif>{
|
|||||||
assert notif != null;
|
assert notif != null;
|
||||||
|
|
||||||
//Update the user account image
|
//Update the user account image
|
||||||
ImageView image = convertView.findViewById(R.id.user_account_image);
|
WebUserAccountImage accountImage = convertView.findViewById(R.id.user_account_image);
|
||||||
ImageLoadHelper.remove(image);
|
accountImage.setUser(mUsersInfo.get(notif.getFrom_user_id()));
|
||||||
ImageLoadHelper.load(getContext(),
|
|
||||||
mUsersInfo.get(notif.getFrom_user_id()).getAcountImageURL(), image);
|
|
||||||
|
|
||||||
//Update the message of the notification
|
//Update the message of the notification
|
||||||
TextView message = convertView.findViewById(R.id.notification_message);
|
TextView message = convertView.findViewById(R.id.notification_message);
|
||||||
|
@ -8,14 +8,11 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.R;
|
import org.communiquons.android.comunic.client.R;
|
||||||
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.ui.utils.UiUtils;
|
import org.communiquons.android.comunic.client.ui.views.WebUserAccountImage;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -34,21 +31,21 @@ public class UsersAsysncInfoAdapter extends ArrayAdapter<Integer> {
|
|||||||
/**
|
/**
|
||||||
* Informations about the members of the conversation
|
* Informations about the members of the conversation
|
||||||
*/
|
*/
|
||||||
private ArrayMap<Integer, UserInfo> usersInfos;
|
private ArrayMap<Integer, UserInfo> usersInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param context The context of the application
|
* @param context The context of the application
|
||||||
* @param IDs The list of IDs of users
|
* @param IDs The list of IDs of users
|
||||||
* @param usersInfos Informations about the users (can be updated asynchronously with the list
|
* @param usersInfo Information about the users (can be updated asynchronously with the list
|
||||||
* of users ID)
|
* of users ID)
|
||||||
*/
|
*/
|
||||||
public UsersAsysncInfoAdapter(Context context, @NonNull ArrayList<Integer> IDs,
|
public UsersAsysncInfoAdapter(Context context, @NonNull ArrayList<Integer> IDs,
|
||||||
@NonNull ArrayMap<Integer, UserInfo> usersInfos){
|
@NonNull ArrayMap<Integer, UserInfo> usersInfo){
|
||||||
super(context, 0, IDs);
|
super(context, 0, IDs);
|
||||||
|
|
||||||
//Save user information array map
|
//Save user information array map
|
||||||
this.usersInfos = usersInfos;
|
this.usersInfo = usersInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@ -60,25 +57,23 @@ public class UsersAsysncInfoAdapter extends ArrayAdapter<Integer> {
|
|||||||
.inflate(R.layout.user_basic_adapter_item, parent, false);
|
.inflate(R.layout.user_basic_adapter_item, parent, false);
|
||||||
|
|
||||||
//Get the views
|
//Get the views
|
||||||
ImageView account_image = convertView.findViewById(R.id.user_account_image);
|
WebUserAccountImage account_image = convertView.findViewById(R.id.user_account_image);
|
||||||
TextView account_name = convertView.findViewById(R.id.user_name);
|
TextView account_name = convertView.findViewById(R.id.user_name);
|
||||||
|
|
||||||
//Empty the entry
|
//Empty the entry
|
||||||
ImageLoadHelper.remove(account_image);
|
account_image.removeUser();
|
||||||
account_image.setImageDrawable(UiUtils.getDrawable(getContext(),
|
|
||||||
R.drawable.default_account_image));
|
|
||||||
account_name.setText("");
|
account_name.setText("");
|
||||||
|
|
||||||
//Get user ID
|
//Get user ID
|
||||||
int userID = getItem(position);
|
int userID = getItem(position);
|
||||||
|
|
||||||
//Check if we go user informations
|
//Check if we go user information
|
||||||
if(usersInfos.containsKey(userID)){
|
if(usersInfo.containsKey(userID)){
|
||||||
|
|
||||||
UserInfo user = usersInfos.get(userID);
|
UserInfo user = usersInfo.get(userID);
|
||||||
|
|
||||||
account_name.setText(user.getDisplayFullName());
|
account_name.setText(user.getDisplayFullName());
|
||||||
ImageLoadHelper.load(getContext(), user.getAcountImageURL(), account_image);
|
account_image.setUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
|
@ -7,13 +7,11 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.R;
|
import org.communiquons.android.comunic.client.R;
|
||||||
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.ui.utils.UiUtils;
|
import org.communiquons.android.comunic.client.ui.views.WebUserAccountImage;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -57,11 +55,8 @@ public class UsersBasicAdapter extends ArrayAdapter<UserInfo> {
|
|||||||
setText(userInfos.getDisplayFullName());
|
setText(userInfos.getDisplayFullName());
|
||||||
|
|
||||||
//Set account image
|
//Set account image
|
||||||
ImageView account_image = convertView.findViewById(R.id.user_account_image);
|
WebUserAccountImage account_image = convertView.findViewById(R.id.user_account_image);
|
||||||
ImageLoadHelper.remove(account_image);
|
account_image.setUser(userInfos);
|
||||||
account_image.setImageDrawable(UiUtils.getDrawable(getContext(),
|
|
||||||
R.drawable.default_account_image));
|
|
||||||
ImageLoadHelper.load(getContext(), userInfos.getAcountImageURL(), account_image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package org.communiquons.android.comunic.client.ui.fragments;
|
package org.communiquons.android.comunic.client.ui.fragments;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -17,11 +16,10 @@ import android.widget.Toast;
|
|||||||
import org.communiquons.android.comunic.client.R;
|
import org.communiquons.android.comunic.client.R;
|
||||||
import org.communiquons.android.comunic.client.data.helpers.FriendsListHelper;
|
import org.communiquons.android.comunic.client.data.helpers.FriendsListHelper;
|
||||||
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper;
|
||||||
import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper;
|
|
||||||
import org.communiquons.android.comunic.client.data.models.FriendshipStatus;
|
import org.communiquons.android.comunic.client.data.models.FriendshipStatus;
|
||||||
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
import org.communiquons.android.comunic.client.data.models.UserInfo;
|
||||||
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
|
|
||||||
import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener;
|
import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener;
|
||||||
|
import org.communiquons.android.comunic.client.ui.views.WebUserAccountImage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User access denied fragment
|
* User access denied fragment
|
||||||
@ -70,7 +68,7 @@ public class UserAccessDeniedFragment extends Fragment implements View.OnClickLi
|
|||||||
/**
|
/**
|
||||||
* User account image
|
* User account image
|
||||||
*/
|
*/
|
||||||
private ImageView mUserImage;
|
private WebUserAccountImage mUserImage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User account name
|
* User account name
|
||||||
@ -204,7 +202,7 @@ public class UserAccessDeniedFragment extends Fragment implements View.OnClickLi
|
|||||||
|
|
||||||
//Append user information
|
//Append user information
|
||||||
mUserName.setText(mUserInfo.getDisplayFullName());
|
mUserName.setText(mUserInfo.getDisplayFullName());
|
||||||
ImageLoadHelper.load(getActivity(), mUserInfo.getAcountImageURL(), mUserImage);
|
mUserImage.setUser(mUserInfo);
|
||||||
|
|
||||||
//Check if we have got the friends
|
//Check if we have got the friends
|
||||||
if(mFriendshipStatus == null){
|
if(mFriendshipStatus == null){
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_marginTop="16dp">
|
android:layout_marginTop="16dp">
|
||||||
|
|
||||||
<ImageView
|
<org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
|
||||||
android:id="@+id/user_account_image"
|
android:id="@+id/user_account_image"
|
||||||
android:layout_width="@dimen/account_image_default_width"
|
android:layout_width="@dimen/account_image_default_width"
|
||||||
android:layout_height="@dimen/account_image_default_height"
|
android:layout_height="@dimen/account_image_default_height"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
android:padding="4dp">
|
android:padding="4dp">
|
||||||
|
|
||||||
<!-- User image -->
|
<!-- User image -->
|
||||||
<ImageView
|
<org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
|
||||||
android:id="@+id/user_account_image"
|
android:id="@+id/user_account_image"
|
||||||
android:layout_width="@dimen/account_image_default_width"
|
android:layout_width="@dimen/account_image_default_width"
|
||||||
android:layout_height="@dimen/account_image_default_height"
|
android:layout_height="@dimen/account_image_default_height"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<org.communiquons.android.comunic.client.ui.views.WebUserAccountImage
|
||||||
android:id="@+id/user_account_image"
|
android:id="@+id/user_account_image"
|
||||||
android:layout_width="@dimen/account_image_default_width"
|
android:layout_width="@dimen/account_image_default_width"
|
||||||
android:layout_height="@dimen/account_image_default_height"
|
android:layout_height="@dimen/account_image_default_height"
|
||||||
|
Loading…
Reference in New Issue
Block a user