OSDN Git Service

[WifiSetup] Update illustrations
authorMaurice Lam <yukl@google.com>
Wed, 13 Aug 2014 22:52:15 +0000 (15:52 -0700)
committerMaurice Lam <yukl@google.com>
Fri, 15 Aug 2014 00:48:08 +0000 (17:48 -0700)
Update illustration assets and support for auto-mirroring for RTL
languages.

Bug: 16888091
Change-Id: I828a13558aff42f2ddb12b9afe123f463c4c1522

12 files changed:
res/drawable-nodpi/grass_tile.jpg [deleted file]
res/drawable-nodpi/illustration_wifi.jpg [deleted file]
res/drawable-nodpi/illustration_wifi_wide.jpg [deleted file]
res/drawable-nodpi/setup_illustration_tile.png [new file with mode: 0644]
res/drawable-nodpi/setup_illustration_wifi.jpg [new file with mode: 0644]
res/drawable-nodpi/setup_illustration_wifi_wide.jpg [new file with mode: 0644]
res/drawable/setup_illustration_bg.xml [moved from res/drawable/grass.xml with 93% similarity]
res/layout-land/setup_preference.xml
res/layout-sw600dp-land/setup_preference.xml
res/layout/setup_wizard_header.xml
res/values/attrs.xml
src/com/android/settings/widget/SetupWizardIllustration.java

diff --git a/res/drawable-nodpi/grass_tile.jpg b/res/drawable-nodpi/grass_tile.jpg
deleted file mode 100644 (file)
index 7aef32c..0000000
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 (file)
index 0c03199..0000000
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 (file)
index 722fdfd..0000000
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 (file)
index 0000000..ae6d244
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 (file)
index 0000000..2579225
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 (file)
index 0000000..b876fa6
Binary files /dev/null and b/res/drawable-nodpi/setup_illustration_wifi_wide.jpg differ
similarity index 93%
rename from res/drawable/grass.xml
rename to res/drawable/setup_illustration_bg.xml
index 2fb5bd9..0a229c7 100644 (file)
@@ -16,5 +16,5 @@
 -->
 
 <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
-    android:src="@drawable/grass_tile"
+    android:src="@drawable/setup_illustration_tile"
     android:tileMode="repeat" />
index e79f5c1..b2e1cc7 100644 (file)
@@ -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">
 
         <TextView
             android:id="@+id/title"
index 90bd443..1c39405 100644 (file)
@@ -16,6 +16,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
     android:id="@+id/fragment"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -25,8 +26,9 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_weight="1"
-        android:foreground="@drawable/illustration_wifi_wide"
-        android:background="@drawable/grass">
+        android:foreground="@drawable/setup_illustration_wifi_wide"
+        android:background="@drawable/setup_illustration_bg"
+        settings:autoMirrored="true">
 
         <LinearLayout
             android:layout_width="match_parent"
index ebc2304..90818cd 100644 (file)
     android:id="@+id/title_area"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:background="@drawable/grass"
-    android:foreground="@drawable/illustration_wifi"
+    android:background="@drawable/setup_illustration_bg"
+    android:foreground="@drawable/setup_illustration_wifi"
     android:tag="stickyContainer"
-    settings:aspectRatio="2.0">
+    settings:aspectRatio="2.0"
+    settings:autoMirrored="true">
 
     <TextView
         android:id="@+id/title"
index 1fe36d6..8d17a28 100644 (file)
@@ -24,6 +24,7 @@
 
     <declare-styleable name="SetupWizardIllustration">
         <attr name="aspectRatio" format="float" />
+        <attr name="autoMirrored" format="boolean" />
     </declare-styleable>
 
     <declare-styleable name="BatteryHistoryChart">
index dcc4c65..8a9d507 100644 (file)
@@ -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);
     }
 }