aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml10
-rw-r--r--README.md1
-rw-r--r--res/layout/dialog_verify_otr.xml2
-rw-r--r--res/layout/fragment_conversation.xml2
-rw-r--r--res/values-de/arrays.xml7
-rw-r--r--res/values-de/strings.xml2
-rw-r--r--res/values-iw/arrays.xml (renamed from res/values-he/arrays.xml)0
-rw-r--r--res/values-iw/strings.xml (renamed from res/values-he/strings.xml)0
-rw-r--r--src/eu/siacs/conversations/entities/Roster.java13
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java21
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java3
-rw-r--r--src/eu/siacs/conversations/ui/StartConversationActivity.java82
-rw-r--r--src/eu/siacs/conversations/ui/XmppActivity.java1
13 files changed, 121 insertions, 23 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 33dcdfa4..d86d5bb1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -63,6 +63,14 @@
<data android:scheme="imto" />
<data android:host="jabber" />
</intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data android:scheme="xmpp" />
+ </intent-filter>
</activity>
<activity
android:name="eu.siacs.conversations.ui.SettingsActivity"
@@ -117,4 +125,4 @@
<activity android:name="de.duenndns.ssl.MemorizingActivity" />
</application>
-</manifest>
+</manifest> \ No newline at end of file
diff --git a/README.md b/README.md
index ec510c15..99f5f429 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,7 @@ These XEPs are - as of now:
* [Ilia Rostovtsev](https://github.com/qooob) (Russian)
* [Jelmer Vernooij](https://github.com/jelmer) (Dutch)
* [Anders Sandblad](https://github.com/andersruneson) (Swedish)
+* [Aizaz AZ](http://www.linkedin.com/in/aizazhaider) (Chinese)
##FAQ
###General
diff --git a/res/layout/dialog_verify_otr.xml b/res/layout/dialog_verify_otr.xml
index 831f06ed..499ef6cd 100644
--- a/res/layout/dialog_verify_otr.xml
+++ b/res/layout/dialog_verify_otr.xml
@@ -11,7 +11,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
- android:text="Jabber ID"
+ android:text="@string/account_settings_jabber_id"
android:textColor="@color/primarytext"
android:textSize="?attr/TextSizeHeadline" />
diff --git a/res/layout/fragment_conversation.xml b/res/layout/fragment_conversation.xml
index 0f5f692e..f9aae10a 100644
--- a/res/layout/fragment_conversation.xml
+++ b/res/layout/fragment_conversation.xml
@@ -37,7 +37,7 @@
android:layout_toLeftOf="@+id/textSendButton"
android:background="@color/primarybackground"
android:ems="10"
- android:imeOptions="flagNoExtractUi"
+ android:imeOptions="flagNoExtractUi|actionSend"
android:inputType="textShortMessage|textMultiLine|textCapSentences"
android:minHeight="48dp"
android:minLines="1"
diff --git a/res/values-de/arrays.xml b/res/values-de/arrays.xml
index e468f478..9b429c5a 100644
--- a/res/values-de/arrays.xml
+++ b/res/values-de/arrays.xml
@@ -20,5 +20,12 @@
<item>524288</item>
<item>1048576</item>
</string-array>
+ <string-array name="mute_options_descriptions">
+ <item>30 Minuten</item>
+ <item>eine Stunde</item>
+ <item>2 Stunden</item>
+ <item>8 Stunden</item>
+ <item>bis auf Widerruf</item>
+ </string-array>
</resources> \ No newline at end of file
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 14397e16..0c230ec6 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -259,5 +259,7 @@
<string name="pref_use_send_button_to_indicate_status">Absende-Knopf zeigt Online-Status an</string>
<string name="pref_use_send_button_to_indicate_status_summary">Absende-Knopf einfärben, um den Online-Status des Kontakts zu signalisieren</string>
<string name="pref_expert_options_other">Sonstiges</string>
+ <string name="pref_conference_name">Konferenz-Name</string>
+ <string name="pref_conference_name_summary">Konferenz-Thema statt Raum-JID als Name verwenden</string>
</resources>
diff --git a/res/values-he/arrays.xml b/res/values-iw/arrays.xml
index 28768d6c..28768d6c 100644
--- a/res/values-he/arrays.xml
+++ b/res/values-iw/arrays.xml
diff --git a/res/values-he/strings.xml b/res/values-iw/strings.xml
index fd8eaa0b..fd8eaa0b 100644
--- a/res/values-he/strings.xml
+++ b/res/values-iw/strings.xml
diff --git a/src/eu/siacs/conversations/entities/Roster.java b/src/eu/siacs/conversations/entities/Roster.java
index f11f0250..b6908793 100644
--- a/src/eu/siacs/conversations/entities/Roster.java
+++ b/src/eu/siacs/conversations/entities/Roster.java
@@ -14,13 +14,18 @@ public class Roster {
this.account = account;
}
- public boolean hasContact(String jid) {
- String cleanJid = jid.split("/",2)[0];
- return contacts.containsKey(cleanJid);
+ public Contact getContactAsShownInRoster(String jid) {
+ String cleanJid = jid.split("/", 2)[0];
+ Contact contact = contacts.get(cleanJid);
+ if (contact != null && contact.showInRoster()) {
+ return contact;
+ } else {
+ return null;
+ }
}
public Contact getContact(String jid) {
- String cleanJid = jid.split("/",2)[0].toLowerCase(Locale.getDefault());
+ String cleanJid = jid.split("/", 2)[0].toLowerCase(Locale.getDefault());
if (contacts.containsKey(cleanJid)) {
return contacts.get(cleanJid);
} else {
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index db3ee2b9..524a3bd7 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -824,7 +824,7 @@ public class XmppConnectionService extends Service {
}
});
}
-
+
public int loadMoreMessages(Conversation conversation, long timestamp) {
List<Message> messages = databaseBackend.getMessages(conversation, 50,
timestamp);
@@ -851,8 +851,9 @@ public class XmppConnectionService extends Service {
public Conversation find(List<Conversation> haystack, Account account,
String jid) {
for (Conversation conversation : haystack) {
- if ((conversation.getAccount().equals(account))
- && (conversation.getContactJid().split("/",2)[0].equals(jid))) {
+ if ((account == null || conversation.getAccount().equals(account))
+ && (conversation.getContactJid().split("/", 2)[0]
+ .equals(jid))) {
return conversation;
}
}
@@ -1742,4 +1743,18 @@ public class XmppConnectionService extends Service {
public interface OnRosterUpdate {
public void onRosterUpdate();
}
+
+ public List<Contact> findContacts(String jid) {
+ ArrayList<Contact> contacts = new ArrayList<Contact>();
+ for (Account account : getAccounts()) {
+ if (!account.isOptionSet(Account.OPTION_DISABLED)) {
+ Contact contact = account.getRoster()
+ .getContactAsShownInRoster(jid);
+ if (contact != null) {
+ contacts.add(contact);
+ }
+ }
+ }
+ return contacts;
+ }
}
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index feed9df5..9e2d39e5 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -76,10 +76,11 @@ public class ConversationFragment extends Fragment {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if (actionId == EditorInfo.IME_ACTION_DONE) {
+ if (actionId == EditorInfo.IME_ACTION_SEND) {
InputMethodManager imm = (InputMethodManager) v.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
+ sendMessage();
return true;
} else {
return false;
diff --git a/src/eu/siacs/conversations/ui/StartConversationActivity.java b/src/eu/siacs/conversations/ui/StartConversationActivity.java
index db6c1509..612dd585 100644
--- a/src/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/eu/siacs/conversations/ui/StartConversationActivity.java
@@ -1,5 +1,7 @@
package eu.siacs.conversations.ui;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -14,6 +16,8 @@ import android.app.ListFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
+import android.content.Intent;
+import android.net.Uri;
import android.os.Bundle;
import android.support.v13.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
@@ -157,6 +161,8 @@ public class StartConversationActivity extends XmppActivity {
});
}
};
+ private MenuItem mMenuSearchView;
+ private String mInitialJid;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -308,7 +314,7 @@ public class StartConversationActivity extends XmppActivity {
}
- protected void showCreateContactDialog() {
+ protected void showCreateContactDialog(String prefilledJid) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.create_contact);
View dialogView = getLayoutInflater().inflate(
@@ -317,7 +323,10 @@ public class StartConversationActivity extends XmppActivity {
final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView
.findViewById(R.id.jid);
jid.setAdapter(new KnownHostsAdapter(this,
- android.R.layout.simple_list_item_1, mKnownHosts));
+ android.R.layout.simple_list_item_1, mKnownHosts));
+ if (prefilledJid!=null) {
+ jid.append(prefilledJid);
+ }
populateAccountSpinner(spinner);
builder.setView(dialogView);
builder.setNegativeButton(R.string.cancel, null);
@@ -449,9 +458,9 @@ public class StartConversationActivity extends XmppActivity {
.findItem(R.id.action_create_contact);
MenuItem menuCreateConference = (MenuItem) menu
.findItem(R.id.action_join_conference);
- MenuItem menuSearchView = (MenuItem) menu.findItem(R.id.action_search);
- menuSearchView.setOnActionExpandListener(mOnActionExpandListener);
- View mSearchView = menuSearchView.getActionView();
+ mMenuSearchView = (MenuItem) menu.findItem(R.id.action_search);
+ mMenuSearchView.setOnActionExpandListener(mOnActionExpandListener);
+ View mSearchView = mMenuSearchView.getActionView();
mSearchEditText = (EditText) mSearchView
.findViewById(R.id.search_field);
mSearchEditText.addTextChangedListener(mSearchTextWatcher);
@@ -460,6 +469,11 @@ public class StartConversationActivity extends XmppActivity {
} else {
menuCreateContact.setVisible(false);
}
+ if (mInitialJid != null) {
+ mMenuSearchView.expandActionView();
+ mSearchEditText.append(mInitialJid);
+ filter(mInitialJid);
+ }
return true;
}
@@ -467,7 +481,7 @@ public class StartConversationActivity extends XmppActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_create_contact:
- showCreateContactDialog();
+ showCreateContactDialog(null);
break;
case R.id.action_join_conference:
showJoinConferenceDialog();
@@ -486,13 +500,8 @@ public class StartConversationActivity extends XmppActivity {
}
@Override
- void onBackendConnected() {
+ protected void onBackendConnected() {
xmppConnectionService.setOnRosterUpdateListener(this.onRosterUpdate);
- if (mSearchEditText != null) {
- filter(mSearchEditText.getText().toString());
- } else {
- filter(null);
- }
this.mActivatedAccounts.clear();
for (Account account : xmppConnectionService.getAccounts()) {
if (account.getStatus() != Account.STATUS_DISABLED) {
@@ -502,6 +511,55 @@ public class StartConversationActivity extends XmppActivity {
this.mKnownHosts = xmppConnectionService.getKnownHosts();
this.mKnownConferenceHosts = xmppConnectionService
.getKnownConferenceHosts();
+ if (!startByIntent()) {
+ if (mSearchEditText != null) {
+ filter(mSearchEditText.getText().toString());
+ } else {
+ filter(null);
+ }
+ }
+ }
+
+ protected boolean startByIntent() {
+ if (getIntent() != null
+ && Intent.ACTION_SENDTO.equals(getIntent().getAction())) {
+ try {
+ String jid = URLDecoder.decode(
+ getIntent().getData().getEncodedPath(), "UTF-8").split(
+ "/")[1];
+ setIntent(null);
+ return handleJid(jid);
+ } catch (UnsupportedEncodingException e) {
+ setIntent(null);
+ return false;
+ }
+ } else if (getIntent() != null && Intent.ACTION_VIEW.equals(getIntent().getAction())) {
+ Uri uri = getIntent().getData();
+ String jid = uri.getSchemeSpecificPart().split("\\?")[0];
+ return handleJid(jid);
+ }
+ return false;
+ }
+
+ private boolean handleJid(String jid) {
+ List<Contact> contacts = xmppConnectionService
+ .findContacts(jid);
+ if (contacts.size() == 0) {
+ showCreateContactDialog(jid);
+ return false;
+ } else if (contacts.size() == 1) {
+ switchToConversation(contacts.get(0));
+ return true;
+ } else {
+ if (mMenuSearchView != null) {
+ mMenuSearchView.expandActionView();
+ mSearchEditText.setText(jid);
+ filter(jid);
+ } else {
+ mInitialJid = jid;
+ }
+ return true;
+ }
}
protected void filter(String needle) {
diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java
index 26a33d1a..63dbdd11 100644
--- a/src/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/eu/siacs/conversations/ui/XmppActivity.java
@@ -245,6 +245,7 @@ public abstract class XmppActivity extends Activity {
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
startActivity(viewConversationIntent);
+ finish();
}
public void switchToContactDetails(Contact contact) {