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
f9d4c9a2
Commit
f9d4c9a2
authored
Mar 20, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ContactViewer: new "edit alias" menu item.
parent
d715229a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
2 deletions
+59
-2
ContactViewer.java
app/src/main/java/com/xabber/android/ui/ContactViewer.java
+41
-0
contact_viewer.xml
app/src/main/res/menu/contact_viewer.xml
+7
-0
contact_viewer.xml
app/src/main/res/values-ru/contact_viewer.xml
+2
-1
words.xml
app/src/main/res/values-ru/words.xml
+4
-0
contact_viewer.xml
app/src/main/res/values/contact_viewer.xml
+2
-1
words.xml
app/src/main/res/values/words.xml
+3
-0
No files found.
app/src/main/java/com/xabber/android/ui/ContactViewer.java
View file @
f9d4c9a2
...
@@ -14,17 +14,22 @@
...
@@ -14,17 +14,22 @@
*/
*/
package
com
.
xabber
.
android
.
ui
;
package
com
.
xabber
.
android
.
ui
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.InputType
;
import
android.view.Menu
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.EditText
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.LogManager
;
import
com.xabber.android.data.LogManager
;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.vcard.OnVCardListener
;
import
com.xabber.android.data.extension.vcard.OnVCardListener
;
...
@@ -233,6 +238,11 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -233,6 +238,11 @@ public class ContactViewer extends ManagedActivity implements
@Override
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
action_edit_alias
:
editAlias
();
return
true
;
case
R
.
id
.
action_edit_groups
:
case
R
.
id
.
action_edit_groups
:
startActivity
(
ContactEditor
.
createIntent
(
this
,
account
,
bareAddress
));
startActivity
(
ContactEditor
.
createIntent
(
this
,
account
,
bareAddress
));
return
true
;
return
true
;
...
@@ -247,6 +257,37 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -247,6 +257,37 @@ public class ContactViewer extends ManagedActivity implements
}
}
}
}
private
void
editAlias
()
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setTitle
(
R
.
string
.
edit_alias
);
final
EditText
input
=
new
EditText
(
this
);
input
.
setInputType
(
InputType
.
TYPE_TEXT_VARIATION_PERSON_NAME
);
RosterContact
rosterContact
=
RosterManager
.
getInstance
().
getRosterContact
(
account
,
bareAddress
);
input
.
setText
(
rosterContact
.
getName
());
builder
.
setView
(
input
);
builder
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
try
{
RosterManager
.
getInstance
().
setName
(
account
,
bareAddress
,
input
.
getText
().
toString
());
}
catch
(
NetworkException
e
)
{
Application
.
getInstance
().
onError
(
e
);
}
}
});
builder
.
setNegativeButton
(
R
.
string
.
cancel
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
cancel
();
}
});
builder
.
show
();
}
private
ContactViewerFragment
getFragment
()
{
private
ContactViewerFragment
getFragment
()
{
return
(
ContactViewerFragment
)
getFragmentManager
()
return
(
ContactViewerFragment
)
getFragmentManager
()
.
findFragmentById
(
R
.
id
.
scrollable_container
);
.
findFragmentById
(
R
.
id
.
scrollable_container
);
...
...
app/src/main/res/menu/contact_viewer.xml
View file @
f9d4c9a2
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/action_edit_alias"
android:title=
"@string/edit_alias"
app:showAsAction=
"never"
android:orderInCategory=
"90"
/>
<item
android:id=
"@+id/action_edit_groups"
<item
android:id=
"@+id/action_edit_groups"
android:title=
"@string/edit_contact_groups"
android:title=
"@string/edit_contact_groups"
app:showAsAction=
"never"
app:showAsAction=
"never"
...
...
app/src/main/res/values-ru/contact_viewer.xml
View file @
f9d4c9a2
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_list_contact_context_menu.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_list_contact_context_menu.png -->
<string
name=
"contact_viewer"
>
Просмотр информации
</string>
<string
name=
"contact_viewer"
>
Информация о контакте
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<string
name=
"contact_viewer_for"
>
Просмотр информации о %s
</string>
<string
name=
"contact_viewer_for"
>
Просмотр информации о %s
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
...
@@ -116,6 +116,7 @@
...
@@ -116,6 +116,7 @@
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<string
name=
"unknown"
>
Не известно
</string>
<string
name=
"unknown"
>
Не известно
</string>
<string
name=
"edit_alias"
>
Редактировать псевдоним
</string>
<string
name=
"edit_contact_groups"
>
Редактировать группы
</string>
<string
name=
"edit_contact_groups"
>
Редактировать группы
</string>
<string
name=
"remove_contact"
>
Удалить контакт
</string>
<string
name=
"remove_contact"
>
Удалить контакт
</string>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values-ru/words.xml
View file @
f9d4c9a2
...
@@ -28,4 +28,8 @@
...
@@ -28,4 +28,8 @@
<string
name=
"auto"
>
Автоматически
</string>
<string
name=
"auto"
>
Автоматически
</string>
<string
name=
"save"
>
Сохранить
</string>
<string
name=
"save"
>
Сохранить
</string>
<string
name=
"ok"
>
Ok
</string>
<string
name=
"cancel"
>
Отмена
</string>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/contact_viewer.xml
View file @
f9d4c9a2
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_list_contact_context_menu.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_list_contact_context_menu.png -->
<string
name=
"contact_viewer"
>
View information
</string>
<string
name=
"contact_viewer"
>
Contact info
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<string
name=
"contact_viewer_for"
>
View information about %s
</string>
<string
name=
"contact_viewer_for"
>
View information about %s
</string>
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
...
@@ -116,6 +116,7 @@
...
@@ -116,6 +116,7 @@
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<!-- http://dl.dropbox.com/u/1029995/com.xabber.android/contact_viewer_xmpp.png -->
<string
name=
"unknown"
>
Unknown
</string>
<string
name=
"unknown"
>
Unknown
</string>
<string
name=
"edit_alias"
>
Edit alias
</string>
<string
name=
"edit_contact_groups"
>
Edit groups
</string>
<string
name=
"edit_contact_groups"
>
Edit groups
</string>
<string
name=
"remove_contact"
>
Remove contact
</string>
<string
name=
"remove_contact"
>
Remove contact
</string>
...
...
app/src/main/res/values/words.xml
View file @
f9d4c9a2
...
@@ -28,4 +28,7 @@
...
@@ -28,4 +28,7 @@
<string
name=
"auto"
>
Automatically
</string>
<string
name=
"auto"
>
Automatically
</string>
<string
name=
"save"
>
Save
</string>
<string
name=
"save"
>
Save
</string>
<string
name=
"ok"
>
Ok
</string>
<string
name=
"cancel"
>
Cancel
</string>
</resources>
</resources>
\ No newline at end of file
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