diff options
author | Maurice Lam <yukl@google.com> | 2014-08-13 15:52:15 -0700 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2014-08-14 17:48:08 -0700 |
commit | d650726b44ebbe8360a6b5b551116c22d0ea10af (patch) | |
tree | 818308304b4f26ccf2c8cc08f158936aa8362f73 /src/com/android/settings/widget/SetupWizardIllustration.java | |
parent | 841f760fd7345ef2d84b9409c27e36c2365a3de4 (diff) | |
download | packages_apps_Settings-d650726b44ebbe8360a6b5b551116c22d0ea10af.zip packages_apps_Settings-d650726b44ebbe8360a6b5b551116c22d0ea10af.tar.gz packages_apps_Settings-d650726b44ebbe8360a6b5b551116c22d0ea10af.tar.bz2 |
[WifiSetup] Update illustrations
Update illustration assets and support for auto-mirroring for RTL
languages.
Bug: 16888091
Change-Id: I828a13558aff42f2ddb12b9afe123f463c4c1522
Diffstat (limited to 'src/com/android/settings/widget/SetupWizardIllustration.java')
-rw-r--r-- | src/com/android/settings/widget/SetupWizardIllustration.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/com/android/settings/widget/SetupWizardIllustration.java b/src/com/android/settings/widget/SetupWizardIllustration.java index dcc4c65..8a9d507 100644 --- a/src/com/android/settings/widget/SetupWizardIllustration.java +++ b/src/com/android/settings/widget/SetupWizardIllustration.java @@ -22,6 +22,7 @@ import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.util.LayoutDirection; import android.util.Log; import android.widget.FrameLayout; @@ -45,6 +46,7 @@ public class SetupWizardIllustration extends FrameLayout { private int mForegroundHeight = 0; private float mScale = 1.0f; private float mAspectRatio = 0.0f; + private boolean mAutoMirrored; public SetupWizardIllustration(Context context) { this(context, null); @@ -65,6 +67,8 @@ public class SetupWizardIllustration extends FrameLayout { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SetupWizardIllustration, 0, 0); mAspectRatio = a.getFloat(R.styleable.SetupWizardIllustration_aspectRatio, 0.0f); + // TODO: Use framework autoMirrored supported in drawables instead b/17047609 + mAutoMirrored = a.getBoolean(R.styleable.SetupWizardIllustration_autoMirrored, false); a.recycle(); } // Number of pixels of the 8dp baseline grid as defined in material design specs @@ -131,6 +135,11 @@ public class SetupWizardIllustration extends FrameLayout { @Override public void onDraw(Canvas canvas) { + canvas.save(); + if (mAutoMirrored && getLayoutDirection() == LayoutDirection.RTL) { + canvas.scale(-1, 1); + canvas.translate(-canvas.getWidth(), 0); + } if (mBackground != null) { canvas.save(); // Draw the background filling parts not covered by the illustration @@ -146,6 +155,7 @@ public class SetupWizardIllustration extends FrameLayout { mForeground.draw(canvas); canvas.restore(); } + canvas.restore(); super.onDraw(canvas); } } |