diff options
Diffstat (limited to 'src/eu/siacs/conversations/utils')
-rw-r--r-- | src/eu/siacs/conversations/utils/KnownHostsAdapter.java | 69 | ||||
-rw-r--r-- | src/eu/siacs/conversations/utils/UIHelper.java | 1 |
2 files changed, 0 insertions, 70 deletions
diff --git a/src/eu/siacs/conversations/utils/KnownHostsAdapter.java b/src/eu/siacs/conversations/utils/KnownHostsAdapter.java deleted file mode 100644 index a0a223dda..000000000 --- a/src/eu/siacs/conversations/utils/KnownHostsAdapter.java +++ /dev/null @@ -1,69 +0,0 @@ -package eu.siacs.conversations.utils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -import android.content.Context; -import android.widget.ArrayAdapter; -import android.widget.Filter; - -public class KnownHostsAdapter extends ArrayAdapter<String> { - private ArrayList<String> domains; - private Filter domainFilter = new Filter() { - - @Override - protected FilterResults performFiltering(CharSequence constraint) { - if (constraint != null) { - ArrayList<String> suggestions = new ArrayList<String>(); - final String[] split = constraint.toString().split("@"); - if (split.length == 1) { - for (String domain : domains) { - suggestions.add(split[0].toLowerCase(Locale.getDefault()) + "@" + domain); - } - } else if (split.length == 2) { - for (String domain : domains) { - if (domain.contains(split[1])) { - suggestions.add(split[0].toLowerCase(Locale.getDefault()) + "@" + domain); - } - } - } else { - return new FilterResults(); - } - FilterResults filterResults = new FilterResults(); - filterResults.values = suggestions; - filterResults.count = suggestions.size(); - return filterResults; - } else { - return new FilterResults(); - } - } - - @Override - protected void publishResults(CharSequence constraint, - FilterResults results) { - ArrayList<String> filteredList = ((ArrayList<String>) results.values); - if (results != null && results.count > 0) { - clear(); - for (String c : filteredList) { - add(c); - } - notifyDataSetChanged(); - } - } - }; - - public KnownHostsAdapter(Context context, int viewResourceId, - List<String> mKnownHosts) { - super(context, viewResourceId, mKnownHosts); - domains = new ArrayList<String>(mKnownHosts.size()); - for (String domain : mKnownHosts) { - domains.add(new String(domain)); - } - } - - @Override - public Filter getFilter() { - return domainFilter; - } -}
\ No newline at end of file diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 4e902817d..1cd3403c6 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -13,7 +13,6 @@ import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; -import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.MucOptions.User; import eu.siacs.conversations.ui.ConversationActivity; |