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
c01a7a20
Commit
c01a7a20
authored
Mar 19, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ContactViewer: "remove contact" option added to action menu.
parent
2af84378
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
5 deletions
+42
-5
ContactViewer.java
app/src/main/java/com/xabber/android/ui/ContactViewer.java
+8
-2
ContactViewerFragment.java
...ain/java/com/xabber/android/ui/ContactViewerFragment.java
+4
-3
ContactDeleteDialogFragment.java
...xabber/android/ui/dialog/ContactDeleteDialogFragment.java
+6
-0
contact_viewer.xml
app/src/main/res/menu/contact_viewer.xml
+16
-0
contact_viewer.xml
app/src/main/res/values-ru/contact_viewer.xml
+3
-0
contact_viewer.xml
app/src/main/res/values/contact_viewer.xml
+5
-0
No files found.
app/src/main/java/com/xabber/android/ui/ContactViewer.java
View file @
c01a7a20
...
@@ -35,6 +35,7 @@ import com.xabber.android.data.roster.AbstractContact;
...
@@ -35,6 +35,7 @@ import com.xabber.android.data.roster.AbstractContact;
import
com.xabber.android.data.roster.OnContactChangedListener
;
import
com.xabber.android.data.roster.OnContactChangedListener
;
import
com.xabber.android.data.roster.RosterContact
;
import
com.xabber.android.data.roster.RosterContact
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.ui.dialog.ContactDeleteDialogFragment
;
import
com.xabber.android.ui.helper.ContactTitleExpandableToolbarInflater
;
import
com.xabber.android.ui.helper.ContactTitleExpandableToolbarInflater
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.androiddev.R
;
import
com.xabber.androiddev.R
;
...
@@ -224,7 +225,7 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -224,7 +225,7 @@ public class ContactViewer extends ManagedActivity implements
@Override
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
MenuInflater
inflater
=
getMenuInflater
();
MenuInflater
inflater
=
getMenuInflater
();
inflater
.
inflate
(
R
.
menu
.
edit_contact
,
menu
);
inflater
.
inflate
(
R
.
menu
.
contact_viewer
,
menu
);
return
true
;
return
true
;
}
}
...
@@ -232,10 +233,15 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -232,10 +233,15 @@ 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_
contact
:
case
R
.
id
.
action_edit_
groups
:
startActivity
(
ContactEditor
.
createIntent
(
this
,
account
,
bareAddress
));
startActivity
(
ContactEditor
.
createIntent
(
this
,
account
,
bareAddress
));
return
true
;
return
true
;
case
R
.
id
.
action_remove_contact
:
ContactDeleteDialogFragment
.
newInstance
(
account
,
bareAddress
)
.
show
(
getFragmentManager
(),
"CONTACT_DELETE"
);
return
true
;
default
:
default
:
return
super
.
onOptionsItemSelected
(
item
);
return
super
.
onOptionsItemSelected
(
item
);
}
}
...
...
app/src/main/java/com/xabber/android/ui/ContactViewerFragment.java
View file @
c01a7a20
...
@@ -105,12 +105,13 @@ public class ContactViewerFragment extends Fragment {
...
@@ -105,12 +105,13 @@ public class ContactViewerFragment extends Fragment {
addXmppItem
(
getString
(
R
.
string
.
contact_viewer_jid
),
bareAddress
,
R
.
drawable
.
ic_xmpp_24dp
);
addXmppItem
(
getString
(
R
.
string
.
contact_viewer_jid
),
bareAddress
,
R
.
drawable
.
ic_xmpp_24dp
);
RosterContact
rosterContact
=
RosterManager
.
getInstance
().
getRosterContact
(
account
,
bareAddress
);
RosterContact
rosterContact
=
RosterManager
.
getInstance
().
getRosterContact
(
account
,
bareAddress
);
contactNameEditText
.
setText
(
rosterContact
.
getName
());
if
(
rosterContact
==
null
||
!
rosterContact
.
isConnected
())
{
contactNameEditText
.
setText
(
bareAddress
);
if
(!
rosterContact
.
isConnected
())
{
return
;
return
;
}
}
contactNameEditText
.
setText
(
rosterContact
.
getName
());
List
<
View
>
resourcesList
=
new
ArrayList
<>();
List
<
View
>
resourcesList
=
new
ArrayList
<>();
for
(
ResourceItem
resourceItem
for
(
ResourceItem
resourceItem
...
...
app/src/main/java/com/xabber/android/ui/dialog/ContactDeleteDialogFragment.java
View file @
c01a7a20
...
@@ -7,6 +7,8 @@ import com.xabber.android.data.Application;
...
@@ -7,6 +7,8 @@ import com.xabber.android.data.Application;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.ui.ContactList
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.androiddev.R
;
import
com.xabber.androiddev.R
;
public
class
ContactDeleteDialogFragment
extends
ConfirmDialogFragment
{
public
class
ContactDeleteDialogFragment
extends
ConfirmDialogFragment
{
...
@@ -44,6 +46,10 @@ public class ContactDeleteDialogFragment extends ConfirmDialogFragment {
...
@@ -44,6 +46,10 @@ public class ContactDeleteDialogFragment extends ConfirmDialogFragment {
}
catch
(
NetworkException
e
)
{
}
catch
(
NetworkException
e
)
{
Application
.
getInstance
().
onError
(
e
);
Application
.
getInstance
().
onError
(
e
);
}
}
if
(
getActivity
()
instanceof
ContactViewer
)
{
startActivity
(
ContactList
.
createIntent
(
getActivity
()));
}
return
true
;
return
true
;
}
}
...
...
app/src/main/res/menu/
edit_contact
.xml
→
app/src/main/res/menu/
contact_viewer
.xml
View file @
c01a7a20
<?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_
contact
"
<item
android:id=
"@+id/action_edit_
groups
"
android:title=
"@string/
contact_editor
"
android:title=
"@string/
edit_contact_groups
"
app:showAsAction=
"
always
"
app:showAsAction=
"
never
"
android:orderInCategory=
"100"
android:orderInCategory=
"100"
android:icon=
"@drawable/ic_create_white_24dp"
/>
/>
<item
android:id=
"@+id/action_remove_contact"
android:title=
"@string/remove_contact"
app:showAsAction=
"never"
android:orderInCategory=
"110"
/>
</menu>
</menu>
\ No newline at end of file
app/src/main/res/values-ru/contact_viewer.xml
View file @
c01a7a20
...
@@ -115,4 +115,7 @@
...
@@ -115,4 +115,7 @@
<string
name=
"please_wait"
>
Пожалуйста, подождите...
</string>
<string
name=
"please_wait"
>
Пожалуйста, подождите...
</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=
"unknown"
>
Не известно
</string>
<string
name=
"unknown"
>
Не известно
</string>
<string
name=
"edit_contact_groups"
>
Редактировать группы
</string>
<string
name=
"remove_contact"
>
Удалить контакт
</string>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/contact_viewer.xml
View file @
c01a7a20
...
@@ -115,4 +115,9 @@
...
@@ -115,4 +115,9 @@
<string
name=
"please_wait"
>
Please wait...
</string>
<string
name=
"please_wait"
>
Please wait...
</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=
"unknown"
>
Unknown
</string>
<string
name=
"unknown"
>
Unknown
</string>
<string
name=
"edit_contact_groups"
>
Edit groups
</string>
<string
name=
"remove_contact"
>
Remove contact
</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