Commit 17bc4108 authored by Grigory Fedorov's avatar Grigory Fedorov

Account group bottom separator list item added.

parent d5f0a2b3
......@@ -308,6 +308,7 @@ public class ContactListAdapter extends GroupedContactAdapter<ChatContactInflate
}
baseEntities.add(rosterAccount);
if (showGroups) {
if (rosterAccount.isExpanded()) {
for (GroupConfiguration rosterConfiguration : rosterAccount
......@@ -323,6 +324,10 @@ public class ContactListAdapter extends GroupedContactAdapter<ChatContactInflate
rosterAccount.sortAbstractContacts(comparator);
baseEntities.addAll(rosterAccount.getAbstractContacts());
}
if (!rosterAccount.isExpanded()) {
baseEntities.add(new AccountBottomSeparator(rosterAccount.getAccount(), null));
}
}
} else {
if (showGroups) {
......@@ -418,4 +423,10 @@ public class ContactListAdapter extends GroupedContactAdapter<ChatContactInflate
super(account, user);
}
}
public static class AccountBottomSeparator extends BaseEntity {
public AccountBottomSeparator(String account, String user) {
super(account, user);
}
}
}
......@@ -55,7 +55,7 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
*/
static final Collection<Group> NO_GROUP_LIST;
static final int TYPE_COUNT = 4;
static final int TYPE_COUNT = 5;
/**
* View type used for contact items.
......@@ -68,6 +68,7 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
static final int TYPE_GROUP = 1;
static final int TYPE_ACCOUNT = 2;
static final int TYPE_ACCOUNT_TOP_SEPARATOR = 3;
static final int TYPE_ACCOUNT_BOTTOM_SEPARATOR = 4;
static {
Collection<Group> groups = new ArrayList<>(1);
......@@ -126,6 +127,8 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
return TYPE_GROUP;
} else if (object instanceof ContactListAdapter.AccountTopSeparator) {
return TYPE_ACCOUNT_TOP_SEPARATOR;
} else if (object instanceof ContactListAdapter.AccountBottomSeparator) {
return TYPE_ACCOUNT_BOTTOM_SEPARATOR;
} else {
throw new IllegalStateException();
}
......@@ -247,6 +250,23 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
return view;
}
case TYPE_ACCOUNT_BOTTOM_SEPARATOR: {
final View view;
if (convertView == null) {
view = layoutInflater.inflate(R.layout.account_group_item_bottom_separator, parent, false);
} else {
view = convertView;
}
final ContactListAdapter.AccountBottomSeparator accountBottomSeparator = (ContactListAdapter.AccountBottomSeparator) getItem(position);
final int level = AccountManager.getInstance().getColorLevel(accountBottomSeparator.getAccount());
view.findViewById(R.id.bottom_layer).setBackgroundDrawable(new ColorDrawable(accountSubgroupColors[level]));
view.findViewById(R.id.top_layer).setBackgroundDrawable(new ColorDrawable(accountSubgroupColors[level]));
return view;
}
default:
throw new IllegalStateException();
}
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="8dp"
android:clickable="true"
android:elevation="1dp"
android:background="@color/grey_300"
android:id="@+id/bottom_layer"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="4dp"
android:clickable="true"
android:elevation="2dp"
android:background="@color/grey_300"
android:id="@+id/top_layer"
>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/grey_400"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/grey_400"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
\ No newline at end of file
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