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
b56e3352
Commit
b56e3352
authored
Apr 08, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Click on Avatar in contact list leads to contact info screen.
parent
3c495c64
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
22 deletions
+41
-22
ContactListFragment.java
.../main/java/com/xabber/android/ui/ContactListFragment.java
+9
-10
ContactListAdapter.java
...ava/com/xabber/android/ui/adapter/ContactListAdapter.java
+2
-3
GroupedContactAdapter.java
.../com/xabber/android/ui/adapter/GroupedContactAdapter.java
+30
-9
No files found.
app/src/main/java/com/xabber/android/ui/ContactListFragment.java
View file @
b56e3352
...
...
@@ -8,7 +8,6 @@ import android.view.ContextMenu.ContextMenuInfo;
import
android.view.LayoutInflater
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.view.ViewGroup
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
...
...
@@ -49,7 +48,7 @@ import java.util.Collection;
public
class
ContactListFragment
extends
Fragment
implements
OnAccountChangedListener
,
OnContactChangedListener
,
OnChatChangedListener
,
OnItemClickListener
,
OnContactListChangedListener
,
OnClickListener
,
GroupedContactAdapter
.
OnAccount
ClickListener
{
OnContactListChangedListener
,
View
.
OnClickListener
,
GroupedContactAdapter
.
On
ClickListener
{
private
ContactListAdapter
adapter
;
...
...
@@ -187,7 +186,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
final
int
text
;
final
int
button
;
final
ContactListState
state
;
final
OnClickListener
listener
;
final
View
.
OnClickListener
listener
;
if
(
isFilterEnabled
)
{
if
(
commonState
==
CommonState
.
online
)
{
state
=
ContactListState
.
online
;
...
...
@@ -203,7 +202,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
state
=
ContactListState
.
online
;
text
=
R
.
string
.
application_state_no_online
;
button
=
R
.
string
.
application_action_no_online
;
listener
=
new
OnClickListener
()
{
listener
=
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
SettingsManager
.
setContactsShowOffline
(
true
);
...
...
@@ -214,7 +213,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
state
=
ContactListState
.
online
;
text
=
R
.
string
.
application_state_no_contacts
;
button
=
R
.
string
.
application_action_no_contacts
;
listener
=
new
OnClickListener
()
{
listener
=
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
startActivity
(
ContactAdd
.
createIntent
(
getActivity
()));
...
...
@@ -234,7 +233,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_waiting
;
button
=
R
.
string
.
application_action_waiting
;
listener
=
new
OnClickListener
()
{
listener
=
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
ConnectionManager
.
getInstance
().
updateConnections
(
true
);
...
...
@@ -244,7 +243,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_offline
;
button
=
R
.
string
.
application_action_offline
;
listener
=
new
OnClickListener
()
{
listener
=
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
AccountManager
.
getInstance
().
setStatus
(
...
...
@@ -255,7 +254,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_disabled
;
button
=
R
.
string
.
application_action_disabled
;
listener
=
new
OnClickListener
()
{
listener
=
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
startActivity
(
AccountList
.
createIntent
(
getActivity
()));
...
...
@@ -265,7 +264,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_empty
;
button
=
R
.
string
.
application_action_empty
;
listener
=
new
OnClickListener
()
{
listener
=
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
startActivity
(
AccountAdd
.
createIntent
(
getActivity
()));
...
...
@@ -403,7 +402,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
}
@Override
public
void
onAccountClick
(
View
view
,
final
String
account
)
{
public
void
onAccount
Menu
Click
(
View
view
,
final
String
account
)
{
PopupMenu
popup
=
new
PopupMenu
(
getActivity
(),
view
);
popup
.
inflate
(
R
.
menu
.
account
);
ContextMenuHelper
.
setUpAccountMenu
(
getActivity
(),
adapter
,
account
,
popup
.
getMenu
());
...
...
app/src/main/java/com/xabber/android/ui/adapter/ContactListAdapter.java
View file @
b56e3352
...
...
@@ -18,7 +18,6 @@ import android.app.Activity;
import
android.os.Handler
;
import
android.widget.Filter
;
import
android.widget.Filterable
;
import
android.widget.ListView
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountManager
;
...
...
@@ -94,8 +93,8 @@ public class ContactListAdapter extends GroupedContactAdapter implements Runnabl
private
final
OnContactListChangedListener
listener
;
public
ContactListAdapter
(
Activity
activity
,
OnContactListChangedListener
listener
,
GroupedContactAdapter
.
OnAccountClickListener
onAccount
ClickListener
)
{
super
(
activity
,
on
Account
ClickListener
);
OnClickListener
on
ClickListener
)
{
super
(
activity
,
onClickListener
);
this
.
listener
=
listener
;
handler
=
new
Handler
();
refreshLock
=
new
Object
();
...
...
app/src/main/java/com/xabber/android/ui/adapter/GroupedContactAdapter.java
View file @
b56e3352
...
...
@@ -22,11 +22,10 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.Filter
;
import
android.widget.Filterable
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountItem
;
import
com.xabber.android.data.account.AccountManager
;
...
...
@@ -39,6 +38,7 @@ import com.xabber.android.data.roster.AbstractContact;
import
com.xabber.android.data.roster.Group
;
import
com.xabber.android.data.roster.GroupManager
;
import
com.xabber.android.data.roster.ShowOfflineMode
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.androiddev.R
;
import
java.util.ArrayList
;
...
...
@@ -96,12 +96,12 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
private
int
[]
accountGroupColors
;
private
final
int
[]
accountSubgroupColors
;
private
final
int
activeChatsColor
;
private
final
On
AccountClickListener
onAccount
ClickListener
;
private
final
On
ClickListener
on
ClickListener
;
final
ArrayList
<
BaseEntity
>
baseEntities
=
new
ArrayList
<>();
protected
Locale
locale
=
Locale
.
getDefault
();
public
GroupedContactAdapter
(
Activity
activity
,
On
AccountClickListener
onAccount
ClickListener
)
{
public
GroupedContactAdapter
(
Activity
activity
,
On
ClickListener
on
ClickListener
)
{
this
.
activity
=
activity
;
layoutInflater
=
(
LayoutInflater
)
activity
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
...
...
@@ -113,7 +113,7 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
accountSubgroupColors
=
resources
.
getIntArray
(
R
.
array
.
account_50
);
activeChatsColor
=
resources
.
getColor
(
R
.
color
.
color_primary_light
);
this
.
on
AccountClickListener
=
onAccount
ClickListener
;
this
.
on
ClickListener
=
on
ClickListener
;
}
@Override
...
...
@@ -240,7 +240,7 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
viewHolder
.
statusIcon
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
on
AccountClickListener
.
onAccount
Click
(
v
,
account
);
on
ClickListener
.
onAccountMenu
Click
(
v
,
account
);
}
});
...
...
@@ -260,6 +260,19 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
viewHolder
.
status
.
setText
(
statusText
);
viewHolder
.
avatar
.
setImageDrawable
(
AvatarManager
.
getInstance
().
getAccountAvatar
(
account
));
viewHolder
.
avatar
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
String
user
=
AccountManager
.
getInstance
().
getAccount
(
account
).
getRealJid
();
if
(
user
==
null
)
{
Application
.
getInstance
().
onError
(
R
.
string
.
NOT_CONNECTED
);
}
else
{
activity
.
startActivity
(
ContactViewer
.
createIntent
(
activity
,
account
,
user
));
}
}
});
viewHolder
.
statusIcon
.
setImageLevel
(
accountItem
.
getDisplayStatusMode
().
getStatusLevel
());
ShowOfflineMode
showOfflineMode
=
configuration
.
getShowOfflineMode
();
...
...
@@ -346,7 +359,7 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
viewHolder
=
(
ContactViewHolder
)
view
.
getTag
();
}
AbstractContact
abstractContact
=
(
AbstractContact
)
getItem
(
position
);
final
AbstractContact
abstractContact
=
(
AbstractContact
)
getItem
(
position
);
if
(
abstractContact
.
isConnected
())
{
viewHolder
.
offlineShadow
.
setVisibility
(
View
.
GONE
);
...
...
@@ -364,6 +377,14 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
viewHolder
.
avatar
.
setVisibility
(
View
.
GONE
);
}
viewHolder
.
avatar
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
activity
.
startActivity
(
ContactViewer
.
createIntent
(
activity
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
}
});
viewHolder
.
name
.
setText
(
abstractContact
.
getName
());
String
statusText
;
...
...
@@ -652,8 +673,8 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
}
}
public
interface
On
Account
ClickListener
{
void
onAccountClick
(
View
view
,
String
account
);
public
interface
OnClickListener
{
void
onAccount
Menu
Click
(
View
view
,
String
account
);
}
}
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