Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63bf8acb authored by Kenny Guy's avatar Kenny Guy
Browse files

Use closer to standard toast for work profile toast.

Revert back to using a standard system toast
for the toast shown when user unlocks to a
work activity.
Include the work status icon in the toast.

Bug: 21325183
Bug: 21896447
Change-Id: I691417a4ecac36983f391ee722f59e2b467affc1
parent 1b48a643
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
<?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>
+0 −39
Original line number Diff line number Diff line
<?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>
+0 −2
Original line number Diff line number Diff line
@@ -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>
+3 −0
Original line number Diff line number Diff line
@@ -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>
+10 −7
Original line number Diff line number Diff line
@@ -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();
                    }
                }