mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-12-29 06:58:58 +00:00
Display comments owner.
This commit is contained in:
parent
588ae5a680
commit
4f86d95240
@ -6,11 +6,14 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.communiquons.android.comunic.client.R;
|
||||
import org.communiquons.android.comunic.client.data.ImageLoad.ImageLoadManager;
|
||||
import org.communiquons.android.comunic.client.data.UsersInfo.UserInfo;
|
||||
import org.communiquons.android.comunic.client.data.comments.Comment;
|
||||
import org.communiquons.android.comunic.client.data.utils.UiUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -49,20 +52,35 @@ public class CommentsAdapter extends ArrayAdapter<Comment> {
|
||||
View v = LayoutInflater.from(context).inflate(R.layout.comment_item, viewGroup, false);
|
||||
|
||||
//Return filled view
|
||||
return fillView(v, comment, user);
|
||||
return fillView(context, v, comment, user);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill a view with a specified comments informations
|
||||
*
|
||||
* @param context The context of the acivitiy / application
|
||||
* @param view The view to update
|
||||
* @param comment The comment to update
|
||||
* @param user Information about the user (NULL for none)
|
||||
* @return Updated view
|
||||
*/
|
||||
private static View fillView(View view, Comment comment, @Nullable UserInfo user){
|
||||
private static View fillView(Context context, View view, Comment comment,
|
||||
@Nullable UserInfo user){
|
||||
|
||||
//Update user name and account image
|
||||
ImageView accountImage = view.findViewById(R.id.user_account_image);
|
||||
TextView accountName = view.findViewById(R.id.user_account_name);
|
||||
|
||||
if(user == null){
|
||||
accountImage.setImageDrawable(UiUtils.getDrawable(context,
|
||||
R.drawable.default_account_image));
|
||||
accountName.setText("");
|
||||
}
|
||||
else {
|
||||
ImageLoadManager.load(context, user.getAcountImageURL(), accountImage);
|
||||
accountName.setText(user.getDisplayFullName());
|
||||
}
|
||||
|
||||
//Update comment content
|
||||
((TextView)view.findViewById(R.id.comment_text)).setText(comment.getContent());
|
||||
|
@ -9,8 +9,8 @@
|
||||
<!-- User name and image-->
|
||||
<ImageView
|
||||
android:id="@+id/user_account_image"
|
||||
android:layout_width="@dimen/account_image_default_width"
|
||||
android:layout_height="@dimen/account_image_default_height"
|
||||
android:layout_width="@dimen/account_image_xsmall_width"
|
||||
android:layout_height="@dimen/account_image_xsmall_height"
|
||||
android:src="@drawable/default_account_image"
|
||||
android:contentDescription="@string/user_image_description" />
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
<!-- The default size of an account image -->
|
||||
<dimen name="account_image_default_width">64dp</dimen>
|
||||
<dimen name="account_image_default_height">64dp</dimen>
|
||||
<dimen name="account_image_xsmall_width">16dp</dimen>
|
||||
<dimen name="account_image_xsmall_height">16dp</dimen>
|
||||
|
||||
<!-- Dimensions for the conversation list -->
|
||||
<dimen name="fragment_conversations_list_icon_width">20dp</dimen>
|
||||
|
Loading…
Reference in New Issue
Block a user