am 43cf8d1e: Merge "Use closer to standard toast for work profile toast." into mnc-dev
* commit '43cf8d1ed10728f40736fa82c1a569d9aa82bfc6': Use closer to standard toast for work profile toast.
This commit is contained in:
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -143,6 +143,4 @@
|
|||||||
<color name="volume_icon_color">#ffffffff</color>
|
<color name="volume_icon_color">#ffffffff</color>
|
||||||
<color name="volume_settings_icon_color">#7fffffff</color>
|
<color name="volume_settings_icon_color">#7fffffff</color>
|
||||||
<color name="volume_slider_inactive">#FFB0BEC5</color><!-- blue grey 200 -->
|
<color name="volume_slider_inactive">#FFB0BEC5</color><!-- blue grey 200 -->
|
||||||
|
|
||||||
<color name="managed_profile_toast_background">#E5000000</color><!-- 90% black -->
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -575,4 +575,7 @@
|
|||||||
|
|
||||||
<!-- Standard image button size for volume dialog buttons -->
|
<!-- Standard image button size for volume dialog buttons -->
|
||||||
<dimen name="volume_button_size">48dp</dimen>
|
<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>
|
</resources>
|
||||||
|
|||||||
@@ -393,13 +393,16 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
if (recentTask != null && recentTask.size() > 0) {
|
if (recentTask != null && recentTask.size() > 0) {
|
||||||
UserInfo user = mUserManager.getUserInfo(recentTask.get(0).userId);
|
UserInfo user = mUserManager.getUserInfo(recentTask.get(0).userId);
|
||||||
if (user != null && user.isManagedProfile()) {
|
if (user != null && user.isManagedProfile()) {
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
|
Toast toast = Toast.makeText(mContext,
|
||||||
Context.LAYOUT_INFLATER_SERVICE);
|
R.string.managed_profile_foreground_toast,
|
||||||
View layout = inflater.inflate(R.layout.managed_profile_toast, null);
|
Toast.LENGTH_SHORT);
|
||||||
Toast toast = new Toast(mContext);
|
TextView text = (TextView) toast.getView().findViewById(
|
||||||
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
|
android.R.id.message);
|
||||||
toast.setDuration(Toast.LENGTH_SHORT);
|
text.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||||
toast.setView(layout);
|
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();
|
toast.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user