port all android drop down list items to our own

This commit is contained in:
Daniel Gultsch 2016-04-29 13:48:30 +02:00
parent 6d9ca25915
commit c7882b7225
3 changed files with 9 additions and 10 deletions

View file

@ -593,7 +593,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
} }
if (Config.DOMAIN_LOCK == null) { if (Config.DOMAIN_LOCK == null) {
final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this, final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this,
android.R.layout.simple_list_item_1, R.layout.simple_list_item,
xmppConnectionService.getKnownHosts()); xmppConnectionService.getKnownHosts());
this.mAccountJid.setAdapter(mKnownHostsAdapter); this.mAccountJid.setAdapter(mKnownHostsAdapter);
} }

View file

@ -50,7 +50,7 @@ public class EnterJidDialog {
jabberIdDesc.setText(R.string.account_settings_jabber_id); jabberIdDesc.setText(R.string.account_settings_jabber_id);
final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account); final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account);
final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid); final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid);
jid.setAdapter(new KnownHostsAdapter(context, android.R.layout.simple_list_item_1, knownHosts)); jid.setAdapter(new KnownHostsAdapter(context, R.layout.simple_list_item, knownHosts));
if (prefilledJid != null) { if (prefilledJid != null) {
jid.append(prefilledJid); jid.append(prefilledJid);
if (!allowEditJid) { if (!allowEditJid) {
@ -67,10 +67,10 @@ public class EnterJidDialog {
StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner); StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner);
} else { } else {
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, ArrayAdapter<String> adapter = new ArrayAdapter<>(context,
android.R.layout.simple_spinner_item, R.layout.simple_list_item,
new String[] { account }); new String[] { account });
spinner.setEnabled(false); spinner.setEnabled(false);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(R.layout.simple_list_item);
spinner.setAdapter(adapter); spinner.setAdapter(adapter);
} }

View file

@ -393,7 +393,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id); final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id);
jabberIdDesc.setText(R.string.conference_address); jabberIdDesc.setText(R.string.conference_address);
jid.setHint(R.string.conference_address_example); jid.setHint(R.string.conference_address_example);
jid.setAdapter(new KnownHostsAdapter(this, android.R.layout.simple_list_item_1, mKnownConferenceHosts)); jid.setAdapter(new KnownHostsAdapter(this, R.layout.simple_list_item, mKnownConferenceHosts));
if (prefilledJid != null) { if (prefilledJid != null) {
jid.append(prefilledJid); jid.append(prefilledJid);
} }
@ -487,16 +487,15 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
public static void populateAccountSpinner(Context context, List<String> accounts, Spinner spinner) { public static void populateAccountSpinner(Context context, List<String> accounts, Spinner spinner) {
if (accounts.size() > 0) { if (accounts.size() > 0) {
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, ArrayAdapter<String> adapter = new ArrayAdapter<>(context, R.layout.simple_list_item, accounts);
android.R.layout.simple_spinner_item, accounts); adapter.setDropDownViewResource(R.layout.simple_list_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter); spinner.setAdapter(adapter);
spinner.setEnabled(true); spinner.setEnabled(true);
} else { } else {
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, ArrayAdapter<String> adapter = new ArrayAdapter<>(context,
android.R.layout.simple_spinner_item, R.layout.simple_list_item,
Arrays.asList(new String[]{context.getString(R.string.no_accounts)})); Arrays.asList(new String[]{context.getString(R.string.no_accounts)}));
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(R.layout.simple_list_item);
spinner.setAdapter(adapter); spinner.setAdapter(adapter);
spinner.setEnabled(false); spinner.setEnabled(false);
} }