make filtered list item activity survive roations
This commit is contained in:
parent
ccb47c5727
commit
0f39ad0f04
|
@ -112,7 +112,12 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void filterContacts() {
|
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);
|
protected abstract void filterContacts(final String needle);
|
||||||
|
|
|
@ -161,6 +161,10 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity {
|
||||||
|
|
||||||
protected void filterContacts(final String needle) {
|
protected void filterContacts(final String needle) {
|
||||||
getListItems().clear();
|
getListItems().clear();
|
||||||
|
if (xmppConnectionService == null) {
|
||||||
|
getListItemAdapter().notifyDataSetChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (final Account account : xmppConnectionService.getAccounts()) {
|
for (final Account account : xmppConnectionService.getAccounts()) {
|
||||||
if (account.getStatus() != Account.State.DISABLED) {
|
if (account.getStatus() != Account.State.DISABLED) {
|
||||||
for (final Contact contact : account.getRoster().getContacts()) {
|
for (final Contact contact : account.getRoster().getContacts()) {
|
||||||
|
@ -230,7 +234,6 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity {
|
||||||
@Override
|
@Override
|
||||||
void onBackendConnected() {
|
void onBackendConnected() {
|
||||||
filterContacts();
|
filterContacts();
|
||||||
|
|
||||||
this.mActivatedAccounts.clear();
|
this.mActivatedAccounts.clear();
|
||||||
for (Account account : xmppConnectionService.getAccounts()) {
|
for (Account account : xmppConnectionService.getAccounts()) {
|
||||||
if (account.getStatus() != Account.State.DISABLED) {
|
if (account.getStatus() != Account.State.DISABLED) {
|
||||||
|
|
Loading…
Reference in New Issue