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
37ffab49
Commit
37ffab49
authored
Apr 14, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New ContactEditor activity, extends ContactViewer. Contains edit groups and alias methods.
parent
443c213e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
104 deletions
+137
-104
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+11
-0
ChatViewer.java
app/src/main/java/com/xabber/android/ui/ChatViewer.java
+14
-11
ContactEditor.java
app/src/main/java/com/xabber/android/ui/ContactEditor.java
+84
-0
ContactViewer.java
app/src/main/java/com/xabber/android/ui/ContactViewer.java
+8
-83
GroupedContactAdapter.java
.../com/xabber/android/ui/adapter/GroupedContactAdapter.java
+11
-5
ContextMenuHelper.java
.../java/com/xabber/android/ui/helper/ContextMenuHelper.java
+9
-5
No files found.
app/src/main/AndroidManifest.xml
View file @
37ffab49
...
@@ -236,6 +236,17 @@
...
@@ -236,6 +236,17 @@
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
android:label=
"@string/contact_viewer"
android:name=
"com.xabber.android.ui.ContactEditor"
android:parentActivityName=
"com.xabber.android.ui.ChatViewer"
>
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name=
"android.support.PARENT_ACTIVITY"
android:value=
"com.xabber.android.ui.ChatViewer"
/>
</activity>
<activity
<activity
android:name=
"com.xabber.android.ui.FingerprintViewer"
android:name=
"com.xabber.android.ui.FingerprintViewer"
android:label=
"@string/otr_verify_fingerprint"
android:label=
"@string/otr_verify_fingerprint"
...
...
app/src/main/java/com/xabber/android/ui/ChatViewer.java
View file @
37ffab49
...
@@ -294,7 +294,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
...
@@ -294,7 +294,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
switch
(
item
.
getItemId
())
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
action_view_contact
:
case
R
.
id
.
action_view_contact
:
s
tartActivity
(
ContactViewer
.
createIntent
(
this
,
account
,
user
)
);
s
howContactInfo
(
);
return
true
;
return
true
;
case
R
.
id
.
action_chat_list
:
case
R
.
id
.
action_chat_list
:
...
@@ -424,8 +424,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
...
@@ -424,8 +424,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
return
ACTION_ATTENTION
.
equals
(
intent
.
getAction
());
return
ACTION_ATTENTION
.
equals
(
intent
.
getAction
());
}
}
public
static
Intent
createIntent
(
Context
context
,
String
account
,
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
)
{
String
user
)
{
return
new
EntityIntentBuilder
(
context
,
ChatViewer
.
class
).
setAccount
(
account
).
setUser
(
user
).
build
();
return
new
EntityIntentBuilder
(
context
,
ChatViewer
.
class
).
setAccount
(
account
).
setUser
(
user
).
build
();
}
}
...
@@ -433,8 +432,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
...
@@ -433,8 +432,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
return
new
EntityIntentBuilder
(
context
,
ChatViewer
.
class
).
build
();
return
new
EntityIntentBuilder
(
context
,
ChatViewer
.
class
).
build
();
}
}
public
static
Intent
createClearTopIntent
(
Context
context
,
String
account
,
public
static
Intent
createClearTopIntent
(
Context
context
,
String
account
,
String
user
)
{
String
user
)
{
Intent
intent
=
createIntent
(
context
,
account
,
user
);
Intent
intent
=
createIntent
(
context
,
account
,
user
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
return
intent
;
return
intent
;
...
@@ -452,24 +450,21 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
...
@@ -452,24 +450,21 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
* of messages. Else only one message can be send.
* of messages. Else only one message can be send.
* @return
* @return
*/
*/
public
static
Intent
createSendIntent
(
Context
context
,
String
account
,
public
static
Intent
createSendIntent
(
Context
context
,
String
account
,
String
user
,
String
text
)
{
String
user
,
String
text
)
{
Intent
intent
=
ChatViewer
.
createIntent
(
context
,
account
,
user
);
Intent
intent
=
ChatViewer
.
createIntent
(
context
,
account
,
user
);
intent
.
setAction
(
Intent
.
ACTION_SEND
);
intent
.
setAction
(
Intent
.
ACTION_SEND
);
intent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
text
);
intent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
text
);
return
intent
;
return
intent
;
}
}
public
static
Intent
createAttentionRequestIntent
(
Context
context
,
public
static
Intent
createAttentionRequestIntent
(
Context
context
,
String
account
,
String
user
)
{
String
account
,
String
user
)
{
Intent
intent
=
ChatViewer
.
createClearTopIntent
(
context
,
account
,
user
);
Intent
intent
=
ChatViewer
.
createClearTopIntent
(
context
,
account
,
user
);
intent
.
setAction
(
ACTION_ATTENTION
);
intent
.
setAction
(
ACTION_ATTENTION
);
return
intent
;
return
intent
;
}
}
@Override
@Override
public
void
onChatChanged
(
final
String
account
,
final
String
user
,
public
void
onChatChanged
(
final
String
account
,
final
String
user
,
final
boolean
incoming
)
{
final
boolean
incoming
)
{
String
currentAccount
=
null
;
String
currentAccount
=
null
;
String
currentUser
=
null
;
String
currentUser
=
null
;
...
@@ -716,7 +711,15 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
...
@@ -716,7 +711,15 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
if
(
v
.
getId
()
==
R
.
id
.
avatar
)
{
if
(
v
.
getId
()
==
R
.
id
.
avatar
)
{
showContactInfo
();
}
}
private
void
showContactInfo
()
{
if
(
MUCManager
.
getInstance
().
hasRoom
(
actionWithAccount
,
actionWithUser
))
{
startActivity
(
ContactViewer
.
createIntent
(
this
,
actionWithAccount
,
actionWithUser
));
startActivity
(
ContactViewer
.
createIntent
(
this
,
actionWithAccount
,
actionWithUser
));
}
else
{
startActivity
(
ContactEditor
.
createIntent
(
this
,
actionWithAccount
,
actionWithUser
));
}
}
}
}
}
}
app/src/main/java/com/xabber/android/ui/ContactEditor.java
0 → 100644
View file @
37ffab49
package
com
.
xabber
.
android
.
ui
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.text.InputType
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.widget.EditText
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.intent.EntityIntentBuilder
;
import
com.xabber.android.data.roster.RosterContact
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.ui.dialog.ContactDeleteDialogFragment
;
import
com.xabber.androiddev.R
;
public
class
ContactEditor
extends
ContactViewer
{
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
getMenuInflater
().
inflate
(
R
.
menu
.
contact_viewer
,
menu
);
return
true
;
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
action_edit_alias
:
editAlias
();
return
true
;
case
R
.
id
.
action_edit_groups
:
startActivity
(
GroupEditor
.
createIntent
(
this
,
getAccount
(),
getBareAddress
()));
return
true
;
case
R
.
id
.
action_remove_contact
:
ContactDeleteDialogFragment
.
newInstance
(
getAccount
(),
getBareAddress
())
.
show
(
getFragmentManager
(),
"CONTACT_DELETE"
);
return
true
;
default
:
return
super
.
onOptionsItemSelected
(
item
);
}
}
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
(
getAccount
(),
getBareAddress
());
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
(
getAccount
(),
getBareAddress
(),
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
();
}
public
static
Intent
createIntent
(
Context
context
,
String
account
,
String
user
)
{
return
new
EntityIntentBuilder
(
context
,
ContactEditor
.
class
)
.
setAccount
(
account
).
setUser
(
user
).
build
();
}
}
app/src/main/java/com/xabber/android/ui/ContactViewer.java
View file @
37ffab49
...
@@ -14,27 +14,18 @@
...
@@ -14,27 +14,18 @@
*/
*/
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.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.TextView
;
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.AccountManager
;
import
com.xabber.android.data.account.AccountManager
;
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.muc.MUCManager
;
import
com.xabber.android.data.extension.vcard.OnVCardListener
;
import
com.xabber.android.data.extension.vcard.OnVCardListener
;
import
com.xabber.android.data.extension.vcard.VCardManager
;
import
com.xabber.android.data.extension.vcard.VCardManager
;
import
com.xabber.android.data.intent.AccountIntentBuilder
;
import
com.xabber.android.data.intent.AccountIntentBuilder
;
...
@@ -44,7 +35,6 @@ import com.xabber.android.data.roster.GroupManager;
...
@@ -44,7 +35,6 @@ import com.xabber.android.data.roster.GroupManager;
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
;
...
@@ -73,9 +63,6 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -73,9 +63,6 @@ public class ContactViewer extends ManagedActivity implements
private
ContactTitleExpandableToolbarInflater
contactTitleExpandableToolbarInflater
;
private
ContactTitleExpandableToolbarInflater
contactTitleExpandableToolbarInflater
;
private
TextView
contactNameView
;
private
TextView
contactNameView
;
private
boolean
isAccount
=
false
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
@@ -109,7 +96,6 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -109,7 +96,6 @@ public class ContactViewer extends ManagedActivity implements
}
}
if
(
bareAddress
!=
null
&&
bareAddress
.
equalsIgnoreCase
(
GroupManager
.
IS_ACCOUNT
))
{
if
(
bareAddress
!=
null
&&
bareAddress
.
equalsIgnoreCase
(
GroupManager
.
IS_ACCOUNT
))
{
isAccount
=
true
;
bareAddress
=
Jid
.
getBareAddress
(
AccountManager
.
getInstance
().
getAccount
(
account
).
getRealJid
());
bareAddress
=
Jid
.
getBareAddress
(
AccountManager
.
getInstance
().
getAccount
(
account
).
getRealJid
());
}
}
...
@@ -178,75 +164,6 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -178,75 +164,6 @@ public class ContactViewer extends ManagedActivity implements
contactViewerFragment
.
updateVCard
(
vCard
);
contactViewerFragment
.
updateVCard
(
vCard
);
}
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
if
(
isAccount
||
MUCManager
.
getInstance
().
hasRoom
(
account
,
bareAddress
))
{
return
true
;
}
MenuInflater
inflater
=
getMenuInflater
();
inflater
.
inflate
(
R
.
menu
.
contact_viewer
,
menu
);
RosterContact
rosterContact
=
RosterManager
.
getInstance
().
getRosterContact
(
account
,
bareAddress
);
if
(
rosterContact
==
null
)
{
menu
.
findItem
(
R
.
id
.
action_edit_alias
).
setVisible
(
false
);
}
return
true
;
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
action_edit_alias
:
editAlias
();
return
true
;
case
R
.
id
.
action_edit_groups
:
startActivity
(
GroupEditor
.
createIntent
(
this
,
account
,
bareAddress
));
return
true
;
case
R
.
id
.
action_remove_contact
:
ContactDeleteDialogFragment
.
newInstance
(
account
,
bareAddress
)
.
show
(
getFragmentManager
(),
"CONTACT_DELETE"
);
return
true
;
default
:
return
super
.
onOptionsItemSelected
(
item
);
}
}
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
ContactVcardViewerFragment
getFragment
()
{
private
ContactVcardViewerFragment
getFragment
()
{
return
(
ContactVcardViewerFragment
)
getFragmentManager
().
findFragmentById
(
R
.
id
.
scrollable_container
);
return
(
ContactVcardViewerFragment
)
getFragmentManager
().
findFragmentById
(
R
.
id
.
scrollable_container
);
}
}
...
@@ -320,4 +237,12 @@ public class ContactViewer extends ManagedActivity implements
...
@@ -320,4 +237,12 @@ public class ContactViewer extends ManagedActivity implements
private
static
String
getUser
(
Intent
intent
)
{
private
static
String
getUser
(
Intent
intent
)
{
return
EntityIntentBuilder
.
getUser
(
intent
);
return
EntityIntentBuilder
.
getUser
(
intent
);
}
}
protected
String
getAccount
()
{
return
account
;
}
protected
String
getBareAddress
()
{
return
bareAddress
;
}
}
}
app/src/main/java/com/xabber/android/ui/adapter/GroupedContactAdapter.java
View file @
37ffab49
...
@@ -25,7 +25,6 @@ import android.widget.BaseAdapter;
...
@@ -25,7 +25,6 @@ import android.widget.BaseAdapter;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountItem
;
import
com.xabber.android.data.account.AccountItem
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.AccountManager
;
...
@@ -33,11 +32,13 @@ import com.xabber.android.data.account.StatusMode;
...
@@ -33,11 +32,13 @@ import com.xabber.android.data.account.StatusMode;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.avatar.AvatarManager
;
import
com.xabber.android.data.extension.avatar.AvatarManager
;
import
com.xabber.android.data.extension.capability.ClientSoftware
;
import
com.xabber.android.data.extension.capability.ClientSoftware
;
import
com.xabber.android.data.extension.muc.MUCManager
;
import
com.xabber.android.data.message.MessageManager
;
import
com.xabber.android.data.message.MessageManager
;
import
com.xabber.android.data.roster.AbstractContact
;
import
com.xabber.android.data.roster.AbstractContact
;
import
com.xabber.android.data.roster.Group
;
import
com.xabber.android.data.roster.Group
;
import
com.xabber.android.data.roster.GroupManager
;
import
com.xabber.android.data.roster.GroupManager
;
import
com.xabber.android.data.roster.ShowOfflineMode
;
import
com.xabber.android.data.roster.ShowOfflineMode
;
import
com.xabber.android.ui.ContactEditor
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.androiddev.R
;
import
com.xabber.androiddev.R
;
...
@@ -382,8 +383,13 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
...
@@ -382,8 +383,13 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
viewHolder
.
avatar
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
viewHolder
.
avatar
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
activity
.
startActivity
(
ContactViewer
.
createIntent
(
activity
,
if
(
MUCManager
.
getInstance
().
hasRoom
(
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()))
{
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
activity
.
startActivity
(
ContactViewer
.
createIntent
(
activity
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
}
else
{
activity
.
startActivity
(
ContactEditor
.
createIntent
(
activity
,
abstractContact
.
getAccount
(),
abstractContact
.
getUser
()));
}
}
}
});
});
...
@@ -410,9 +416,9 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
...
@@ -410,9 +416,9 @@ public abstract class GroupedContactAdapter extends BaseAdapter implements Updat
viewHolder
.
statusMode
.
setImageLevel
(
abstractContact
.
getStatusMode
().
getStatusLevel
());
viewHolder
.
statusMode
.
setImageLevel
(
abstractContact
.
getStatusMode
().
getStatusLevel
());
ClientSoftware
clientSoftware
=
abstractContact
.
getClientSoftware
();
ClientSoftware
clientSoftware
=
abstractContact
.
getClientSoftware
();
if
(
clientSoftware
==
ClientSoftware
.
unknown
)
if
(
clientSoftware
==
ClientSoftware
.
unknown
)
{
viewHolder
.
clientSoftware
.
setVisibility
(
View
.
INVISIBLE
);
viewHolder
.
clientSoftware
.
setVisibility
(
View
.
INVISIBLE
);
else
{
}
else
{
viewHolder
.
clientSoftware
.
setVisibility
(
View
.
VISIBLE
);
viewHolder
.
clientSoftware
.
setVisibility
(
View
.
VISIBLE
);
viewHolder
.
clientSoftware
.
setImageLevel
(
clientSoftware
.
ordinal
());
viewHolder
.
clientSoftware
.
setImageLevel
(
clientSoftware
.
ordinal
());
}
}
...
...
app/src/main/java/com/xabber/android/ui/helper/ContextMenuHelper.java
View file @
37ffab49
...
@@ -38,6 +38,7 @@ import com.xabber.android.data.roster.PresenceManager;
...
@@ -38,6 +38,7 @@ import com.xabber.android.data.roster.PresenceManager;
import
com.xabber.android.data.roster.ShowOfflineMode
;
import
com.xabber.android.data.roster.ShowOfflineMode
;
import
com.xabber.android.ui.ChatViewer
;
import
com.xabber.android.ui.ChatViewer
;
import
com.xabber.android.ui.ContactAdd
;
import
com.xabber.android.ui.ContactAdd
;
import
com.xabber.android.ui.ContactEditor
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.android.ui.ContactViewer
;
import
com.xabber.android.ui.GroupEditor
;
import
com.xabber.android.ui.GroupEditor
;
import
com.xabber.android.ui.MUCEditor
;
import
com.xabber.android.ui.MUCEditor
;
...
@@ -91,7 +92,7 @@ public class ContextMenuHelper {
...
@@ -91,7 +92,7 @@ public class ContextMenuHelper {
return
true
;
return
true
;
}
}
});
});
if
(
MUCManager
.
getInstance
().
isDisabled
(
account
,
user
))
if
(
MUCManager
.
getInstance
().
isDisabled
(
account
,
user
))
{
menu
.
add
(
R
.
string
.
muc_join
).
setOnMenuItemClickListener
(
menu
.
add
(
R
.
string
.
muc_join
).
setOnMenuItemClickListener
(
new
MenuItem
.
OnMenuItemClickListener
()
{
new
MenuItem
.
OnMenuItemClickListener
()
{
@Override
@Override
...
@@ -101,7 +102,7 @@ public class ContextMenuHelper {
...
@@ -101,7 +102,7 @@ public class ContextMenuHelper {
return
true
;
return
true
;
}
}
});
});
else
}
else
{
menu
.
add
(
R
.
string
.
muc_leave
).
setOnMenuItemClickListener
(
menu
.
add
(
R
.
string
.
muc_leave
).
setOnMenuItemClickListener
(
new
MenuItem
.
OnMenuItemClickListener
()
{
new
MenuItem
.
OnMenuItemClickListener
()
{
...
@@ -119,9 +120,10 @@ public class ContextMenuHelper {
...
@@ -119,9 +120,10 @@ public class ContextMenuHelper {
}
}
});
});
}
}
else
{
}
else
{
menu
.
add
(
R
.
string
.
contact_viewer
).
setIntent
(
menu
.
add
(
R
.
string
.
contact_viewer
).
setIntent
(
Contact
Viewe
r
.
createIntent
(
activity
,
account
,
user
));
Contact
Edito
r
.
createIntent
(
activity
,
account
,
user
));
menu
.
add
(
R
.
string
.
edit_contact_groups
).
setIntent
(
menu
.
add
(
R
.
string
.
edit_contact_groups
).
setIntent
(
GroupEditor
.
createIntent
(
activity
,
account
,
user
));
GroupEditor
.
createIntent
(
activity
,
account
,
user
));
...
@@ -137,7 +139,7 @@ public class ContextMenuHelper {
...
@@ -137,7 +139,7 @@ public class ContextMenuHelper {
}
}
});
});
if
(
MessageManager
.
getInstance
().
hasActiveChat
(
account
,
user
))
if
(
MessageManager
.
getInstance
().
hasActiveChat
(
account
,
user
))
{
menu
.
add
(
R
.
string
.
close_chat
).
setOnMenuItemClickListener
(
menu
.
add
(
R
.
string
.
close_chat
).
setOnMenuItemClickListener
(
new
MenuItem
.
OnMenuItemClickListener
()
{
new
MenuItem
.
OnMenuItemClickListener
()
{
...
@@ -153,7 +155,8 @@ public class ContextMenuHelper {
...
@@ -153,7 +155,8 @@ public class ContextMenuHelper {
}
}
});
});
if
(
abstractContact
.
getStatusMode
()
==
StatusMode
.
unsubscribed
)
}
if
(
abstractContact
.
getStatusMode
()
==
StatusMode
.
unsubscribed
)
{
menu
.
add
(
R
.
string
.
request_subscription
)
menu
.
add
(
R
.
string
.
request_subscription
)
.
setOnMenuItemClickListener
(
.
setOnMenuItemClickListener
(
new
MenuItem
.
OnMenuItemClickListener
()
{
new
MenuItem
.
OnMenuItemClickListener
()
{
...
@@ -172,6 +175,7 @@ public class ContextMenuHelper {
...
@@ -172,6 +175,7 @@ public class ContextMenuHelper {
}
}
});
});
}
}
}
if
(
PresenceManager
.
getInstance
().
hasSubscriptionRequest
(
account
,
user
))
{
if
(
PresenceManager
.
getInstance
().
hasSubscriptionRequest
(
account
,
user
))
{
menu
.
add
(
R
.
string
.
accept_subscription
).
setOnMenuItemClickListener
(
menu
.
add
(
R
.
string
.
accept_subscription
).
setOnMenuItemClickListener
(
...
...
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