Loading packages/SystemUI/res/layout/status_bar_expanded_header.xml +13 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ android:orientation="horizontal" android:gravity="center_vertical" android:baselineAligned="false" android:elevation="14dp" android:elevation="10dp" > <View Loading Loading @@ -74,12 +74,22 @@ android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" /> <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch" android:layout_width="40dp" android:layout_height="@dimen/status_bar_header_height" android:layout_alignParentEnd="true" android:background="@null" android:scaleType="centerInside" android:padding="6dp" /> <FrameLayout android:id="@+id/system_icons_container" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:layout_alignParentEnd="true" android:layout_marginEnd="16dp" android:layout_toStartOf="@id/multi_user_switch" android:layout_marginEnd="4dp" /> <TextView android:id="@+id/header_debug_info" android:visibility="invisible" Loading packages/SystemUI/res/layout/user_switcher_host.xml +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#dd000000"> android:background="#dd000000" android:elevation="12dp"> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java 0 → 100644 +90 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.systemui.statusbar.phone; import android.content.Context; import android.content.Intent; import android.graphics.Canvas; import android.graphics.Path; import android.graphics.drawable.Drawable; import android.os.UserHandle; import android.os.UserManager; import android.provider.ContactsContract; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import com.android.systemui.R; import com.android.systemui.settings.UserSwitcherHostView; import com.android.systemui.statusbar.policy.UserInfoController; /** * Image button for the multi user switcher. */ public class MultiUserSwitch extends ImageButton implements View.OnClickListener, UserInfoController.OnUserInfoChangedListener { private ViewGroup mOverlayParent; public MultiUserSwitch(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onFinishInflate() { super.onFinishInflate(); setOnClickListener(this); } public void setOverlayParent(ViewGroup parent) { mOverlayParent = parent; } @Override public void onClick(View v) { final UserManager um = UserManager.get(getContext()); if (um.isUserSwitcherEnabled()) { final UserSwitcherHostView switcher = (UserSwitcherHostView) LayoutInflater.from(getContext()).inflate( R.layout.user_switcher_host, mOverlayParent, false); switcher.setFinishRunnable(new Runnable() { @Override public void run() { mOverlayParent.removeView(switcher); } }); switcher.refreshUsers(); mOverlayParent.addView(switcher); } 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)); } } public void setUserInfoController(UserInfoController userInfoController) { userInfoController.addListener(this); } @Override public void onUserInfoChanged(String name, Drawable picture) { setImageDrawable(picture); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ public class NotificationPanelView extends PanelView implements super.onFinishInflate(); mHeader = (StatusBarHeaderView) findViewById(R.id.header); mHeader.getBackgroundView().setOnClickListener(this); mHeader.setOverlayParent(this); mKeyguardStatusView = findViewById(R.id.keyguard_status_view); mStackScrollerContainer = findViewById(R.id.notification_container_parent); mQsContainer = (QuickSettingsContainerView) findViewById(R.id.quick_settings_container); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.systemui.statusbar.policy.HeadsUpNotificationView; import com.android.systemui.statusbar.policy.LocationController; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.RotationLockController; import com.android.systemui.statusbar.policy.UserInfoController; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout.OnChildLocationsChangedListener; import com.android.systemui.statusbar.stack.StackScrollState.ViewState; Loading Loading @@ -184,6 +185,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, LocationController mLocationController; NetworkController mNetworkController; RotationLockController mRotationLockController; UserInfoController mUserInfoController; int mNaturalBarHeight = -1; int mIconSize = -1; Loading Loading @@ -670,6 +672,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, || QuickSettings.DEBUG_GONE_TILES) { mRotationLockController = new RotationLockController(mContext); } mUserInfoController = new UserInfoController(mContext); final SignalClusterView signalCluster = (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster); Loading Loading @@ -737,6 +740,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mQS = null; // fly away, be free } // User info. Trigger first load. mHeader.setUserInfoController(mUserInfoController); mUserInfoController.reloadUserInfo(); PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); mBroadcastReceiver.onReceive(mContext, new Intent(pm.isScreenOn() ? Intent.ACTION_SCREEN_ON : Intent.ACTION_SCREEN_OFF)); Loading Loading
packages/SystemUI/res/layout/status_bar_expanded_header.xml +13 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ android:orientation="horizontal" android:gravity="center_vertical" android:baselineAligned="false" android:elevation="14dp" android:elevation="10dp" > <View Loading Loading @@ -74,12 +74,22 @@ android:ellipsize="marquee" android:textAppearance="?android:attr/textAppearanceMedium" /> <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch" android:layout_width="40dp" android:layout_height="@dimen/status_bar_header_height" android:layout_alignParentEnd="true" android:background="@null" android:scaleType="centerInside" android:padding="6dp" /> <FrameLayout android:id="@+id/system_icons_container" android:layout_width="wrap_content" android:layout_height="@dimen/status_bar_header_height" android:layout_alignParentEnd="true" android:layout_marginEnd="16dp" android:layout_toStartOf="@id/multi_user_switch" android:layout_marginEnd="4dp" /> <TextView android:id="@+id/header_debug_info" android:visibility="invisible" Loading
packages/SystemUI/res/layout/user_switcher_host.xml +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#dd000000"> android:background="#dd000000" android:elevation="12dp"> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java 0 → 100644 +90 −0 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.systemui.statusbar.phone; import android.content.Context; import android.content.Intent; import android.graphics.Canvas; import android.graphics.Path; import android.graphics.drawable.Drawable; import android.os.UserHandle; import android.os.UserManager; import android.provider.ContactsContract; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import com.android.systemui.R; import com.android.systemui.settings.UserSwitcherHostView; import com.android.systemui.statusbar.policy.UserInfoController; /** * Image button for the multi user switcher. */ public class MultiUserSwitch extends ImageButton implements View.OnClickListener, UserInfoController.OnUserInfoChangedListener { private ViewGroup mOverlayParent; public MultiUserSwitch(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onFinishInflate() { super.onFinishInflate(); setOnClickListener(this); } public void setOverlayParent(ViewGroup parent) { mOverlayParent = parent; } @Override public void onClick(View v) { final UserManager um = UserManager.get(getContext()); if (um.isUserSwitcherEnabled()) { final UserSwitcherHostView switcher = (UserSwitcherHostView) LayoutInflater.from(getContext()).inflate( R.layout.user_switcher_host, mOverlayParent, false); switcher.setFinishRunnable(new Runnable() { @Override public void run() { mOverlayParent.removeView(switcher); } }); switcher.refreshUsers(); mOverlayParent.addView(switcher); } 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)); } } public void setUserInfoController(UserInfoController userInfoController) { userInfoController.addListener(this); } @Override public void onUserInfoChanged(String name, Drawable picture) { setImageDrawable(picture); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +1 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ public class NotificationPanelView extends PanelView implements super.onFinishInflate(); mHeader = (StatusBarHeaderView) findViewById(R.id.header); mHeader.getBackgroundView().setOnClickListener(this); mHeader.setOverlayParent(this); mKeyguardStatusView = findViewById(R.id.keyguard_status_view); mStackScrollerContainer = findViewById(R.id.notification_container_parent); mQsContainer = (QuickSettingsContainerView) findViewById(R.id.quick_settings_container); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.systemui.statusbar.policy.HeadsUpNotificationView; import com.android.systemui.statusbar.policy.LocationController; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.RotationLockController; import com.android.systemui.statusbar.policy.UserInfoController; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout.OnChildLocationsChangedListener; import com.android.systemui.statusbar.stack.StackScrollState.ViewState; Loading Loading @@ -184,6 +185,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, LocationController mLocationController; NetworkController mNetworkController; RotationLockController mRotationLockController; UserInfoController mUserInfoController; int mNaturalBarHeight = -1; int mIconSize = -1; Loading Loading @@ -670,6 +672,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, || QuickSettings.DEBUG_GONE_TILES) { mRotationLockController = new RotationLockController(mContext); } mUserInfoController = new UserInfoController(mContext); final SignalClusterView signalCluster = (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster); Loading Loading @@ -737,6 +740,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mQS = null; // fly away, be free } // User info. Trigger first load. mHeader.setUserInfoController(mUserInfoController); mUserInfoController.reloadUserInfo(); PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); mBroadcastReceiver.onReceive(mContext, new Intent(pm.isScreenOn() ? Intent.ACTION_SCREEN_ON : Intent.ACTION_SCREEN_OFF)); Loading