[FRP] Add illustration to lock screen setup
Added the illustration JPG files, and added SetupWizardUtils.setIllustration method that will change the illustrations in the layout. Bug: 18482708 Change-Id: I8c6758113f07cd33f85eaf6bc019e8194d9a17ce
							
								
								
									
										
											BIN
										
									
								
								res/drawable-hdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 17 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-hdpi/setup_illustration_wifi.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 26 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-mdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 9.7 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-mdpi/setup_illustration_wifi.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 19 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-sw600dp-hdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 33 KiB  | 
| 
		 Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-sw600dp-mdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 17 KiB  | 
| 
		 Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-sw600dp-xhdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 57 KiB  | 
| 
		 Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-sw600dp-xxhdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 118 KiB  | 
| 
		 Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-sw600dp-xxxhdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 153 KiB  | 
| 
		 Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB  | 
							
								
								
									
										33
									
								
								res/drawable-sw600dp/setup_illustration.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,33 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!--
 | 
			
		||||
    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.
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:autoMirrored="true">
 | 
			
		||||
 | 
			
		||||
    <item>
 | 
			
		||||
        <bitmap android:src="@drawable/setup_illustration_horizontal_tile"
 | 
			
		||||
            android:gravity="top"
 | 
			
		||||
            android:tileModeX="repeat"
 | 
			
		||||
            android:tileModeY="disabled" />
 | 
			
		||||
    </item>
 | 
			
		||||
 | 
			
		||||
    <item android:id="@+id/illustration_image">
 | 
			
		||||
        <bitmap android:src="@drawable/setup_illustration_wifi"
 | 
			
		||||
            android:gravity="top|start" />
 | 
			
		||||
    </item>
 | 
			
		||||
 | 
			
		||||
</layer-list>
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								res/drawable-xhdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 26 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-xhdpi/setup_illustration_wifi.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 34 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-xxhdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 48 KiB  | 
| 
		 Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-xxxhdpi/setup_illustration_lock_screen.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 71 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								res/drawable-xxxhdpi/setup_illustration_wifi.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 76 KiB  | 
@@ -18,16 +18,9 @@
 | 
			
		||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:autoMirrored="true">
 | 
			
		||||
 | 
			
		||||
    <item>
 | 
			
		||||
        <bitmap android:src="@drawable/setup_illustration_horizontal_tile"
 | 
			
		||||
            android:gravity="top"
 | 
			
		||||
            android:tileModeX="repeat"
 | 
			
		||||
            android:tileModeY="disabled" />
 | 
			
		||||
    </item>
 | 
			
		||||
 | 
			
		||||
    <item android:id="@+id/illustration_image">
 | 
			
		||||
        <bitmap android:src="@drawable/setup_illustration_wifi_wide_image"
 | 
			
		||||
            android:gravity="top|start" />
 | 
			
		||||
        <bitmap android:src="@drawable/setup_illustration_wifi"
 | 
			
		||||
            android:gravity="fill" />
 | 
			
		||||
    </item>
 | 
			
		||||
 | 
			
		||||
</layer-list>
 | 
			
		||||
</layer-list>
 | 
			
		||||
@@ -1,20 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!--
 | 
			
		||||
     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.
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:autoMirrored="true"
 | 
			
		||||
    android:src="@drawable/setup_illustration_wifi_image" />
 | 
			
		||||
@@ -22,10 +22,11 @@
 | 
			
		||||
    android:orientation="vertical">
 | 
			
		||||
 | 
			
		||||
    <com.android.settings.widget.SetupWizardIllustration
 | 
			
		||||
        android:id="@+id/setup_illustration"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        android:layout_weight="1"
 | 
			
		||||
        android:foreground="@drawable/setup_illustration_wifi_wide"
 | 
			
		||||
        android:foreground="@drawable/setup_illustration"
 | 
			
		||||
        android:background="@drawable/setup_illustration_bg">
 | 
			
		||||
 | 
			
		||||
        <LinearLayout
 | 
			
		||||
 
 | 
			
		||||
@@ -21,12 +21,12 @@
 | 
			
		||||
    android:orientation="vertical">
 | 
			
		||||
 | 
			
		||||
    <com.android.settings.widget.SetupWizardIllustration
 | 
			
		||||
        android:id="@+id/illustration_tablet"
 | 
			
		||||
        android:id="@+id/setup_illustration"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
        android:layout_weight="1"
 | 
			
		||||
        android:background="@drawable/setup_illustration_bg"
 | 
			
		||||
        android:foreground="@drawable/setup_illustration_wifi_wide">
 | 
			
		||||
        android:foreground="@drawable/setup_illustration">
 | 
			
		||||
 | 
			
		||||
        <LinearLayout
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
 
 | 
			
		||||
