mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 22:09:30 +00:00
Improved list appearance.
This commit is contained in:
parent
0d619dc1bb
commit
b5a7df3f3d
@ -1,7 +1,7 @@
|
|||||||
package org.communiquons.android.comunic.client.ui.adapters;
|
package org.communiquons.android.comunic.client.ui.adapters;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -13,6 +13,7 @@ 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.models.ConversationsInfo;
|
import org.communiquons.android.comunic.client.data.models.ConversationsInfo;
|
||||||
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.utils.UiUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -68,20 +69,13 @@ public class ConversationsListAdapter extends ArrayAdapter<ConversationsInfo> {
|
|||||||
.findViewById(R.id.fragment_conversationslist_item_name);
|
.findViewById(R.id.fragment_conversationslist_item_name);
|
||||||
conversationName.setText(infos.getDisplayName());
|
conversationName.setText(infos.getDisplayName());
|
||||||
|
|
||||||
//Retrieve colors
|
//Set drawable associated with TextView (if required = unread conversation)
|
||||||
int blue, grey;
|
Drawable drawable = UiUtils.getDrawable(getContext(), R.drawable.ic_circle);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
drawable.setBounds(0, 0, 16, 16);
|
||||||
grey = getContext().getResources().getColor(R.color.darker_darker_gray,
|
conversationName.setCompoundDrawables(
|
||||||
getContext().getTheme());
|
infos.hasSaw_last_message() ? null :
|
||||||
blue = getContext().getResources().getColor(R.color.dark_blue, getContext().getTheme());
|
drawable,
|
||||||
} else {
|
null, null, null);
|
||||||
grey = getContext().getResources().getColor(R.color.darker_darker_gray);
|
|
||||||
blue = getContext().getResources().getColor(R.color.dark_blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Check whether the conversation has new messages or not and update conversation name color
|
|
||||||
conversationName.setTextColor(infos.hasSaw_last_message() ? grey : blue);
|
|
||||||
|
|
||||||
|
|
||||||
//Update the number of members of the conversation
|
//Update the number of members of the conversation
|
||||||
|
@ -22,7 +22,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="Conversation name" />
|
tools:text="Conversation name"
|
||||||
|
android:drawableStart="@drawable/ic_circle"
|
||||||
|
android:drawableTint="@color/colorPrimary"
|
||||||
|
android:drawablePadding="5dp"/>
|
||||||
|
|
||||||
<!-- Number of members -->
|
<!-- Number of members -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -33,6 +36,7 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="@dimen/fragment_conversations_list_icon_width"
|
android:layout_width="@dimen/fragment_conversations_list_icon_width"
|
||||||
android:layout_height="@dimen/fragment_conversations_list_icon_height"
|
android:layout_height="@dimen/fragment_conversations_list_icon_height"
|
||||||
|
android:layout_marginEnd="2dp"
|
||||||
android:src="@drawable/ic_friends" />
|
android:src="@drawable/ic_friends" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -53,7 +57,7 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="@dimen/fragment_conversations_list_icon_width"
|
android:layout_width="@dimen/fragment_conversations_list_icon_width"
|
||||||
android:layout_height="@dimen/fragment_conversations_list_icon_height"
|
android:layout_height="@dimen/fragment_conversations_list_icon_height"
|
||||||
android:src="@android:drawable/ic_menu_my_calendar"/>
|
android:src="@android:drawable/ic_menu_my_calendar" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/fragment_conversationslist_item_lastactive"
|
android:id="@+id/fragment_conversationslist_item_lastactive"
|
||||||
|
Loading…
Reference in New Issue
Block a user