From d650726b44ebbe8360a6b5b551116c22d0ea10af Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Wed, 13 Aug 2014 15:52:15 -0700 Subject: [WifiSetup] Update illustrations Update illustration assets and support for auto-mirroring for RTL languages. Bug: 16888091 Change-Id: I828a13558aff42f2ddb12b9afe123f463c4c1522 --- res/drawable-nodpi/grass_tile.jpg | Bin 9702 -> 0 bytes res/drawable-nodpi/illustration_wifi.jpg | Bin 58441 -> 0 bytes res/drawable-nodpi/illustration_wifi_wide.jpg | Bin 145718 -> 0 bytes res/drawable-nodpi/setup_illustration_tile.png | Bin 0 -> 8001 bytes res/drawable-nodpi/setup_illustration_wifi.jpg | Bin 0 -> 41685 bytes res/drawable-nodpi/setup_illustration_wifi_wide.jpg | Bin 0 -> 20316 bytes res/drawable/grass.xml | 20 -------------------- res/drawable/setup_illustration_bg.xml | 20 ++++++++++++++++++++ res/layout-land/setup_preference.xml | 2 +- res/layout-sw600dp-land/setup_preference.xml | 6 ++++-- res/layout/setup_wizard_header.xml | 7 ++++--- res/values/attrs.xml | 1 + .../settings/widget/SetupWizardIllustration.java | 10 ++++++++++ 13 files changed, 40 insertions(+), 26 deletions(-) delete mode 100644 res/drawable-nodpi/grass_tile.jpg delete mode 100644 res/drawable-nodpi/illustration_wifi.jpg delete mode 100644 res/drawable-nodpi/illustration_wifi_wide.jpg create mode 100644 res/drawable-nodpi/setup_illustration_tile.png create mode 100644 res/drawable-nodpi/setup_illustration_wifi.jpg create mode 100644 res/drawable-nodpi/setup_illustration_wifi_wide.jpg delete mode 100644 res/drawable/grass.xml create mode 100644 res/drawable/setup_illustration_bg.xml diff --git a/res/drawable-nodpi/grass_tile.jpg b/res/drawable-nodpi/grass_tile.jpg deleted file mode 100644 index 7aef32cc7..000000000 Binary files a/res/drawable-nodpi/grass_tile.jpg and /dev/null differ diff --git a/res/drawable-nodpi/illustration_wifi.jpg b/res/drawable-nodpi/illustration_wifi.jpg deleted file mode 100644 index 0c03199eb..000000000 Binary files a/res/drawable-nodpi/illustration_wifi.jpg and /dev/null differ diff --git a/res/drawable-nodpi/illustration_wifi_wide.jpg b/res/drawable-nodpi/illustration_wifi_wide.jpg deleted file mode 100644 index 722fdfd1f..000000000 Binary files a/res/drawable-nodpi/illustration_wifi_wide.jpg and /dev/null differ diff --git a/res/drawable-nodpi/setup_illustration_tile.png b/res/drawable-nodpi/setup_illustration_tile.png new file mode 100644 index 000000000..ae6d2449a Binary files /dev/null and b/res/drawable-nodpi/setup_illustration_tile.png differ diff --git a/res/drawable-nodpi/setup_illustration_wifi.jpg b/res/drawable-nodpi/setup_illustration_wifi.jpg new file mode 100644 index 000000000..257922546 Binary files /dev/null and b/res/drawable-nodpi/setup_illustration_wifi.jpg differ diff --git a/res/drawable-nodpi/setup_illustration_wifi_wide.jpg b/res/drawable-nodpi/setup_illustration_wifi_wide.jpg new file mode 100644 index 000000000..b876fa610 Binary files /dev/null and b/res/drawable-nodpi/setup_illustration_wifi_wide.jpg differ diff --git a/res/drawable/grass.xml b/res/drawable/grass.xml deleted file mode 100644 index 2fb5bd9b9..000000000 --- a/res/drawable/grass.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/res/drawable/setup_illustration_bg.xml b/res/drawable/setup_illustration_bg.xml new file mode 100644 index 000000000..0a229c795 --- /dev/null +++ b/res/drawable/setup_illustration_bg.xml @@ -0,0 +1,20 @@ + + + + diff --git a/res/layout-land/setup_preference.xml b/res/layout-land/setup_preference.xml index e79f5c1d0..b2e1cc75a 100644 --- a/res/layout-land/setup_preference.xml +++ b/res/layout-land/setup_preference.xml @@ -25,7 +25,7 @@ android:id="@+id/title_area" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/grass"> + android:background="@drawable/setup_illustration_bg"> + android:foreground="@drawable/setup_illustration_wifi_wide" + android:background="@drawable/setup_illustration_bg" + settings:autoMirrored="true"> + settings:aspectRatio="2.0" + settings:autoMirrored="true"> + diff --git a/src/com/android/settings/widget/SetupWizardIllustration.java b/src/com/android/settings/widget/SetupWizardIllustration.java index dcc4c6523..8a9d50714 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); } } -- cgit v1.2.3