@@ -21,12 +21,12 @@
 | 
			
		||||
    android:orientation="vertical">
 | 
			
		||||
 | 
			
		||||
    <com.android.settings.widget.SetupWizardIllustration
 | 
			
		||||
        android:id="@+id/title_area"
 | 
			
		||||
        android:id="@+id/setup_illustration"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
        android:layout_weight="1"
 | 
			
		||||
        android:background="@drawable/setup_illustration_bg"
 | 
			
		||||
        android:foreground="@drawable/setup_illustration_wifi_wide">
 | 
			
		||||
        android:foreground="@drawable/setup_illustration">
 | 
			
		||||
 | 
			
		||||
        <LinearLayout
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
 
 | 
			
		||||
@@ -21,12 +21,12 @@
 | 
			
		||||
    android:orientation="vertical">
 | 
			
		||||
 | 
			
		||||
    <com.android.settings.widget.SetupWizardIllustration
 | 
			
		||||
        android:id="@+id/illustration_tablet"
 | 
			
		||||
        android:id="@+id/setup_illustration"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
        android:layout_weight="1"
 | 
			
		||||
        android:background="@drawable/setup_illustration_bg"
 | 
			
		||||
        android:foreground="@drawable/setup_illustration_wifi_wide">
 | 
			
		||||
        android:foreground="@drawable/setup_illustration">
 | 
			
		||||
 | 
			
		||||
        <LinearLayout
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
 
 | 
			
		||||
@@ -35,12 +35,12 @@
 | 
			
		||||
            android:clipChildren="false">
 | 
			
		||||
 | 
			
		||||
            <com.android.settings.widget.SetupWizardIllustration
 | 
			
		||||
                android:id="@+id/illustration_phone"
 | 
			
		||||
                android:id="@+id/setup_illustration"
 | 
			
		||||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="wrap_content"
 | 
			
		||||
                android:elevation="@dimen/setup_wizard_title_area_elevation"
 | 
			
		||||
                android:background="@drawable/setup_illustration_bg"
 | 
			
		||||
                android:foreground="@drawable/setup_illustration_wifi"
 | 
			
		||||
                android:foreground="@drawable/setup_illustration"
 | 
			
		||||
                android:tag="stickyContainer"
 | 
			
		||||
                settings:aspectRatio="2.22">
 | 
			
		||||
 | 
			
		||||
@@ -58,7 +58,7 @@
 | 
			
		||||
                android:id="@+id/setup_content"
 | 
			
		||||
                android:layout_width="match_parent"
 | 
			
		||||
                android:layout_height="wrap_content"
 | 
			
		||||
                android:layout_below="@id/illustration_phone"
 | 
			
		||||
                android:layout_below="@id/setup_illustration"
 | 
			
		||||
                android:clipChildren="false"/>
 | 
			
		||||
 | 
			
		||||
        </RelativeLayout>
 | 
			
		||||
 
 | 
			
		||||
@@ -18,12 +18,12 @@
 | 
			
		||||
