Java Code Examples for android.widget.Spinner#isEnabled()

The following examples show how to use android.widget.Spinner#isEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StartConversationActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 6 votes vote down vote up
public static Account getSelectedAccount(Context context, Spinner spinner) {
    if (spinner == null || !spinner.isEnabled()) {
        return null;
    }
    if (context instanceof XmppActivity) {
        Jid jid;
        try {
            if (Config.DOMAIN_LOCK != null) {
                jid = Jid.ofEscaped((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null);
            } else {
                jid = Jid.ofEscaped((String) spinner.getSelectedItem());
            }
        } catch (final IllegalArgumentException e) {
            return null;
        }
        final XmppConnectionService service = ((XmppActivity) context).xmppConnectionService;
        if (service == null) {
            return null;
        }
        return service.findAccountByJid(jid);
    } else {
        return null;
    }
}
 
Example 2
Source File: StartConversationActivity.java    From Conversations with GNU General Public License v3.0 6 votes vote down vote up
public static Account getSelectedAccount(Context context, Spinner spinner) {
	if (spinner == null || !spinner.isEnabled()) {
		return null;
	}
	if (context instanceof XmppActivity) {
		Jid jid;
		try {
			if (Config.DOMAIN_LOCK != null) {
				jid = Jid.ofEscaped((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null);
			} else {
				jid = Jid.ofEscaped((String) spinner.getSelectedItem());
			}
		} catch (final IllegalArgumentException e) {
			return null;
		}
		final XmppConnectionService service = ((XmppActivity) context).xmppConnectionService;
		if (service == null) {
			return null;
		}
		return service.findAccountByJid(jid);
	} else {
		return null;
	}
}
 
Example 3
Source File: AutocompleteTestActivity.java    From android-places-demos with Apache License 2.0 4 votes vote down vote up
@Nullable
private TypeFilter getTypeFilter() {
  Spinner typeFilter = findViewById(R.id.autocomplete_type_filter);
  return typeFilter.isEnabled() ? (TypeFilter) typeFilter.getSelectedItem() : null;
}
 
Example 4
Source File: AutocompleteTestActivity.java    From android-places-demos with Apache License 2.0 4 votes vote down vote up
@Nullable
private TypeFilter getTypeFilter() {
  Spinner typeFilter = findViewById(R.id.autocomplete_type_filter);
  return typeFilter.isEnabled() ? (TypeFilter) typeFilter.getSelectedItem() : null;
}