aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/ui/NewConversationActivity.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-28 19:21:54 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-28 19:21:54 +0100
commit52da0fe7c9c68d4545f068fb84efbf0854c37392 (patch)
tree4c6bfae86fc90274b26e0c18ebd7793040663759 /src/de/gultsch/chat/ui/NewConversationActivity.java
parent4f902d8210d50a586c7ece1bb7da2ab26fd18da5 (diff)
account management
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/ui/NewConversationActivity.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/de/gultsch/chat/ui/NewConversationActivity.java b/src/de/gultsch/chat/ui/NewConversationActivity.java
index d3a3aa00..e30fcbb8 100644
--- a/src/de/gultsch/chat/ui/NewConversationActivity.java
+++ b/src/de/gultsch/chat/ui/NewConversationActivity.java
@@ -2,14 +2,13 @@ package de.gultsch.chat.ui;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import de.gultsch.chat.R;
import de.gultsch.chat.entities.Account;
import de.gultsch.chat.entities.Contact;
import de.gultsch.chat.entities.Conversation;
import de.gultsch.chat.persistance.DatabaseBackend;
+import de.gultsch.chat.utils.Validator;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.text.Editable;
@@ -36,9 +35,6 @@ public class NewConversationActivity extends XmppActivity {
final protected LinkedHashMap<Contact, View> availableJabberContacts = new LinkedHashMap<Contact, View>();
protected View newContactView;
protected Contact newContact;
-
- public static final Pattern VALID_JID =
- Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
static final String[] PROJECTION = new String[] {
ContactsContract.Data.CONTACT_ID,
@@ -181,8 +177,7 @@ public class NewConversationActivity extends XmppActivity {
}
LinearLayout createNewContact = (LinearLayout) findViewById(R.id.create_new_contact);
- Matcher matcher = VALID_JID.matcher(search);
- if (matcher.find()) {
+ if (Validator.isValidJid(search)) {
createNewContact.removeAllViews();
String name = search.split("@")[0];
newContact = new Contact(name,search,DEFAULT_PROFILE_PHOTO);
@@ -217,9 +212,10 @@ public class NewConversationActivity extends XmppActivity {
@Override
void onBackendConnected() {
-
- getActionBar().setDisplayHomeAsUpEnabled(false);
- getActionBar().setHomeButtonEnabled(false);
+ if (xmppConnectionService.getConversationCount()==0) {
+ getActionBar().setDisplayHomeAsUpEnabled(false);
+ getActionBar().setHomeButtonEnabled(false);
+ }
}
@Override