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
68a6c838
Commit
68a6c838
authored
May 28, 2013
by
Alexander Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup suggestion callbacks while its button setup.
parent
923ff5e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
30 deletions
+65
-30
ContactList.java
src/com/xabber/android/ui/ContactList.java
+0
-29
ContactListAdapter.java
src/com/xabber/android/ui/adapter/ContactListAdapter.java
+65
-1
No files found.
src/com/xabber/android/ui/ContactList.java
View file @
68a6c838
...
...
@@ -56,7 +56,6 @@ import com.xabber.android.data.SettingsManager;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.data.account.StatusMode
;
import
com.xabber.android.data.connection.ConnectionManager
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.avatar.AvatarManager
;
import
com.xabber.android.data.extension.muc.MUCManager
;
...
...
@@ -185,7 +184,6 @@ public class ContactList extends ManagedListActivity implements
commonStatusMode
.
setOnClickListener
(
this
);
commonStatusText
.
setOnClickListener
(
this
);
titleView
.
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
button
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
back_button
).
setOnClickListener
(
this
);
if
(
savedInstanceState
!=
null
)
{
...
...
@@ -491,33 +489,6 @@ public class ContactList extends ManagedListActivity implements
case
R
.
id
.
common_status_mode
:
startActivity
(
StatusEditor
.
createIntent
(
this
));
break
;
case
R
.
id
.
button
:
// Hint button
switch
((
Integer
)
view
.
getTag
())
{
case
R
.
string
.
application_action_no_online
:
SettingsManager
.
setContactsShowOffline
(
true
);
contactListAdapter
.
onChange
();
break
;
case
R
.
string
.
application_action_no_contacts
:
startActivity
(
ContactAdd
.
createIntent
(
this
));
break
;
case
R
.
string
.
application_action_waiting
:
ConnectionManager
.
getInstance
().
updateConnections
(
true
);
break
;
case
R
.
string
.
application_action_offline
:
AccountManager
.
getInstance
().
setStatus
(
StatusMode
.
available
,
null
);
break
;
case
R
.
string
.
application_action_disabled
:
startActivity
(
AccountList
.
createIntent
(
this
));
break
;
case
R
.
string
.
application_action_empty
:
startActivity
(
AccountAdd
.
createIntent
(
this
));
break
;
default
:
break
;
}
updateStatusBar
();
break
;
case
R
.
id
.
back_button
:
// Xabber icon button
case
R
.
id
.
common_status_text
:
case
android
.
R
.
id
.
title
:
...
...
src/com/xabber/android/ui/adapter/ContactListAdapter.java
View file @
68a6c838
...
...
@@ -24,6 +24,7 @@ import java.util.TreeMap;
import
android.os.Handler
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
import
android.widget.Button
;
...
...
@@ -32,6 +33,8 @@ import android.widget.TextView;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.CommonState
;
import
com.xabber.android.data.account.StatusMode
;
import
com.xabber.android.data.connection.ConnectionManager
;
import
com.xabber.android.data.extension.muc.RoomChat
;
import
com.xabber.android.data.extension.muc.RoomContact
;
import
com.xabber.android.data.message.AbstractChat
;
...
...
@@ -41,6 +44,9 @@ import com.xabber.android.data.roster.AbstractContact;
import
com.xabber.android.data.roster.GroupManager
;
import
com.xabber.android.data.roster.RosterContact
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.ui.AccountAdd
;
import
com.xabber.android.ui.AccountList
;
import
com.xabber.android.ui.ContactAdd
;
import
com.xabber.android.ui.helper.ManagedListActivity
;
import
com.xabber.androiddev.R
;
...
...
@@ -429,6 +435,7 @@ public class ContactListAdapter extends
final
int
text
;
final
int
button
;
final
ContactListState
state
;
final
OnClickListener
listener
;
if
(
filterString
!=
null
)
{
if
(
commonState
==
CommonState
.
online
)
state
=
ContactListState
.
online
;
...
...
@@ -439,38 +446,95 @@ public class ContactListAdapter extends
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_no_online
;
button
=
0
;
listener
=
null
;
}
else
if
(
hasContact
)
{
state
=
ContactListState
.
online
;
text
=
R
.
string
.
application_state_no_online
;
button
=
R
.
string
.
application_action_no_online
;
listener
=
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
SettingsManager
.
setContactsShowOffline
(
true
);
onChange
();
}
};
}
else
if
(
commonState
==
CommonState
.
online
)
{
state
=
ContactListState
.
online
;
text
=
R
.
string
.
application_state_no_contacts
;
button
=
R
.
string
.
application_action_no_contacts
;
listener
=
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
activity
.
startActivity
(
ContactAdd
.
createIntent
(
activity
));
}
};
}
else
if
(
commonState
==
CommonState
.
roster
)
{
state
=
ContactListState
.
connecting
;
text
=
R
.
string
.
application_state_roster
;
button
=
0
;
listener
=
null
;
}
else
if
(
commonState
==
CommonState
.
connecting
)
{
state
=
ContactListState
.
connecting
;
text
=
R
.
string
.
application_state_connecting
;
button
=
0
;
listener
=
null
;
}
else
if
(
commonState
==
CommonState
.
waiting
)
{
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_waiting
;
button
=
R
.
string
.
application_action_waiting
;
listener
=
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
ConnectionManager
.
getInstance
().
updateConnections
(
true
);
}
};
}
else
if
(
commonState
==
CommonState
.
offline
)
{
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_offline
;
button
=
R
.
string
.
application_action_offline
;
listener
=
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
AccountManager
.
getInstance
().
setStatus
(
StatusMode
.
available
,
null
);
}
};
}
else
if
(
commonState
==
CommonState
.
disabled
)
{
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_disabled
;
button
=
R
.
string
.
application_action_disabled
;
listener
=
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
activity
.
startActivity
(
AccountList
.
createIntent
(
activity
));
}
};
}
else
if
(
commonState
==
CommonState
.
empty
)
{
state
=
ContactListState
.
offline
;
text
=
R
.
string
.
application_state_empty
;
button
=
R
.
string
.
application_action_empty
;
listener
=
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
activity
.
startActivity
(
AccountAdd
.
createIntent
(
activity
));
}
};
}
else
{
throw
new
IllegalStateException
();
}
...
...
@@ -494,8 +558,8 @@ public class ContactListAdapter extends
}
else
{
buttonView
.
setVisibility
(
View
.
VISIBLE
);
buttonView
.
setText
(
button
);
buttonView
.
setTag
(
Integer
.
valueOf
(
button
));
}
buttonView
.
setOnClickListener
(
listener
);
}
}
...
...
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