<com.android.settings.widget.SetupWizardIllustration
 | 
			
		||||
    xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
 | 
			
		||||
    android:id="@+id/title_area"
 | 
			
		||||
    android:id="@+id/setup_illustration"
 | 
			
		||||
    android:layout_width="match_parent"
 | 
			
		||||
    android:layout_height="wrap_content"
 | 
			
		||||
    android:background="@drawable/setup_illustration_bg"
 | 
			
		||||
    android:elevation="@dimen/setup_wizard_title_area_elevation"
 | 
			
		||||
    android:foreground="@drawable/setup_illustration_wifi"
 | 
			
		||||
    android:foreground="@drawable/setup_illustration"
 | 
			
		||||
    android:tag="stickyContainer"
 | 
			
		||||
    settings:aspectRatio="2.22">
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -87,6 +87,8 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onViewCreated(View view, Bundle savedInstanceState) {
 | 
			
		||||
            super.onViewCreated(view, savedInstanceState);
 | 
			
		||||
            SetupWizardUtils.setIllustration(getActivity(),
 | 
			
		||||
                    R.drawable.setup_illustration_lock_screen);
 | 
			
		||||
            SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -91,6 +91,8 @@ public class SetupChooseLockPassword extends ChooseLockPassword
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onViewCreated(View view, Bundle savedInstanceState) {
 | 
			
		||||
            super.onViewCreated(view, savedInstanceState);
 | 
			
		||||
            SetupWizardUtils.setIllustration(getActivity(),
 | 
			
		||||
                    R.drawable.setup_illustration_lock_screen);
 | 
			
		||||
            SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -89,6 +89,8 @@ public class SetupChooseLockPattern extends ChooseLockPattern
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onViewCreated(View view, Bundle savedInstanceState) {
 | 
			
		||||
            super.onViewCreated(view, savedInstanceState);
 | 
			
		||||
            SetupWizardUtils.setIllustration(getActivity(),
 | 
			
		||||
                    R.drawable.setup_illustration_lock_screen);
 | 
			
		||||
            SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -96,6 +96,8 @@ public class SetupEncryptionInterstitial extends EncryptionInterstitial
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onViewCreated(View view, Bundle savedInstanceState) {
 | 
			
		||||
            super.onViewCreated(view, savedInstanceState);
 | 
			
		||||
            SetupWizardUtils.setIllustration(getActivity(),
 | 
			
		||||
                    R.drawable.setup_illustration_lock_screen);
 | 
			
		||||
            SetupWizardUtils.setHeaderText(getActivity(), R.string.encryption_interstitial_header);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,6 @@ import com.android.setupwizard.navigationbar.SetupWizardNavBar;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import android.content.res.Resources;
 | 
			
		||||
import android.graphics.Color;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import android.view.LayoutInflater;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
@@ -96,6 +95,8 @@ public class SetupRedactionInterstitial extends RedactionInterstitial
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onViewCreated(View view, Bundle savedInstanceState) {
 | 
			
		||||
            super.onViewCreated(view, savedInstanceState);
 | 
			
		||||
            SetupWizardUtils.setIllustration(getActivity(),
 | 
			
		||||
                    R.drawable.setup_illustration_lock_screen);
 | 
			
		||||
            SetupWizardUtils.setHeaderText(getActivity(), R.string.notification_section_header);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -16,12 +16,17 @@
 | 
			
		||||
 | 
			
		||||
package com.android.settings;
 | 
			
		||||
 | 
			
		||||
import com.android.settings.widget.SetupWizardIllustration;
 | 
			
		||||
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import android.app.Activity;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import android.graphics.Color;
 | 
			
		||||
import android.graphics.drawable.BitmapDrawable;
 | 
			
		||||
import android.graphics.drawable.Drawable;
 | 
			
		||||
import android.graphics.drawable.LayerDrawable;
 | 
			
		||||
import android.view.Gravity;
 | 
			
		||||
import android.view.Window;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
 | 
			
		||||
@@ -109,4 +114,24 @@ public class SetupWizardUtils {
 | 
			
		||||
        toIntent.putExtra(EXTRA_USE_IMMERSIVE_MODE,
 | 
			
		||||
                fromIntent.getBooleanExtra(EXTRA_USE_IMMERSIVE_MODE, false));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void setIllustration(Activity activity, int asset) {
 | 
			
		||||
        SetupWizardIllustration illustration =
 | 
			
		||||
                (SetupWizardIllustration) activity.findViewById(R.id.setup_illustration);
 | 
			
		||||
        if (illustration != null) {
 | 
			
		||||
            Drawable drawable = activity.getDrawable(R.drawable.setup_illustration);
 | 
			
		||||
            Drawable newIllustration = activity.getDrawable(asset);
 | 
			
		||||
            if (drawable instanceof LayerDrawable) {
 | 
			
		||||
                LayerDrawable layers = (LayerDrawable) drawable;
 | 
			
		||||
                Drawable oldIllustration = layers.findDrawableByLayerId(R.id.illustration_image);
 | 
			
		||||
                if (newIllustration instanceof BitmapDrawable
 | 
			
		||||
                        && oldIllustration instanceof BitmapDrawable) {
 | 
			
		||||
                    final int gravity = ((BitmapDrawable) oldIllustration).getGravity();
 | 
			
		||||
                    ((BitmapDrawable) newIllustration).setGravity(gravity);
 | 
			
		||||
                }
 | 
			
		||||
                layers.setDrawableByLayerId(R.id.illustration_image, newIllustration);
 | 
			
		||||
                illustration.setForeground(layers);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||