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
23446ca3
Commit
23446ca3
authored
Mar 30, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Contact list: groups have light accounts color.
parent
af11e288
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
27 deletions
+53
-27
GroupedContactAdapter.java
.../com/xabber/android/ui/adapter/GroupedContactAdapter.java
+36
-27
color_arrays.xml
app/src/main/res/values/color_arrays.xml
+14
-0
dimens.xml
app/src/main/res/values/dimens.xml
+3
-0
No files found.
app/src/main/java/com/xabber/android/ui/adapter/GroupedContactAdapter.java
View file @
23446ca3
...
@@ -16,9 +16,10 @@ package com.xabber.android.ui.adapter;
...
@@ -16,9 +16,10 @@ package com.xabber.android.ui.adapter;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.
ColorStateList
;
import
android.content.res.
Resources
;
import
android.content.res.TypedArray
;
import
android.content.res.TypedArray
;
import
android.graphics.drawable.ColorDrawable
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Build
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
...
@@ -73,16 +74,6 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
...
@@ -73,16 +74,6 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
NO_GROUP_LIST
=
Collections
.
unmodifiableCollection
(
groups
);
NO_GROUP_LIST
=
Collections
.
unmodifiableCollection
(
groups
);
}
}
/**
* Account's color.
*/
private
final
ColorStateList
expanderAccountTextColor
;
/**
* Group's color.
*/
private
final
ColorStateList
expanderGroupTextColor
;
/**
/**
* Group state provider.
* Group state provider.
*/
*/
...
@@ -93,7 +84,11 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
...
@@ -93,7 +84,11 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
*/
*/
private
final
LayoutInflater
layoutInflater
;
private
final
LayoutInflater
layoutInflater
;
private
int
[]
accountActionBarColors
;
private
int
[]
accountColors
;
private
final
int
[]
accountSubgroupColors
;
private
final
int
accountGroupElevation
;
private
final
int
accountSubgroupElevation
;
private
final
int
activeChatsColor
;
public
GroupedContactAdapter
(
Activity
activity
,
ListView
listView
,
public
GroupedContactAdapter
(
Activity
activity
,
ListView
listView
,
Inflater
inflater
,
StateProvider
groupStateProvider
)
{
Inflater
inflater
,
StateProvider
groupStateProvider
)
{
...
@@ -101,13 +96,14 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
...
@@ -101,13 +96,14 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
layoutInflater
=
(
LayoutInflater
)
activity
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
layoutInflater
=
(
LayoutInflater
)
activity
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
this
.
groupStateProvider
=
groupStateProvider
;
this
.
groupStateProvider
=
groupStateProvider
;
accountActionBarColors
=
activity
.
getResources
().
getIntArray
(
R
.
array
.
account_action_bar
);
Resources
resources
=
activity
.
getResources
();
accountColors
=
resources
.
getIntArray
(
R
.
array
.
account_action_bar
);
accountSubgroupColors
=
resources
.
getIntArray
(
R
.
array
.
account_background
);
activeChatsColor
=
resources
.
getColor
(
R
.
color
.
color_primary_light
);
TypedArray
typedArray
;
accountGroupElevation
=
resources
.
getDimensionPixelSize
(
R
.
dimen
.
account_group_elevation
);
typedArray
=
activity
.
getTheme
().
obtainStyledAttributes
(
R
.
styleable
.
ContactList
);
accountSubgroupElevation
=
resources
.
getDimensionPixelSize
(
R
.
dimen
.
account_subgroup_elevation
);
expanderAccountTextColor
=
typedArray
.
getColorStateList
(
R
.
styleable
.
ContactList_expanderAccountColor
);
expanderGroupTextColor
=
typedArray
.
getColorStateList
(
R
.
styleable
.
ContactList_expanderGroupColor
);
typedArray
.
recycle
();
}
}
@Override
@Override
...
@@ -150,19 +146,32 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
...
@@ -150,19 +146,32 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
viewHolder
=
(
GroupViewHolder
)
view
.
getTag
();
viewHolder
=
(
GroupViewHolder
)
view
.
getTag
();
}
}
final
GroupConfiguration
configuration
=
(
GroupConfiguration
)
getItem
(
position
);
final
GroupConfiguration
configuration
=
(
GroupConfiguration
)
getItem
(
position
);
final
int
level
;
final
int
level
=
AccountManager
.
getInstance
().
getColorLevel
(
configuration
.
getAccount
());
if
(
configuration
instanceof
AccountConfiguration
)
{
level
=
AccountManager
.
getInstance
().
getColorLevel
(
configuration
.
getAccount
());
final
String
name
=
GroupManager
.
getInstance
()
view
.
setBackgroundDrawable
(
new
ColorDrawable
(
accountActionBarColors
[
level
]));
.
getGroupName
(
configuration
.
getAccount
(),
configuration
.
getUser
());
int
elevation
;
int
color
;
if
(
configuration
.
getUser
().
equals
(
GroupManager
.
ACTIVE_CHATS
))
{
color
=
activeChatsColor
;
elevation
=
accountGroupElevation
;
}
else
if
(
configuration
instanceof
AccountConfiguration
)
{
color
=
accountColors
[
level
];
elevation
=
accountGroupElevation
;
}
else
{
}
else
{
view
.
setBackgroundDrawable
(
color
=
accountSubgroupColors
[
level
];
new
ColorDrawable
(
activity
.
getResources
().
getColor
(
R
.
color
.
group_expander
)));
elevation
=
accountSubgroupElevation
;
viewHolder
.
name
.
setTextColor
(
expanderGroupTextColor
);
}
view
.
setBackgroundDrawable
(
new
ColorDrawable
(
color
));
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
view
.
setElevation
(
elevation
);
}
}
viewHolder
.
name
.
getBackground
().
setLevel
(
configuration
.
getShowOfflineMode
().
ordinal
());
viewHolder
.
name
.
getBackground
().
setLevel
(
configuration
.
getShowOfflineMode
().
ordinal
());
final
String
name
=
GroupManager
.
getInstance
().
getGroupName
(
configuration
.
getAccount
(),
configuration
.
getUser
());
viewHolder
.
name
.
setText
(
name
+
" ("
+
configuration
.
getOnline
()
viewHolder
.
name
.
setText
(
name
+
" ("
+
configuration
.
getOnline
()
+
"/"
+
configuration
.
getTotal
()
+
")"
);
+
"/"
+
configuration
.
getTotal
()
+
")"
);
viewHolder
.
indicator
.
setImageLevel
(
configuration
.
isExpanded
()
?
1
:
0
);
viewHolder
.
indicator
.
setImageLevel
(
configuration
.
isExpanded
()
?
1
:
0
);
...
...
app/src/main/res/values/color_arrays.xml
View file @
23446ca3
...
@@ -34,6 +34,20 @@
...
@@ -34,6 +34,20 @@
<item>
@color/teal_700
</item>
<item>
@color/teal_700
</item>
</array>
</array>
<array
name=
"account_background"
>
<item>
@color/green_100
</item>
<item>
@color/orange_100
</item>
<item>
@color/red_100
</item>
<item>
@color/blue_100
</item>
<item>
@color/indigo_100
</item>
<item>
@color/blue_grey_100
</item>
<item>
@color/cyan_100
</item>
<item>
@color/teal_100
</item>
</array>
<color
name=
"color_primary_light"
>
@color/red_100
</color>
<color
name=
"account_disabled"
>
@color/black_dividers
</color>
<color
name=
"account_disabled"
>
@color/black_dividers
</color>
<color
name=
"group_expander"
>
@color/blue_grey_100
</color>
<color
name=
"group_expander"
>
@color/blue_grey_100
</color>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
23446ca3
...
@@ -9,4 +9,7 @@
...
@@ -9,4 +9,7 @@
<dimen
name=
"avatar_large_size"
>
72dp
</dimen>
<dimen
name=
"avatar_large_size"
>
72dp
</dimen>
<dimen
name=
"avatar_normal_size"
>
48dp
</dimen>
<dimen
name=
"avatar_normal_size"
>
48dp
</dimen>
<dimen
name=
"avatar_radius"
>
56dp
</dimen>
<dimen
name=
"avatar_radius"
>
56dp
</dimen>
<dimen
name=
"account_group_elevation"
>
2dp
</dimen>
<dimen
name=
"account_subgroup_elevation"
>
1dp
</dimen>
</resources>
</resources>
\ 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