use of com.xabber.xmpp.uri.XMPPUri in project xabber-android by redsolution.
the class ContactList method onResume.
@Override
protected void onResume() {
super.onResume();
barPainter.setDefaultColor();
rebuildAccountToggle();
Application.getInstance().addUIListener(OnAccountChangedListener.class, this);
if (action != null) {
switch(action) {
case ContactList.ACTION_ROOM_INVITE:
case Intent.ACTION_SEND:
case Intent.ACTION_CREATE_SHORTCUT:
if (Intent.ACTION_SEND.equals(action)) {
sendText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
}
Toast.makeText(this, getString(R.string.select_contact), Toast.LENGTH_LONG).show();
break;
case Intent.ACTION_VIEW:
{
action = null;
Uri data = getIntent().getData();
if (data != null && "xmpp".equals(data.getScheme())) {
XMPPUri xmppUri;
try {
xmppUri = XMPPUri.parse(data);
} catch (IllegalArgumentException e) {
xmppUri = null;
}
if (xmppUri != null && "message".equals(xmppUri.getQueryType())) {
ArrayList<String> texts = xmppUri.getValues("body");
String text = null;
if (texts != null && !texts.isEmpty()) {
text = texts.get(0);
}
openChat(xmppUri.getPath(), text);
}
}
break;
}
case Intent.ACTION_SENDTO:
{
action = null;
Uri data = getIntent().getData();
if (data != null) {
String path = data.getPath();
if (path != null && path.startsWith("/")) {
openChat(path.substring(1), null);
}
}
break;
}
case ContactList.ACTION_MUC_PRIVATE_CHAT_INVITE:
action = null;
showMucPrivateChatDialog();
break;
case ContactList.ACTION_CONTACT_SUBSCRIPTION:
action = null;
showContactSubscriptionDialog();
break;
case ContactList.ACTION_INCOMING_MUC_INVITE:
action = null;
showMucInviteDialog();
break;
}
}
if (Application.getInstance().doNotify()) {
if (!SettingsManager.isTranslationSuggested()) {
Locale currentLocale = getResources().getConfiguration().locale;
if (!currentLocale.getLanguage().equals("en") && !getResources().getBoolean(R.bool.is_translated)) {
new TranslationDialog().show(getFragmentManager(), "TRANSLATION_DIALOG");
SettingsManager.setTranslationSuggested();
}
}
if (SettingsManager.bootCount() > 2 && !SettingsManager.connectionStartAtBoot() && !SettingsManager.startAtBootSuggested()) {
StartAtBootDialogFragment.newInstance().show(getFragmentManager(), "START_AT_BOOT");
}
if (SettingsManager.interfaceTheme() != SettingsManager.InterfaceTheme.dark) {
if (!SettingsManager.isDarkThemeSuggested() && SettingsManager.bootCount() > 0) {
new DarkThemeIntroduceDialog().show(getFragmentManager(), DarkThemeIntroduceDialog.class.getSimpleName());
SettingsManager.setDarkThemeSuggested();
}
} else {
SettingsManager.setDarkThemeSuggested();
}
if (!SettingsManager.contactIntegrationSuggested() && Application.getInstance().isContactsSupported()) {
if (AccountManager.getInstance().getAllAccounts().isEmpty()) {
SettingsManager.setContactIntegrationSuggested();
} else {
ContactIntegrationDialogFragment.newInstance().show(getFragmentManager(), "CONTACT_INTEGRATION");
}
}
}
}
use of com.xabber.xmpp.uri.XMPPUri in project xabber-android by redsolution.
the class ContactListActivity method onResume.
@Override
protected void onResume() {
super.onResume();
if (!AccountManager.getInstance().checkAccounts() && XabberAccountManager.getInstance().getAccount() == null) {
startActivity(TutorialActivity.createIntent(this));
finish();
return;
}
rebuildAccountToggle();
setStatusBarColor();
Application.getInstance().addUIListener(OnAccountChangedListener.class, this);
if (action != null) {
switch(action) {
case ContactListActivity.ACTION_ROOM_INVITE:
case Intent.ACTION_SEND:
case Intent.ACTION_SEND_MULTIPLE:
case ChatActivity.ACTION_FORWARD:
case Intent.ACTION_CREATE_SHORTCUT:
if (Intent.ACTION_SEND.equals(action)) {
sendText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
}
Toast.makeText(this, getString(R.string.select_contact), Toast.LENGTH_LONG).show();
break;
case Intent.ACTION_VIEW:
{
action = null;
Uri data = getIntent().getData();
if (data != null && "xmpp".equals(data.getScheme())) {
XMPPUri xmppUri;
try {
xmppUri = XMPPUri.parse(data);
} catch (IllegalArgumentException e) {
xmppUri = null;
}
if (xmppUri != null && "message".equals(xmppUri.getQueryType())) {
ArrayList<String> texts = xmppUri.getValues("body");
String text = null;
if (texts != null && !texts.isEmpty()) {
text = texts.get(0);
}
UserJid user = null;
try {
user = UserJid.from(xmppUri.getPath());
} catch (UserJid.UserJidCreateException e) {
LogManager.exception(this, e);
}
if (user != null) {
openChat(user, text);
}
}
}
break;
}
case Intent.ACTION_SENDTO:
{
action = null;
Uri data = getIntent().getData();
if (data != null) {
String path = data.getPath();
if (path != null && path.startsWith("/")) {
try {
UserJid user = UserJid.from(path.substring(1));
openChat(user, null);
} catch (UserJid.UserJidCreateException e) {
LogManager.exception(this, e);
}
}
}
break;
}
case ContactListActivity.ACTION_MUC_PRIVATE_CHAT_INVITE:
action = null;
showMucPrivateChatDialog();
break;
case ContactListActivity.ACTION_CONTACT_SUBSCRIPTION:
action = null;
showContactSubscriptionDialog();
break;
case ContactListActivity.ACTION_INCOMING_MUC_INVITE:
action = null;
showMucInviteDialog();
break;
}
}
if (Application.getInstance().doNotify()) {
if (!SettingsManager.isTranslationSuggested()) {
Locale currentLocale = getResources().getConfiguration().locale;
if (!currentLocale.getLanguage().equals("en") && !getResources().getBoolean(R.bool.is_translated)) {
new TranslationDialog().show(getFragmentManager(), "TRANSLATION_DIALOG");
}
}
}
showPassDialogs();
// showcase
if (!SettingsManager.contactShowcaseSuggested()) {
showShowcase(true);
}
// update crowdfunding info
CrowdfundingManager.getInstance().onLoad();
// remove all message notifications
MessageNotificationManager.getInstance().removeAllMessageNotifications();
}
Aggregations