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
f7329d29
Commit
f7329d29
authored
Feb 18, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account list colors fixed.
parent
814d9321
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
AccountListAdapter.java
...ava/com/xabber/android/ui/adapter/AccountListAdapter.java
+19
-18
account_list_item.xml
app/src/main/res/layout/account_list_item.xml
+0
-1
No files found.
app/src/main/java/com/xabber/android/ui/adapter/AccountListAdapter.java
View file @
f7329d29
...
...
@@ -14,12 +14,8 @@
*/
package
com
.
xabber
.
android
.
ui
.
adapter
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
android.app.Activity
;
import
android.graphics.drawable.ColorDrawable
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
...
...
@@ -32,15 +28,23 @@ import com.xabber.android.data.extension.avatar.AvatarManager;
import
com.xabber.android.ui.preferences.AccountList
;
import
com.xabber.androiddev.R
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
/**
* Adapter for the list of accounts for {@link AccountList}.
*
* @author alexander.ivanov
*/
public
class
AccountListAdapter
extends
BaseListEditorAdapter
<
String
>
{
private
final
int
[]
accountColors
;
public
AccountListAdapter
(
Activity
activity
)
{
super
(
activity
);
accountColors
=
activity
.
getResources
().
getIntArray
(
R
.
array
.
account_action_bar
);
}
@Override
...
...
@@ -48,34 +52,31 @@ public class AccountListAdapter extends BaseListEditorAdapter<String> {
View
view
;
AccountManager
accountManager
=
AccountManager
.
getInstance
();
if
(
convertView
==
null
)
{
view
=
getActivity
().
getLayoutInflater
().
inflate
(
R
.
layout
.
account_list_item
,
parent
,
false
);
view
=
getActivity
().
getLayoutInflater
().
inflate
(
R
.
layout
.
account_list_item
,
parent
,
false
);
}
else
{
view
=
convertView
;
}
String
account
=
getItem
(
position
);
((
ImageView
)
view
.
findViewById
(
R
.
id
.
color
))
.
setImageLevel
(
accountManager
.
getColorLevel
(
account
));
((
ImageView
)
view
.
findViewById
(
R
.
id
.
color
))
.
setImageDrawable
(
new
ColorDrawable
(
accountColors
[
accountManager
.
getColorLevel
(
account
)]
));
((
ImageView
)
view
.
findViewById
(
R
.
id
.
avatar
))
.
setImageDrawable
(
AvatarManager
.
getInstance
().
getAccountAvatar
(
account
));
((
TextView
)
view
.
findViewById
(
R
.
id
.
name
)).
setText
(
accountManager
.
getVerboseName
(
account
));
.
setImageDrawable
(
AvatarManager
.
getInstance
().
getAccountAvatar
(
account
));
((
TextView
)
view
.
findViewById
(
R
.
id
.
name
)).
setText
(
accountManager
.
getVerboseName
(
account
));
AccountItem
accountItem
=
accountManager
.
getAccount
(
account
);
ConnectionState
state
;
if
(
accountItem
==
null
)
if
(
accountItem
==
null
)
{
state
=
ConnectionState
.
offline
;
else
}
else
{
state
=
accountItem
.
getState
();
((
TextView
)
view
.
findViewById
(
R
.
id
.
status
)).
setText
(
getActivity
()
.
getString
(
state
.
getStringId
()));
}
((
TextView
)
view
.
findViewById
(
R
.
id
.
status
)).
setText
(
getActivity
()
.
getString
(
state
.
getStringId
()));
return
view
;
}
@Override
protected
Collection
<
String
>
getTags
()
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
List
<
String
>
list
=
new
ArrayList
<>();
list
.
addAll
(
AccountManager
.
getInstance
().
getAllAccounts
());
Collections
.
sort
(
list
);
return
list
;
...
...
app/src/main/res/layout/account_list_item.xml
View file @
f7329d29
...
...
@@ -25,7 +25,6 @@
android:layout_height=
"@dimen/avatar_size"
android:layout_marginRight=
"3dp"
android:layout_marginEnd=
"3dp"
/>
<ImageView
android:id=
"@+id/avatar"
...
...
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