Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
17bc4108
Commit
17bc4108
authored
Apr 07, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account group bottom separator list item added.
parent
d5f0a2b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
1 deletion
+69
-1
ContactListAdapter.java
...ava/com/xabber/android/ui/adapter/ContactListAdapter.java
+11
-0
GroupedContactAdapter.java
.../com/xabber/android/ui/adapter/GroupedContactAdapter.java
+21
-1
account_group_item_bottom_separator.xml
...c/main/res/layout/account_group_item_bottom_separator.xml
+37
-0
No files found.
app/src/main/java/com/xabber/android/ui/adapter/ContactListAdapter.java
View file @
17bc4108
...
...
@@ -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
);
}
}
}
app/src/main/java/com/xabber/android/ui/adapter/GroupedContactAdapter.java
View file @
17bc4108
...
...
@@ -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
();
}
...
...
app/src/main/res/layout/account_group_item_bottom_separator.xml
0 → 100644
View file @
17bc4108
<?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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment