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
a7e4a25f
Commit
a7e4a25f
authored
Jun 22, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ContactList options menu get hidden when there are no active accounts.
parent
0f98f208
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
6 deletions
+52
-6
ContactList.java
app/src/main/java/com/xabber/android/ui/ContactList.java
+30
-3
ContactListFragment.java
.../main/java/com/xabber/android/ui/ContactListFragment.java
+22
-3
No files found.
app/src/main/java/com/xabber/android/ui/ContactList.java
View file @
a7e4a25f
...
...
@@ -46,6 +46,7 @@ import com.xabber.android.data.Application;
import
com.xabber.android.data.NetworkException
;
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.OnAccountChangedListener
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.avatar.AvatarManager
;
...
...
@@ -57,7 +58,7 @@ import com.xabber.android.data.notification.NotificationManager;
import
com.xabber.android.data.roster.AbstractContact
;
import
com.xabber.android.data.roster.RosterContact
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.ui.ContactListFragment.
OnContactClick
Listener
;
import
com.xabber.android.ui.ContactListFragment.
ContactListFragment
Listener
;
import
com.xabber.android.ui.dialog.AccountChooseDialogFragment
;
import
com.xabber.android.ui.dialog.AccountChooseDialogFragment.OnChoosedListener
;
import
com.xabber.android.ui.dialog.ContactIntegrationDialogFragment
;
...
...
@@ -81,7 +82,7 @@ import java.util.Locale;
* @author alexander.ivanov
*/
public
class
ContactList
extends
ManagedActivity
implements
OnAccountChangedListener
,
View
.
OnClickListener
,
OnChoosedListener
,
OnContactClick
Listener
,
ContactListDrawerFragment
.
ContactListDrawerListener
,
Toolbar
.
OnMenuItemClickListener
{
View
.
OnClickListener
,
OnChoosedListener
,
ContactListFragment
Listener
,
ContactListDrawerFragment
.
ContactListDrawerListener
,
Toolbar
.
OnMenuItemClickListener
{
/**
* Select contact to be invited to the room was requested.
...
...
@@ -111,6 +112,7 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
private
BarPainter
barPainter
;
private
ActionBarDrawerToggle
drawerToggle
;
private
DrawerLayout
drawerLayout
;
private
Menu
optionsMenu
;
public
static
Intent
createPersistentIntent
(
Context
context
)
{
Intent
intent
=
new
Intent
(
context
,
ContactList
.
class
);
...
...
@@ -162,7 +164,8 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
drawerLayout
.
setDrawerListener
(
drawerToggle
);
toolbar
.
inflateMenu
(
R
.
menu
.
contact_list
);
setUpSearchView
(
toolbar
.
getMenu
());
optionsMenu
=
toolbar
.
getMenu
();
setUpSearchView
(
optionsMenu
);
toolbar
.
setOnMenuItemClickListener
(
this
);
barPainter
=
new
BarPainter
(
this
,
toolbar
);
...
...
@@ -558,6 +561,30 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
}
}
@Override
public
void
onContactListChange
(
CommonState
commonState
)
{
switch
(
commonState
)
{
case
empty:
case
disabled:
for
(
int
i
=
0
;
i
<
optionsMenu
.
size
();
i
++)
{
optionsMenu
.
getItem
(
i
).
setVisible
(
false
);
}
break
;
case
offline:
case
waiting:
case
connecting:
case
roster:
case
online:
for
(
int
i
=
0
;
i
<
optionsMenu
.
size
();
i
++)
{
optionsMenu
.
getItem
(
i
).
setVisible
(
true
);
}
break
;
}
}
private
void
createShortcut
(
AbstractContact
abstractContact
)
{
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
Intent
.
EXTRA_SHORTCUT_INTENT
,
ChatViewer
.
createShortCutIntent
(
this
,
...
...
app/src/main/java/com/xabber/android/ui/ContactListFragment.java
View file @
a7e4a25f
package
com
.
xabber
.
android
.
ui
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.os.SystemClock
;
import
android.support.v4.app.Fragment
;
...
...
@@ -91,6 +92,15 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
private
FloatingActionButton
scrollToChatsActionButton
;
private
AccountPainter
accountPainter
;
private
ContactListFragmentListener
contactListFragmentListener
;
@Override
public
void
onAttach
(
Activity
activity
)
{
super
.
onAttach
(
activity
);
contactListFragmentListener
=
(
ContactListFragmentListener
)
activity
;
}
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
contact_list_fragment
,
container
,
false
);
...
...
@@ -149,6 +159,12 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
unregisterListeners
();
}
@Override
public
void
onDetach
()
{
super
.
onDetach
();
contactListFragmentListener
=
null
;
}
@Override
public
void
onCreateContextMenu
(
ContextMenu
menu
,
View
view
,
ContextMenuInfo
menuInfo
)
{
AdapterContextMenuInfo
info
=
(
AdapterContextMenuInfo
)
menuInfo
;
...
...
@@ -171,7 +187,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
Object
object
=
parent
.
getAdapter
().
getItem
(
position
);
if
(
object
instanceof
AbstractContact
)
{
((
OnContactClickListener
)
getActivity
())
.
onContactClick
((
AbstractContact
)
object
);
contactListFragmentListener
.
onContactClick
((
AbstractContact
)
object
);
}
else
if
(
object
instanceof
GroupConfiguration
)
{
GroupConfiguration
groupConfiguration
=
(
GroupConfiguration
)
object
;
adapter
.
setExpanded
(
groupConfiguration
.
getAccount
(),
groupConfiguration
.
getUser
(),
...
...
@@ -328,7 +344,7 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
}
buttonView
.
setOnClickListener
(
listener
);
contactListFragmentListener
.
onContactListChange
(
commonState
);
}
...
...
@@ -443,8 +459,11 @@ public class ContactListFragment extends Fragment implements OnAccountChangedLis
popup
.
show
();
}
public
interface
OnContactClick
Listener
{
public
interface
ContactListFragment
Listener
{
void
onContactClick
(
AbstractContact
contact
);
void
onContactListChange
(
CommonState
commonState
);
}
}
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