Merge "New look and feel for managed profile toast" into mnc-dev
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?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>
|
||||
@@ -20,10 +20,10 @@ Copyright (C) 2015 The Android Open Source Project
|
||||
android:viewportHeight="17.0">
|
||||
<group android:translateX="2.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M9.9,11.6H7v-1.1H2.1v2.8c0,0.8,0.6,1.4,1.4,1.4h9.9c0.8,0,1.4,-0.6,1.4,-1.4v-2.8H9.9V11.6z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M14.1,4.2h-2.5V3.2l-1.1,-1.1H6.3L5.3,3.2v1H2.8C2,4.2,1.4,4.9,1.4,5.6v2.8c0,0.8,0.6,1.4,1.4,1.4H7V8.8h2.8v1.1h4.2 c0.8,0,1.4,-0.6,1.4,-1.4V5.6C15.5,4.9,14.8,4.2,14.1,4.2z M10.6,4.2H6.3V3.2h4.2V4.2z"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
||||
39
packages/SystemUI/res/layout/managed_profile_toast.xml
Normal file
39
packages/SystemUI/res/layout/managed_profile_toast.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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,4 +143,6 @@
|
||||
<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>
|
||||
|
||||
@@ -1012,7 +1012,7 @@
|
||||
<string name="volumeui_notification_text">Touch to restore the original.</string>
|
||||
|
||||
<!-- Toast shown when user unlocks screen and managed profile activity is in the foreground -->
|
||||
<string name="managed_profile_foreground_toast">You are in the work profile</string>
|
||||
<string name="managed_profile_foreground_toast">You\'re using your work profile</string>
|
||||
|
||||
<string-array name="volume_stream_titles" translatable="false">
|
||||
<item>Voice calls</item> <!-- STREAM_VOICE_CALL -->
|
||||
|
||||
@@ -65,6 +65,7 @@ import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.IWindowManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -395,8 +396,14 @@ 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()) {
|
||||
Toast.makeText(mContext, R.string.managed_profile_foreground_toast,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
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.show();
|
||||
}
|
||||
}
|
||||
} else if (BANNER_ACTION_CANCEL.equals(action) || BANNER_ACTION_SETUP.equals(action)) {
|
||||
|
||||
Reference in New Issue
Block a user