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
f4f38bde
Commit
f4f38bde
authored
Aug 07, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OccupantList: refactored and modified (colored toolbar), called from conference avatar click.
parent
2c7d2e16
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
23 deletions
+34
-23
ChatViewerFragment.java
...c/main/java/com/xabber/android/ui/ChatViewerFragment.java
+1
-1
OccupantList.java
app/src/main/java/com/xabber/android/ui/OccupantList.java
+28
-18
ContactItemInflater.java
...va/com/xabber/android/ui/adapter/ContactItemInflater.java
+5
-4
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewerFragment.java
View file @
f4f38bde
...
...
@@ -565,7 +565,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
private
void
showContactInfo
()
{
if
(
MUCManager
.
getInstance
().
hasRoom
(
account
,
user
))
{
startActivity
(
ContactViewer
.
createIntent
(
getActivity
(),
account
,
user
));
startActivity
(
OccupantList
.
createIntent
(
getActivity
(),
account
,
user
));
}
else
{
startActivity
(
ContactEditor
.
createIntent
(
getActivity
(),
account
,
user
));
}
...
...
app/src/main/java/com/xabber/android/ui/OccupantList.java
View file @
f4f38bde
...
...
@@ -17,7 +17,9 @@ package com.xabber.android.ui;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v4.app.NavUtils
;
import
android.support.v7.widget.Toolbar
;
import
android.view.View
;
import
com.xabber.android.R
;
import
com.xabber.android.data.Application
;
...
...
@@ -28,6 +30,7 @@ import com.xabber.android.data.intent.AccountIntentBuilder;
import
com.xabber.android.data.intent.EntityIntentBuilder
;
import
com.xabber.android.data.roster.OnContactChangedListener
;
import
com.xabber.android.ui.adapter.OccupantListAdapter
;
import
com.xabber.android.ui.helper.BarPainter
;
import
com.xabber.android.ui.helper.ManagedListActivity
;
import
com.xabber.xmpp.address.Jid
;
...
...
@@ -45,8 +48,7 @@ public class OccupantList extends ManagedListActivity implements
private
String
room
;
private
OccupantListAdapter
listAdapter
;
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
)
{
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
)
{
return
new
EntityIntentBuilder
(
context
,
OccupantList
.
class
)
.
setAccount
(
account
).
setUser
(
user
).
build
();
}
...
...
@@ -62,55 +64,63 @@ public class OccupantList extends ManagedListActivity implements
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
if
(
isFinishing
())
if
(
isFinishing
())
{
return
;
}
account
=
getAccount
(
getIntent
());
room
=
Jid
.
getBareAddress
(
getUser
(
getIntent
()));
if
(
account
==
null
||
room
==
null
||
!
MUCManager
.
getInstance
().
hasRoom
(
account
,
room
))
{
if
(
account
==
null
||
room
==
null
||
!
MUCManager
.
getInstance
().
hasRoom
(
account
,
room
))
{
Application
.
getInstance
().
onError
(
R
.
string
.
ENTRY_IS_NOT_FOUND
);
finish
();
return
;
}
setContentView
(
R
.
layout
.
list
);
setSupportActionBar
((
Toolbar
)
findViewById
(
R
.
id
.
toolbar_default
));
final
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar_default
);
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_arrow_left_white_24dp
);
toolbar
.
setNavigationOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
NavUtils
.
navigateUpFromSameTask
(
OccupantList
.
this
);
}
});
toolbar
.
setTitle
(
room
);
BarPainter
barPainter
=
new
BarPainter
(
this
,
toolbar
);
barPainter
.
updateWithAccountName
(
account
);
listAdapter
=
new
OccupantListAdapter
(
this
,
account
,
room
);
setListAdapter
(
listAdapter
);
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
listAdapter
.
onChange
();
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
Application
.
getInstance
().
removeUIListener
(
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
removeUIListener
(
OnContactChangedListener
.
class
,
this
);
Application
.
getInstance
().
removeUIListener
(
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
removeUIListener
(
OnContactChangedListener
.
class
,
this
);
}
@Override
public
void
onContactsChanged
(
Collection
<
BaseEntity
>
entities
)
{
if
(
entities
.
contains
(
new
BaseEntity
(
account
,
room
)))
if
(
entities
.
contains
(
new
BaseEntity
(
account
,
room
)))
{
listAdapter
.
onChange
();
}
}
@Override
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
if
(
accounts
.
contains
(
account
))
if
(
accounts
.
contains
(
account
))
{
listAdapter
.
onChange
();
}
}
}
app/src/main/java/com/xabber/android/ui/adapter/ContactItemInflater.java
View file @
f4f38bde
...
...
@@ -16,6 +16,7 @@ import com.xabber.android.data.message.MessageManager;
import
com.xabber.android.data.roster.AbstractContact
;
import
com.xabber.android.ui.ContactEditor
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.android.ui.OccupantList
;
import
com.xabber.android.utils.StringUtils
;
public
class
ContactItemInflater
{
...
...
@@ -129,11 +130,11 @@ public class ContactItemInflater {
private
void
onAvatarClick
(
AbstractContact
contact
)
{
if
(
MUCManager
.
getInstance
().
hasRoom
(
contact
.
getAccount
(),
contact
.
getUser
()))
{
context
.
startActivity
(
ContactViewer
.
createIntent
(
context
,
contact
.
getAccount
(),
contact
.
getUser
()));
context
.
startActivity
(
OccupantList
.
createIntent
(
context
,
contact
.
getAccount
(),
contact
.
getUser
()));
}
else
{
context
.
startActivity
(
ContactEditor
.
createIntent
(
context
,
contact
.
getAccount
(),
contact
.
getUser
()));
context
.
startActivity
(
ContactEditor
.
createIntent
(
context
,
contact
.
getAccount
(),
contact
.
getUser
()));
}
}
}
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