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
673647ed
Commit
673647ed
authored
Feb 18, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ContactEditor: old contact title removed. Light refactoring.
parent
920eb760
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
32 deletions
+26
-32
ContactEditor.java
app/src/main/java/com/xabber/android/ui/ContactEditor.java
+22
-30
ContactTitleActionBarInflater.java
...bber/android/ui/helper/ContactTitleActionBarInflater.java
+4
-0
contact_editor.xml
app/src/main/res/layout/contact_editor.xml
+0
-2
No files found.
app/src/main/java/com/xabber/android/ui/ContactEditor.java
View file @
673647ed
...
...
@@ -17,6 +17,7 @@ package com.xabber.android.ui;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.EditText
;
import
android.widget.TextView
;
...
...
@@ -31,7 +32,6 @@ import com.xabber.android.data.roster.AbstractContact;
import
com.xabber.android.data.roster.OnContactChangedListener
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.ui.helper.ContactTitleActionBarInflater
;
import
com.xabber.android.ui.helper.ContactTitleInflater
;
import
com.xabber.androiddev.R
;
import
com.xabber.xmpp.address.Jid
;
...
...
@@ -61,11 +61,10 @@ public class ContactEditor extends GroupListActivity implements
Intent
intent
=
getIntent
();
account
=
ContactEditor
.
getAccount
(
intent
);
user
=
ContactEditor
.
getUser
(
intent
);
if
(
AccountManager
.
getInstance
().
getAccount
(
account
)
==
null
||
user
==
null
)
{
if
(
AccountManager
.
getInstance
().
getAccount
(
account
)
==
null
||
user
==
null
)
{
Application
.
getInstance
().
onError
(
R
.
string
.
ENTRY_IS_NOT_FOUND
);
finish
();
return
;
}
}
...
...
@@ -82,62 +81,55 @@ public class ContactEditor extends GroupListActivity implements
@Override
protected
void
onResume
()
{
super
.
onResume
();
((
EditText
)
findViewById
(
R
.
id
.
contact_name
)).
setText
(
RosterManager
.
getInstance
().
getName
(
account
,
user
));
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
((
EditText
)
findViewById
(
R
.
id
.
contact_name
)).
setText
(
RosterManager
.
getInstance
().
getName
(
account
,
user
));
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnContactChangedListener
.
class
,
this
);
update
();
}
@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
);
try
{
String
name
=
((
EditText
)
findViewById
(
R
.
id
.
contact_name
))
.
getText
().
toString
();
RosterManager
.
getInstance
().
setNameAndGroup
(
account
,
user
,
name
,
getSelected
());
String
name
=
((
EditText
)
findViewById
(
R
.
id
.
contact_name
)).
getText
().
toString
();
RosterManager
.
getInstance
().
setNameAndGroup
(
account
,
user
,
name
,
getSelected
());
}
catch
(
NetworkException
e
)
{
Application
.
getInstance
().
onError
(
e
);
}
}
private
void
update
()
{
AbstractContact
abstractContact
=
RosterManager
.
getInstance
()
.
getBestContact
(
account
,
user
);
ContactTitleInflater
.
updateTitle
(
findViewById
(
R
.
id
.
title
),
this
,
abstractContact
);
((
TextView
)
findViewById
(
R
.
id
.
name
)).
setText
(
getString
(
R
.
string
.
contact_editor_title
,
abstractContact
.
getName
()));
((
TextView
)
findViewById
(
R
.
id
.
status_text
)).
setText
(
user
);
AbstractContact
abstractContact
=
RosterManager
.
getInstance
().
getBestContact
(
account
,
user
);
contactTitleActionBarInflater
.
update
(
abstractContact
);
View
actionBarView
=
contactTitleActionBarInflater
.
getActionBarView
();
((
TextView
)
actionBarView
.
findViewById
(
R
.
id
.
name
))
.
setText
(
getString
(
R
.
string
.
contact_editor_title
,
abstractContact
.
getName
()));
((
TextView
)
actionBarView
.
findViewById
(
R
.
id
.
status_text
)).
setText
(
user
);
}
@Override
public
void
onContactsChanged
(
Collection
<
BaseEntity
>
entities
)
{
String
thisBareAddress
=
Jid
.
getBareAddress
(
user
);
for
(
BaseEntity
entity
:
entities
)
for
(
BaseEntity
entity
:
entities
)
{
if
(
entity
.
equals
(
account
,
thisBareAddress
))
{
update
();
break
;
}
}
}
@Override
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
if
(
accounts
.
contains
(
account
))
if
(
accounts
.
contains
(
account
))
{
update
();
}
}
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
)
{
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
)
{
Intent
intent
=
new
EntityIntentBuilder
(
context
,
ContactEditor
.
class
)
.
setAccount
(
account
).
setUser
(
user
).
build
();
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
);
...
...
app/src/main/java/com/xabber/android/ui/helper/ContactTitleActionBarInflater.java
View file @
673647ed
...
...
@@ -55,4 +55,8 @@ public class ContactTitleActionBarInflater {
}
activity
.
getSupportActionBar
().
setBackgroundDrawable
(
new
ColorDrawable
(
accountActionBarColors
[
colorLevel
]));
}
public
View
getActionBarView
()
{
return
actionBarView
;
}
}
app/src/main/res/layout/contact_editor.xml
View file @
673647ed
...
...
@@ -19,8 +19,6 @@
android:layout_height=
"match_parent"
>
<include
layout=
"@layout/contact_title"
/>
<TextView
android:text=
"@string/contact_name"
android:layout_width=
"wrap_content"
...
...
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