[WifiSetup] Update illustration

Update the illustration assets and make the tablet illustration
always 256dp height according to mock.

Bug: 17133710
Change-Id: I6d84bbb25a9f443e4eb6bf4c1002d8a1438029ef
This commit is contained in:
Maurice Lam
2014-08-27 10:08:44 -07:00
parent cf3c9ba291
commit 62c15e38d1
26 changed files with 41 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

View File

@@ -15,6 +15,19 @@
limitations under the License. limitations under the License.
--> -->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" <layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:autoMirrored="true" android:autoMirrored="true">
android:src="@drawable/setup_illustration_wifi_wide_image" />
<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" />
</item>
</layer-list>

View File

@@ -33,13 +33,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_setup_wizard_title" /> android:text="@string/wifi_setup_wizard_title" />
</FrameLayout> </FrameLayout>
<TextView <TextView
android:id="@+id/wifi_required_info" android:id="@+id/wifi_required_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="6dip" android:layout_marginBottom="6dp"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/wifi_required_info_text" android:text="@string/wifi_required_info_text"
android:visibility="gone" /> android:visibility="gone" />

View File

@@ -39,6 +39,7 @@
style="@style/SetupCardTitle" style="@style/SetupCardTitle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
android:layout_weight="6" android:layout_weight="6"
android:text="@string/wifi_setup_wizard_title"/> android:text="@string/wifi_setup_wizard_title"/>

View File

@@ -15,9 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
@@ -28,12 +26,12 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/setup_illustration_bg" android:background="@drawable/setup_illustration_bg"
android:foreground="@drawable/setup_illustration_wifi_wide" android:foreground="@drawable/setup_illustration_wifi_wide">
settings:aspectRatio="4.0">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="@dimen/setup_wizard_card_port_margin_sides" android:paddingLeft="@dimen/setup_wizard_card_port_margin_sides"
android:paddingRight="@dimen/setup_wizard_card_port_margin_sides"> android:paddingRight="@dimen/setup_wizard_card_port_margin_sides">

View File

@@ -45,7 +45,6 @@
<!-- Dashboard tile image margin start / end --> <!-- Dashboard tile image margin start / end -->
<dimen name="dashboard_tile_image_margin_start">12dp</dimen> <dimen name="dashboard_tile_image_margin_start">12dp</dimen>
<dimen name="setup_wizard_card_title_margin_top">256dp</dimen>
<dimen name="setup_wizard_card_title_padding_end">32dp</dimen> <dimen name="setup_wizard_card_title_padding_end">32dp</dimen>
<dimen name="setup_wizard_card_title_padding_start">56dp</dimen> <dimen name="setup_wizard_card_title_padding_start">56dp</dimen>
<dimen name="setup_wizard_card_title_padding_top">24dp</dimen> <dimen name="setup_wizard_card_title_padding_top">24dp</dimen>

View File

@@ -50,7 +50,7 @@
<dimen name="setup_add_network_item_height">56dp</dimen> <dimen name="setup_add_network_item_height">56dp</dimen>
<dimen name="setup_wizard_card_corner_radius">2dp</dimen> <dimen name="setup_wizard_card_corner_radius">2dp</dimen>
<dimen name="setup_wizard_card_elevation">5dp</dimen> <dimen name="setup_wizard_card_elevation">5dp</dimen>
<dimen name="setup_wizard_card_title_margin_top">0dp</dimen> <dimen name="setup_wizard_tablet_illustration_height">256dp</dimen>
<dimen name="setup_wizard_card_title_padding_end">0dp</dimen> <dimen name="setup_wizard_card_title_padding_end">0dp</dimen>
<dimen name="setup_wizard_card_title_padding_start">0dp</dimen> <dimen name="setup_wizard_card_title_padding_start">0dp</dimen>
<dimen name="setup_wizard_card_title_padding_top">16dp</dimen> <dimen name="setup_wizard_card_title_padding_top">16dp</dimen>

View File

@@ -176,7 +176,6 @@
<!-- Alternate title style used for some tablet layouts --> <!-- Alternate title style used for some tablet layouts -->
<style name="SetupCardTitle"> <style name="SetupCardTitle">
<item name="android:layout_marginTop">@dimen/setup_wizard_card_title_margin_top</item>
<item name="android:paddingBottom">@dimen/setup_wizard_card_title_padding_bottom</item> <item name="android:paddingBottom">@dimen/setup_wizard_card_title_padding_bottom</item>
<item name="android:paddingEnd">@dimen/setup_wizard_card_title_padding_end</item> <item name="android:paddingEnd">@dimen/setup_wizard_card_title_padding_end</item>
<item name="android:paddingStart">@dimen/setup_wizard_card_title_padding_start</item> <item name="android:paddingStart">@dimen/setup_wizard_card_title_padding_start</item>

