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
aac1f6b4
Commit
aac1f6b4
authored
Mar 31, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default account avatars generation improved (not additional background used on layouts).
parent
36f4150b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
15 deletions
+12
-15
AvatarManager.java
...m/xabber/android/data/extension/avatar/AvatarManager.java
+10
-1
AccountChooseAdapter.java
...a/com/xabber/android/ui/adapter/AccountChooseAdapter.java
+2
-6
AccountListAdapter.java
...ava/com/xabber/android/ui/adapter/AccountListAdapter.java
+0
-1
avatar_account.xml
app/src/main/res/layout/avatar_account.xml
+0
-7
No files found.
app/src/main/java/com/xabber/android/data/extension/avatar/AvatarManager.java
View file @
aac1f6b4
...
...
@@ -28,6 +28,7 @@ import com.xabber.android.data.OnLoadListener;
import
com.xabber.android.data.OnLowMemoryListener
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountItem
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.OAuthManager
;
import
com.xabber.android.data.connection.ConnectionItem
;
import
com.xabber.android.data.connection.OnPacketListener
;
...
...
@@ -108,6 +109,8 @@ public class AvatarManager implements OnLoadListener, OnLowMemoryListener, OnPac
Application
.
getInstance
().
addManager
(
instance
);
}
private
final
int
[]
accountColors
;
public
static
AvatarManager
getInstance
()
{
return
instance
;
}
...
...
@@ -116,6 +119,9 @@ public class AvatarManager implements OnLoadListener, OnLowMemoryListener, OnPac
this
.
application
=
Application
.
getInstance
();
userAvatarSet
=
new
BaseAvatarSet
(
application
,
R
.
array
.
default_avatars_icons
,
R
.
array
.
default_avatars_colors
);
roomAvatarSet
=
new
BaseAvatarSet
(
application
,
R
.
array
.
muc_avatars
,
R
.
array
.
default_avatars_colors
);
accountColors
=
application
.
getResources
().
getIntArray
(
R
.
array
.
account_action_bar
);
hashes
=
new
HashMap
<>();
bitmaps
=
new
HashMap
<>();
contactListDrawables
=
new
HashMap
<>();
...
...
@@ -269,7 +275,10 @@ public class AvatarManager implements OnLoadListener, OnLowMemoryListener, OnPac
if
(
value
!=
null
)
{
return
new
BitmapDrawable
(
application
.
getResources
(),
value
);
}
else
{
return
application
.
getResources
().
getDrawable
(
R
.
drawable
.
ic_avatar_1
);
Drawable
[]
layers
=
new
Drawable
[
2
];
layers
[
0
]
=
new
ColorDrawable
(
accountColors
[
AccountManager
.
getInstance
().
getColorLevel
(
account
)]);
layers
[
1
]
=
application
.
getResources
().
getDrawable
(
R
.
drawable
.
ic_avatar_1
);
return
new
LayerDrawable
(
layers
);
}
}
...
...
app/src/main/java/com/xabber/android/ui/adapter/AccountChooseAdapter.java
View file @
aac1f6b4
...
...
@@ -43,8 +43,7 @@ public class AccountChooseAdapter extends BaseAdapter {
public
AccountChooseAdapter
(
Activity
activity
)
{
super
();
this
.
activity
=
activity
;
accounts
=
new
ArrayList
<
String
>(
AccountManager
.
getInstance
()
.
getAccounts
());
accounts
=
new
ArrayList
<>(
AccountManager
.
getInstance
().
getAccounts
());
Collections
.
sort
(
accounts
);
accountColors
=
activity
.
getResources
().
getIntArray
(
R
.
array
.
account_action_bar
);
...
...
@@ -99,13 +98,10 @@ public class AccountChooseAdapter extends BaseAdapter {
}
final
String
account
=
(
String
)
getItem
(
position
);
int
accountColor
=
accountColors
[
accountManager
.
getColorLevel
(
account
)];
((
ImageView
)
view
.
findViewById
(
R
.
id
.
avatar_background
)).
setImageDrawable
(
new
ColorDrawable
(
accountColor
));
((
ImageView
)
view
.
findViewById
(
R
.
id
.
avatar
))
.
setImageDrawable
(
AvatarManager
.
getInstance
().
getAccountAvatar
(
account
));
((
TextView
)
view
.
findViewById
(
R
.
id
.
name
)).
setText
(
accountManager
.
getVerboseName
(
account
));
((
TextView
)
view
.
findViewById
(
R
.
id
.
name
)).
setText
(
accountManager
.
getVerboseName
(
account
));
return
view
;
}
...
...
app/src/main/java/com/xabber/android/ui/adapter/AccountListAdapter.java
View file @
aac1f6b4
...
...
@@ -61,7 +61,6 @@ public class AccountListAdapter extends BaseListEditorAdapter<String> {
int
accountColor
=
accountColors
[
accountManager
.
getColorLevel
(
account
)];
((
ImageView
)
view
.
findViewById
(
R
.
id
.
color
)).
setImageDrawable
(
new
ColorDrawable
(
accountColor
));
((
ImageView
)
view
.
findViewById
(
R
.
id
.
avatar_background
)).
setImageDrawable
(
new
ColorDrawable
(
accountColor
));
((
ImageView
)
view
.
findViewById
(
R
.
id
.
avatar
))
.
setImageDrawable
(
AvatarManager
.
getInstance
().
getAccountAvatar
(
account
));
...
...
app/src/main/res/layout/avatar_account.xml
View file @
aac1f6b4
...
...
@@ -6,13 +6,6 @@
android:layout_height=
"@dimen/avatar_size_toolbar"
android:id=
"@+id/avatar_account"
>
<ImageView
android:id=
"@+id/avatar_background"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:src=
"@color/material_deep_teal_500"
/>
<ImageView
android:id=
"@+id/avatar"
android:layout_width=
"match_parent"
...
...
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