diff options
| author | Maurice Lam <yukl@google.com> | 2014-12-03 16:12:31 -0800 |
|---|---|---|
| committer | Maurice Lam <yukl@google.com> | 2014-12-03 21:19:21 -0800 |
| commit | 1227a19ecc0e5a42156027ae58bea7f77bf41a27 (patch) | |
| tree | a2c192cb6840ca29e43cca664c1fc99d566a8228 /src/com/android/settings/SetupWizardUtils.java | |
| parent | a3dff74e59b29fdff63810e55c27207a8354c935 (diff) | |
| download | packages_apps_Settings-1227a19ecc0e5a42156027ae58bea7f77bf41a27.tar.gz packages_apps_Settings-1227a19ecc0e5a42156027ae58bea7f77bf41a27.tar.bz2 packages_apps_Settings-1227a19ecc0e5a42156027ae58bea7f77bf41a27.zip | |
[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
Diffstat (limited to 'src/com/android/settings/SetupWizardUtils.java')
| -rw-r--r-- | src/com/android/settings/SetupWizardUtils.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/settings/SetupWizardUtils.java b/src/com/android/settings/SetupWizardUtils.java index 0f54e6304..3d44125c8 100644 --- a/src/com/android/settings/SetupWizardUtils.java +++ b/src/com/android/settings/SetupWizardUtils.java @@ -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); + } + } + } } |