View File

@@ -20,9 +20,11 @@ package com.android.settings.widget;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.android.settings.R; import com.android.settings.R;
@@ -42,7 +44,8 @@ public class SetupWizardIllustration extends FrameLayout {
private float mBaselineGridSize; private float mBaselineGridSize;
private Drawable mBackground; private Drawable mBackground;
private Drawable mForeground; private Drawable mForeground;
private int mForegroundHeight = 0; private final Rect mViewBounds = new Rect();
private final Rect mForegroundBounds = new Rect();
private float mScale = 1.0f; private float mScale = 1.0f;
private float mAspectRatio = 0.0f; private float mAspectRatio = 0.0f;
@@ -112,36 +115,35 @@ public class SetupWizardIllustration extends FrameLayout {
final int layoutWidth = right - left; final int layoutWidth = right - left;
final int layoutHeight = bottom - top; final int layoutHeight = bottom - top;
if (mForeground != null) { if (mForeground != null) {
final float intrinsicWidth = mForeground.getIntrinsicWidth(); int intrinsicWidth = mForeground.getIntrinsicWidth();
final float intrinsicHeight = mForeground.getIntrinsicHeight(); int intrinsicHeight = mForeground.getIntrinsicHeight();
if (intrinsicWidth <= 0 || intrinsicHeight <= 0) { final int layoutDirection = getLayoutDirection();
Log.e(TAG, "Foreground drawable intrinsic size must be defined and positive");
mForeground = null; mViewBounds.set(0, 0, layoutWidth, layoutHeight);
mForegroundHeight = 0; if (mAspectRatio != 0f) {
mScale = 1.0f; mScale = layoutWidth / (float) intrinsicWidth;
} else { intrinsicWidth = layoutWidth;
// Scale the foreground to fill the width of the view intrinsicHeight = (int) (intrinsicHeight * mScale);
mScale = layoutWidth / intrinsicWidth;
mForegroundHeight = (int) (intrinsicHeight * mScale);
mForeground.setBounds(0, 0, layoutWidth, mForegroundHeight);
} }
Gravity.apply(Gravity.FILL_HORIZONTAL | Gravity.TOP, intrinsicWidth, intrinsicHeight,
mViewBounds, mForegroundBounds, layoutDirection);
mForeground.setBounds(mForegroundBounds);
} }
if (mBackground != null) { if (mBackground != null) {
// Scale the bounds by mScale to compensate for the scale done to the canvas before // Scale the bounds by mScale to compensate for the scale done to the canvas before
// drawing. // drawing.
mBackground.setBounds(0, 0, (int) Math.ceil(layoutWidth / mScale), mBackground.setBounds(0, 0, (int) Math.ceil(layoutWidth / mScale),
(int) Math.ceil((layoutHeight - mForegroundHeight) / mScale)); (int) Math.ceil((layoutHeight - mForegroundBounds.height()) / mScale));
} }
super.onLayout(changed, left, top, right, bottom); super.onLayout(changed, left, top, right, bottom);
} }
@Override @Override
public void onDraw(Canvas canvas) { public void onDraw(Canvas canvas) {
canvas.save();
if (mBackground != null) { if (mBackground != null) {
canvas.save(); canvas.save();
// Draw the background filling parts not covered by the illustration // Draw the background filling parts not covered by the illustration
canvas.translate(0, mForegroundHeight); canvas.translate(0, mForegroundBounds.height());
// Scale the background so its size matches the foreground // Scale the background so its size matches the foreground
canvas.scale(mScale, mScale, 0, 0); canvas.scale(mScale, mScale, 0, 0);
mBackground.draw(canvas); mBackground.draw(canvas);
@@ -153,7 +155,6 @@ public class SetupWizardIllustration extends FrameLayout {
mForeground.draw(canvas); mForeground.draw(canvas);
canvas.restore(); canvas.restore();
} }
canvas.restore();
super.onDraw(canvas); super.onDraw(canvas);
} }
} }