diff options
5 files changed, 13 insertions, 69 deletions
diff --git a/packages/SystemUI/res/drawable/managed_profile_toast_background.xml b/packages/SystemUI/res/drawable/managed_profile_toast_background.xml deleted file mode 100644 index 5c77b9a..0000000 --- a/packages/SystemUI/res/drawable/managed_profile_toast_background.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Copyright (C) 2015 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. ---> -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <corners android:radius="2dp" /> - <solid android:color="@color/managed_profile_toast_background" /> -</shape> diff --git a/packages/SystemUI/res/layout/managed_profile_toast.xml b/packages/SystemUI/res/layout/managed_profile_toast.xml deleted file mode 100644 index 5a01ca7..0000000 --- a/packages/SystemUI/res/layout/managed_profile_toast.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2015 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. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingLeft="32dp" - android:paddingRight="32dp" - android:background="@drawable/managed_profile_toast_background"> - <ImageView - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="16dp" - android:src="@drawable/stat_sys_managed_profile_status"/> - <TextView android:text="@string/managed_profile_foreground_toast" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@android:color/white" - android:textSize="14sp" - android:layout_gravity="center_horizontal" /> -</LinearLayout> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 9a96939..0dcbe88 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -143,6 +143,4 @@ <color name="volume_icon_color">#ffffffff</color> <color name="volume_settings_icon_color">#7fffffff</color> <color name="volume_slider_inactive">#FFB0BEC5</color><!-- blue grey 200 --> - - <color name="managed_profile_toast_background">#E5000000</color><!-- 90% black --> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index b0e71f9..7af8b80 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -575,4 +575,7 @@ <!-- Standard image button size for volume dialog buttons --> <dimen name="volume_button_size">48dp</dimen> + + <!-- Padding between icon and text for managed profile toast --> + <dimen name="managed_profile_toast_padding">4dp</dimen> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a496548..f8a1385 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -393,13 +393,16 @@ public abstract class BaseStatusBar extends SystemUI implements if (recentTask != null && recentTask.size() > 0) { UserInfo user = mUserManager.getUserInfo(recentTask.get(0).userId); if (user != null && user.isManagedProfile()) { - LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - View layout = inflater.inflate(R.layout.managed_profile_toast, null); - Toast toast = new Toast(mContext); - toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); - toast.setDuration(Toast.LENGTH_SHORT); - toast.setView(layout); + Toast toast = Toast.makeText(mContext, + R.string.managed_profile_foreground_toast, + Toast.LENGTH_SHORT); + TextView text = (TextView) toast.getView().findViewById( + android.R.id.message); + text.setCompoundDrawablesRelativeWithIntrinsicBounds( + R.drawable.stat_sys_managed_profile_status, 0, 0, 0); + int paddingPx = mContext.getResources().getDimensionPixelSize( + R.dimen.managed_profile_toast_padding); + text.setCompoundDrawablePadding(paddingPx); toast.show(); } } |