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
b3c980be
Commit
b3c980be
authored
Aug 04, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AccountInfoEditor: simple toolbar with title used instead of ContactTitleActionBarInflater.
parent
0cdd5530
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
42 deletions
+8
-42
AccountInfoEditor.java
...rc/main/java/com/xabber/android/ui/AccountInfoEditor.java
+8
-42
No files found.
app/src/main/java/com/xabber/android/ui/AccountInfoEditor.java
View file @
b3c980be
...
...
@@ -12,27 +12,17 @@ import android.view.WindowManager;
import
com.xabber.android.R
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.LogManager
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.data.intent.EntityIntentBuilder
;
import
com.xabber.android.data.roster.AbstractContact
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.ui.helper.ContactTitleActionBarInflater
;
import
com.xabber.android.ui.helper.BarPainter
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.xmpp.address.Jid
;
import
java.util.Collection
;
public
class
AccountInfoEditor
extends
ManagedActivity
implements
OnAccountChangedListener
,
Toolbar
.
OnMenuItemClickListener
{
public
class
AccountInfoEditor
extends
ManagedActivity
implements
Toolbar
.
OnMenuItemClickListener
{
public
static
final
String
ARG_VCARD
=
"com.xabber.android.ui.AccountInfoEditor.ARG_VCARD"
;
public
static
final
int
SAVE_MENU
=
R
.
menu
.
save
;
ContactTitleActionBarInflater
contactTitleActionBarInflater
;
private
String
account
;
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
vCard
)
{
Intent
intent
=
new
EntityIntentBuilder
(
context
,
AccountInfoEditor
.
class
).
setAccount
(
account
).
build
();
intent
.
putExtra
(
ARG_VCARD
,
vCard
);
...
...
@@ -48,12 +38,10 @@ public class AccountInfoEditor extends ManagedActivity implements OnAccountChang
setContentView
(
R
.
layout
.
activity_with_toolbar_and_container
);
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar_default
);
contactTitleActionBarInflater
=
new
ContactTitleActionBarInflater
(
this
,
toolbar
);
contactTitleActionBarInflater
.
setUpActionBarView
();
Intent
intent
=
getIntent
();
account
=
getAccount
(
intent
);
String
account
=
getAccount
(
intent
);
String
vCard
=
intent
.
getStringExtra
(
ARG_VCARD
);
if
(
AccountManager
.
getInstance
().
getAccount
(
account
)
==
null
)
{
...
...
@@ -62,6 +50,7 @@ public class AccountInfoEditor extends ManagedActivity implements OnAccountChang
finish
();
}
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar_default
);
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_clear_white_24dp
);
toolbar
.
setNavigationOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
@@ -69,7 +58,10 @@ public class AccountInfoEditor extends ManagedActivity implements OnAccountChang
finish
();
}
});
toolbar
.
setTitle
(
R
.
string
.
edit_account_user_info
);
BarPainter
barPainter
=
new
BarPainter
(
this
,
toolbar
);
barPainter
.
updateWithAccountName
(
account
);
if
(
savedInstanceState
==
null
)
{
getFragmentManager
().
beginTransaction
()
...
...
@@ -82,32 +74,6 @@ public class AccountInfoEditor extends ManagedActivity implements OnAccountChang
toolbar
.
setOnMenuItemClickListener
(
this
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
update
();
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
Application
.
getInstance
().
removeUIListener
(
OnAccountChangedListener
.
class
,
this
);
}
private
void
update
()
{
AbstractContact
bestContact
=
RosterManager
.
getInstance
().
getBestContact
(
account
,
Jid
.
getBareAddress
(
account
));
contactTitleActionBarInflater
.
update
(
bestContact
);
contactTitleActionBarInflater
.
hideStatusIcon
();
}
@Override
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
if
(
accounts
.
contains
(
account
))
{
update
();
}
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
getMenuInflater
().
inflate
(
SAVE_MENU
,
menu
);
...
...
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