FileDocCategorySizeDatePackage
MultiUserSwitch.javaAPI DocAndroid 5.1 API4600Thu Mar 12 22:22:42 GMT 2015com.android.systemui.statusbar.phone

MultiUserSwitch

public class MultiUserSwitch extends android.widget.FrameLayout implements View.OnClickListener
Container for image of the multi user switcher (tappable).

Fields Summary
private com.android.systemui.qs.QSPanel
mQsPanel
private com.android.systemui.statusbar.policy.KeyguardUserSwitcher
mKeyguardUserSwitcher
private boolean
mKeyguardMode
final android.os.UserManager
mUserManager
Constructors Summary
public MultiUserSwitch(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
        mUserManager = UserManager.get(getContext());
    
Methods Summary
public booleanhasOverlappingRendering()

        return false;
    
public voidonClick(android.view.View v)

        if (UserSwitcherController.isUserSwitcherAvailable(mUserManager)) {
            if (mKeyguardMode) {
                if (mKeyguardUserSwitcher != null) {
                    mKeyguardUserSwitcher.show(true /* animate */);
                }
            } else {
                if (mQsPanel != null) {
                    UserSwitcherController userSwitcherController =
                            mQsPanel.getHost().getUserSwitcherController();
                    if (userSwitcherController != null) {
                        mQsPanel.showDetailAdapter(true, userSwitcherController.userDetailAdapter);
                    }
                }
            }
        } else {
            Intent intent = ContactsContract.QuickContact.composeQuickContactsIntent(
                    getContext(), v, ContactsContract.Profile.CONTENT_URI,
                    ContactsContract.QuickContact.MODE_LARGE, null);
            getContext().startActivityAsUser(intent, new UserHandle(UserHandle.USER_CURRENT));
        }
    
protected voidonFinishInflate()

        super.onFinishInflate();
        setOnClickListener(this);
    
public voidonPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)

        super.onPopulateAccessibilityEvent(event);

        if (isClickable()) {
            String text;
            if (UserSwitcherController.isUserSwitcherAvailable(mUserManager)) {
                String currentUser = null;
                if (mQsPanel != null) {
                    UserSwitcherController controller = mQsPanel.getHost()
                            .getUserSwitcherController();
                    if (controller != null) {
                        currentUser = controller.getCurrentUserName(mContext);
                    }
                }
                if (TextUtils.isEmpty(currentUser)) {
                    text = mContext.getString(R.string.accessibility_multi_user_switch_switcher);
                } else {
                    text = mContext.getString(
                            R.string.accessibility_multi_user_switch_switcher_with_current,
                            currentUser);
                }
            } else {
                text = mContext.getString(R.string.accessibility_multi_user_switch_quick_contact);
            }
            if (!TextUtils.isEmpty(text)) {
                event.getText().add(text);
            }
        }

    
public voidsetKeyguardMode(boolean keyguardShowing)

        mKeyguardMode = keyguardShowing;
    
public voidsetKeyguardUserSwitcher(com.android.systemui.statusbar.policy.KeyguardUserSwitcher keyguardUserSwitcher)

        mKeyguardUserSwitcher = keyguardUserSwitcher;
    
public voidsetQsPanel(com.android.systemui.qs.QSPanel qsPanel)

        mQsPanel = qsPanel;