aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/entities/PresenceTemplate.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java24
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java27
-rw-r--r--src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java19
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/KnownHostsAdapter.java252
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/PresenceTemplateAdapter.java92
-rw-r--r--src/main/java/de/pixart/messenger/ui/widget/ImmediateAutoCompleteTextView.java48
7 files changed, 304 insertions, 163 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/PresenceTemplate.java b/src/main/java/de/pixart/messenger/entities/PresenceTemplate.java
index ab71a41fd..1a210eda8 100644
--- a/src/main/java/de/pixart/messenger/entities/PresenceTemplate.java
+++ b/src/main/java/de/pixart/messenger/entities/PresenceTemplate.java
@@ -73,4 +73,9 @@ public class PresenceTemplate extends AbstractEntity {
result = 31 * result + status.hashCode();
return result;
}
+
+ @Override
+ public String toString() {
+ return statusMessage;
+ }
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 4ddc318ab..8fab4031f 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1113,24 +1113,16 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
}
Account account = message.getConversation().getAccount();
- Intent intent;
- if (activity.manuallyChangePresence() && !received) {
- intent = new Intent(activity, SetPresenceActivity.class);
- intent.putExtra(EXTRA_ACCOUNT, account.getJid().toBareJid().toString());
+ Intent intent = new Intent(activity, EditAccountActivity.class);
+ intent.putExtra("jid", account.getJid().toBareJid().toString());
+ String fingerprint;
+ if (message.getEncryption() == Message.ENCRYPTION_PGP
+ || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
+ fingerprint = "pgp";
} else {
- intent = new Intent(activity, EditAccountActivity.class);
- intent.putExtra("jid", account.getJid().toBareJid().toString());
- String fingerprint;
- if (message.getEncryption() == Message.ENCRYPTION_PGP
- || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
- fingerprint = "pgp";
- } else if (message.getEncryption() == Message.ENCRYPTION_OTR) {
- fingerprint = "otr";
- } else {
- fingerprint = message.getFingerprint();
- }
- intent.putExtra("fingerprint", fingerprint);
+ fingerprint = message.getFingerprint();
}
+ intent.putExtra("fingerprint", fingerprint);
startActivity(intent);
});
messageListAdapter.setOnContactPictureLongClicked(message -> {
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index a1a1956bc..a24dd3691 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -10,6 +10,7 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
+import android.preference.PreferenceManager;
import android.provider.Settings;
import android.security.KeyChain;
import android.security.KeyChainAliasCallback;
@@ -19,6 +20,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.TextWatcher;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -50,12 +52,15 @@ import de.pixart.messenger.R;
import de.pixart.messenger.crypto.axolotl.AxolotlService;
import de.pixart.messenger.crypto.axolotl.XmppAxolotlSession;
import de.pixart.messenger.databinding.ActivityEditAccountBinding;
+import de.pixart.messenger.databinding.DialogPresenceBinding;
import de.pixart.messenger.entities.Account;
+import de.pixart.messenger.entities.PresenceTemplate;
import de.pixart.messenger.services.BarcodeProvider;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.services.XmppConnectionService.OnAccountUpdate;
import de.pixart.messenger.services.XmppConnectionService.OnCaptchaRequested;
import de.pixart.messenger.ui.adapter.KnownHostsAdapter;
+import de.pixart.messenger.ui.adapter.PresenceTemplateAdapter;
import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.utils.XmppUri;
@@ -637,7 +642,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
reconnect.setVisible(true);
announcePGP.setVisible(true);
mamPrefs.setVisible(mAccount.getXmppConnection().getFeatures().mam());
- changePresence.setVisible(manuallyChangePresence());
+ changePresence.setVisible(true);
} else {
announcePGP.setVisible(false);
reconnect.setVisible(false);
@@ -878,9 +883,23 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
private void changePresence() {
- Intent intent = new Intent(this, SetPresenceActivity.class);
- intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT, mAccount.getJid().toBareJid().toString());
- startActivity(intent);
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean manualStatus = sharedPreferences.getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, getResources().getBoolean(R.bool.manually_change_presence));
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final DialogPresenceBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_presence, null, false);
+ binding.show.setVisibility(manualStatus ? View.VISIBLE : View.GONE);
+ List<PresenceTemplate> templates = xmppConnectionService.getPresenceTemplates(mAccount);
+ PresenceTemplateAdapter presenceTemplateAdapter = new PresenceTemplateAdapter(this, R.layout.simple_list_item, templates);
+ binding.statusMessage.setAdapter(presenceTemplateAdapter);
+ binding.statusMessage.setOnItemClickListener((parent, view, position, id) -> {
+ PresenceTemplate template = (PresenceTemplate) parent.getItemAtPosition(position);
+ Log.d(Config.LOGTAG, "selected: " + template.getStatusMessage());
+ });
+ builder.setTitle(R.string.change_presence);
+ builder.setView(binding.getRoot());
+ builder.setNegativeButton(R.string.cancel, null);
+ builder.setPositiveButton(R.string.confirm, null);
+ builder.create().show();
}
@Override
diff --git a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
index 3c1b58fc0..253dccd1c 100644
--- a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
@@ -127,12 +127,10 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
this.selectedAccount = accountList.get(acmi.position);
if (this.selectedAccount.isEnabled()) {
menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(Config.supportOpenPgp());
- menu.findItem(R.id.mgmt_account_change_presence).setVisible(manuallyChangePresence());
} else {
menu.findItem(R.id.mgmt_account_reconnect).setVisible(false);
menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(false);
menu.findItem(R.id.mgmt_account_publish_avatar).setVisible(false);
- menu.findItem(R.id.mgmt_account_change_presence).setVisible(false);
}
menu.setHeaderTitle(this.selectedAccount.getJid().toBareJid().toString());
}
@@ -182,9 +180,6 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
case R.id.mgmt_account_announce_pgp:
publishOpenPGPPublicKey(selectedAccount);
return true;
- case R.id.mgmt_account_change_presence:
- changePresence(selectedAccount);
- return true;
default:
return super.onContextItemSelected(item);
}
@@ -227,20 +222,6 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
}
}
- private void changePresence(Account account) {
- Intent intent = new Intent(this, SetPresenceActivity.class);
- intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT, account.getJid().toBareJid().toString());
- startActivity(intent);
- }
-
- public void onClickTglAccountState(Account account, boolean enable) {
- if (enable) {
- enableAccount(account);
- } else {
- disableAccount(account);
- }
- }
-
private void addAccountFromKey() {
try {
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/KnownHostsAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/KnownHostsAdapter.java
index 5bd9c9c17..56e9f63b0 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/KnownHostsAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/KnownHostsAdapter.java
@@ -1,6 +1,7 @@
package de.pixart.messenger.ui.adapter;
import android.content.Context;
+import android.support.annotation.NonNull;
import android.widget.ArrayAdapter;
import android.widget.Filter;
@@ -47,10 +48,9 @@ public class KnownHostsAdapter extends ArrayAdapter<String> {
}
@Override
- protected void publishResults(CharSequence constraint,
- FilterResults results) {
+ protected void publishResults(CharSequence constraint, FilterResults results) {
ArrayList filteredList = (ArrayList) results.values;
- if (results != null && results.count > 0) {
+ if (results.count > 0) {
clear();
for (Object c : filteredList) {
add((String) c);
@@ -62,6 +62,7 @@ public class KnownHostsAdapter extends ArrayAdapter<String> {
public KnownHostsAdapter(Context context, int viewResourceId, List<String> mKnownHosts) {
super(context, viewResourceId, new ArrayList<>());
+
if (mKnownHosts == null) {
domains = new ArrayList<>();
} else {
@@ -70,131 +71,134 @@ public class KnownHostsAdapter extends ArrayAdapter<String> {
HashSet<String> hashSet = new HashSet<>();
// get servers from https://conversations.im/compliance/
- domains.add("pix-art.de");
- domains.add("conversations.im");
- domains.add("jabber.cat");
- domains.add("jabjab.de");
- domains.add("im.koderoot.net");
- domains.add("riotcat.org");
- domains.add("magicbroccoli.de");
- domains.add("kode.im");
- domains.add("jabber-germany.de");
- domains.add("simplewire.de");
- domains.add("suchat.org");
- domains.add("jabber.at");
- domains.add("trashserver.net");
- domains.add("wiuwiu.de");
- domains.add("5222.de");
- domains.add("dismail.de");
- domains.add("chat.sum7.eu");
- domains.add("xmpp.zone");
- domains.add("libranet.de");
- domains.add("laborversuch.de");
- domains.add("creep.im");
- domains.add("jabber.systemausfall.org");
- domains.add("jabber.hot-chilli.net");
- domains.add("jabber.fr");
- domains.add("jabber.de");
- domains.add("draugr.de");
- domains.add("elaon.de");
- domains.add("high-way.me");
- domains.add("jabber.rwth-aachen.de");
- domains.add("deshalbfrei.org");
- domains.add("mail.de");
- domains.add("bommboo.de");
- domains.add("jabber.systemli.org");
- domains.add("jabb.im");
- domains.add("mailbox.org");
- domains.add("hot-chilli.net");
- domains.add("jabberpl.org");
- domains.add("chinwag.im");
- domains.add("tchncs.de");
- domains.add("zsim.de");
- domains.add("patchcord.be");
- domains.add("gajim.org");
- domains.add("talker.to");
- domains.add("pimux.de");
- domains.add("jabber.home.vdlinde.org");
- domains.add("im.apinc.org");
- domains.add("chatme.im");
- domains.add("fusselkater.org");
- domains.add("datenknoten.me");
- domains.add("fysh.in");
- domains.add("jabber.chaos-darmstadt.de");
- domains.add("yax.im");
- domains.add("neko.im");
- domains.add("jabberzac.org");
- domains.add("xmpp.is");
- domains.add("home.zom.im");
- domains.add("jabber.ccc.de");
- domains.add("jwchat.org");
- domains.add("kdetalk.net");
- domains.add("kde.org");
- domains.add("riseup.net");
- domains.add("ruhr-uni-bochum.de");
- domains.add("njs.netlab.cz");
- domains.add("schokokeks.org");
- domains.add("jabber.cz");
- domains.add("ubuntu-jabber.de");
- domains.add("xabber.de");
- domains.add("ubuntu-jabber.net");
- domains.add("jabber.ru");
- domains.add("darknet.nz");
- domains.add("movim.eu");
- domains.add("404.city");
- domains.add("igniterealtime.org");
- domains.add("kapsi.fi");
- domains.add("jabbel.net");
- domains.add("joindiaspora.com");
- domains.add("alpha-labs.net");
- domains.add("xmppnet.de");
- domains.add("hoth.one");
- domains.add("blah.im");
- domains.add("xmpp.jp");
- domains.add("jabber.uni-mainz.de");
- domains.add("richim.org");
- domains.add("tigase.im");
- domains.add("jappix.com");
- domains.add("member.fsf.org");
- domains.add("jabber.rueckgr.at");
- domains.add("swissjabber.ch");
- domains.add("twattle.net");
- domains.add("jabber.calyxinstitute.org");
- domains.add("sapo.pt");
- domains.add("uprod.biz");
- domains.add("krautspace.de");
- domains.add("kraut.space");
- domains.add("null.pm");
- domains.add("anonymitaet-im-inter.net");
- domains.add("0nl1ne.at");
- domains.add("linuxlovers.at");
- domains.add("jabber.org");
- domains.add("jabber.no-sense.net");
- domains.add("swissjabber.eu");
- domains.add("swissjabber.org");
- domains.add("swissjabber.de");
- domains.add("swissjabber.li");
- domains.add("jabber.no");
- domains.add("cypherpunks.it");
- domains.add("adastra.re");
- domains.add("jabber-br.org");
- domains.add("einfachjabber.de");
- domains.add("jabber.smash-net.org");
- domains.add("freifunk.im");
- domains.add("openmailbox.org");
- domains.add("jabber.otr.im");
- domains.add("evil.im");
- domains.add("xmpp.slack.com");
- domains.add("chat.hipchat.com");
- domains.add("googlemail.com");
+ new Thread(() -> {
+ domains.add("pix-art.de");
+ domains.add("conversations.im");
+ domains.add("jabber.cat");
+ domains.add("jabjab.de");
+ domains.add("im.koderoot.net");
+ domains.add("riotcat.org");
+ domains.add("magicbroccoli.de");
+ domains.add("kode.im");
+ domains.add("jabber-germany.de");
+ domains.add("simplewire.de");
+ domains.add("suchat.org");
+ domains.add("jabber.at");
+ domains.add("trashserver.net");
+ domains.add("wiuwiu.de");
+ domains.add("5222.de");
+ domains.add("dismail.de");
+ domains.add("chat.sum7.eu");
+ domains.add("xmpp.zone");
+ domains.add("libranet.de");
+ domains.add("laborversuch.de");
+ domains.add("creep.im");
+ domains.add("jabber.systemausfall.org");
+ domains.add("jabber.hot-chilli.net");
+ domains.add("jabber.fr");
+ domains.add("jabber.de");
+ domains.add("draugr.de");
+ domains.add("elaon.de");
+ domains.add("high-way.me");
+ domains.add("jabber.rwth-aachen.de");
+ domains.add("deshalbfrei.org");
+ domains.add("mail.de");
+ domains.add("bommboo.de");
+ domains.add("jabber.systemli.org");
+ domains.add("jabb.im");
+ domains.add("mailbox.org");
+ domains.add("hot-chilli.net");
+ domains.add("jabberpl.org");
+ domains.add("chinwag.im");
+ domains.add("tchncs.de");
+ domains.add("zsim.de");
+ domains.add("patchcord.be");
+ domains.add("gajim.org");
+ domains.add("talker.to");
+ domains.add("pimux.de");
+ domains.add("jabber.home.vdlinde.org");
+ domains.add("im.apinc.org");
+ domains.add("chatme.im");
+ domains.add("fusselkater.org");
+ domains.add("datenknoten.me");
+ domains.add("fysh.in");
+ domains.add("jabber.chaos-darmstadt.de");
+ domains.add("yax.im");
+ domains.add("neko.im");
+ domains.add("jabberzac.org");
+ domains.add("xmpp.is");
+ domains.add("home.zom.im");
+ domains.add("jabber.ccc.de");
+ domains.add("jwchat.org");
+ domains.add("kdetalk.net");
+ domains.add("kde.org");
+ domains.add("riseup.net");
+ domains.add("ruhr-uni-bochum.de");
+ domains.add("njs.netlab.cz");
+ domains.add("schokokeks.org");
+ domains.add("jabber.cz");
+ domains.add("ubuntu-jabber.de");
+ domains.add("xabber.de");
+ domains.add("ubuntu-jabber.net");
+ domains.add("jabber.ru");
+ domains.add("darknet.nz");
+ domains.add("movim.eu");
+ domains.add("404.city");
+ domains.add("igniterealtime.org");
+ domains.add("kapsi.fi");
+ domains.add("jabbel.net");
+ domains.add("joindiaspora.com");
+ domains.add("alpha-labs.net");
+ domains.add("xmppnet.de");
+ domains.add("hoth.one");
+ domains.add("blah.im");
+ domains.add("xmpp.jp");
+ domains.add("jabber.uni-mainz.de");
+ domains.add("richim.org");
+ domains.add("tigase.im");
+ domains.add("jappix.com");
+ domains.add("member.fsf.org");
+ domains.add("jabber.rueckgr.at");
+ domains.add("swissjabber.ch");
+ domains.add("twattle.net");
+ domains.add("jabber.calyxinstitute.org");
+ domains.add("sapo.pt");
+ domains.add("uprod.biz");
+ domains.add("krautspace.de");
+ domains.add("kraut.space");
+ domains.add("null.pm");
+ domains.add("anonymitaet-im-inter.net");
+ domains.add("0nl1ne.at");
+ domains.add("linuxlovers.at");
+ domains.add("jabber.org");
+ domains.add("jabber.no-sense.net");
+ domains.add("swissjabber.eu");
+ domains.add("swissjabber.org");
+ domains.add("swissjabber.de");
+ domains.add("swissjabber.li");
+ domains.add("jabber.no");
+ domains.add("cypherpunks.it");
+ domains.add("adastra.re");
+ domains.add("jabber-br.org");
+ domains.add("einfachjabber.de");
+ domains.add("jabber.smash-net.org");
+ domains.add("freifunk.im");
+ domains.add("openmailbox.org");
+ domains.add("jabber.otr.im");
+ domains.add("evil.im");
+ domains.add("xmpp.slack.com");
+ domains.add("chat.hipchat.com");
+ domains.add("googlemail.com");
- hashSet.addAll(domains);
- domains.clear();
- domains.addAll(hashSet);
- Collections.sort(domains, String::compareToIgnoreCase);
+ hashSet.addAll(domains);
+ domains.clear();
+ domains.addAll(hashSet);
+ Collections.sort(domains, String::compareToIgnoreCase);
+ }).start();
}
@Override
+ @NonNull
public Filter getFilter() {
return domainFilter;
}
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/PresenceTemplateAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/PresenceTemplateAdapter.java
new file mode 100644
index 000000000..8fe84af5b
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/adapter/PresenceTemplateAdapter.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package de.pixart.messenger.ui.adapter;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.widget.ArrayAdapter;
+import android.widget.Filter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import de.pixart.messenger.entities.PresenceTemplate;
+
+
+public class PresenceTemplateAdapter extends ArrayAdapter<PresenceTemplate> {
+
+ private final List<PresenceTemplate> templates;
+
+ private final Filter filter = new Filter() {
+
+ @Override
+ protected FilterResults performFiltering(CharSequence constraint) {
+ FilterResults results = new FilterResults();
+ if (constraint == null || constraint.length() == 0) {
+ results.values = new ArrayList<>(templates);
+ results.count = templates.size();
+ } else {
+ ArrayList<PresenceTemplate> suggestions = new ArrayList<>();
+ final String needle = constraint.toString().trim().toLowerCase(Locale.getDefault());
+ for (PresenceTemplate template : templates) {
+ final String lc = template.getStatusMessage().toLowerCase(Locale.getDefault());
+ if (needle.isEmpty() || lc.contains(needle)) {
+ suggestions.add(template);
+ }
+ }
+ results.values = suggestions;
+ results.count = suggestions.size();
+ }
+ return results;
+ }
+
+ @Override
+ protected void publishResults(CharSequence constraint, FilterResults results) {
+ ArrayList filteredList = (ArrayList) results.values;
+ clear();
+ for (Object c : filteredList) {
+ add((PresenceTemplate) c);
+ }
+ notifyDataSetChanged();
+ }
+ };
+
+ public PresenceTemplateAdapter(@NonNull Context context, int resource, @NonNull List<PresenceTemplate> templates) {
+ super(context, resource, new ArrayList<>());
+ this.templates = new ArrayList<>(templates);
+ }
+
+ @Override
+ @NonNull
+ public Filter getFilter() {
+ return this.filter;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/ui/widget/ImmediateAutoCompleteTextView.java b/src/main/java/de/pixart/messenger/ui/widget/ImmediateAutoCompleteTextView.java
new file mode 100644
index 000000000..3cdfffabe
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/ui/widget/ImmediateAutoCompleteTextView.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.pixart.messenger.ui.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+public class ImmediateAutoCompleteTextView extends android.support.v7.widget.AppCompatAutoCompleteTextView {
+
+ public ImmediateAutoCompleteTextView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public ImmediateAutoCompleteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ public boolean enoughToFilter() {
+ return true;
+ }
+} \ No newline at end of file