diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-09-04 21:04:07 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-09-04 21:04:07 +0200 |
commit | 1fbec382597eb9721b79aa5e801fce3a503c1d1f (patch) | |
tree | b2cfca402bfe18afff44fdbd1c23716c41f2accb /src/main/java | |
parent | a2058be1110e07fc196df47fa416d733b6b94b27 (diff) |
make filtered list item activity survive roations
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java b/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java index 768e738ba..df0708f7e 100644 --- a/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java +++ b/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java @@ -112,7 +112,12 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity { } protected void filterContacts() { - filterContacts(null); + final String needle = mSearchEditText != null ? mSearchEditText.getText().toString() : null; + if (needle != null && !needle.isEmpty()) { + filterContacts(needle); + } else { + filterContacts(null); + } } protected abstract void filterContacts(final String needle); diff --git a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java index 86f7902c9..9d51a1c1d 100644 --- a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java @@ -161,6 +161,10 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity { protected void filterContacts(final String needle) { getListItems().clear(); + if (xmppConnectionService == null) { + getListItemAdapter().notifyDataSetChanged(); + return; + } for (final Account account : xmppConnectionService.getAccounts()) { if (account.getStatus() != Account.State.DISABLED) { for (final Contact contact : account.getRoster().getContacts()) { |