diff options
26 files changed, 41 insertions, 29 deletions
diff --git a/res/drawable-hdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-hdpi/setup_illustration_horizontal_tile.jpg Binary files differnew file mode 100644 index 000000000..428b2f4f8 --- /dev/null +++ b/res/drawable-hdpi/setup_illustration_horizontal_tile.jpg diff --git a/res/drawable-hdpi/setup_illustration_tile.jpg b/res/drawable-hdpi/setup_illustration_tile.jpg Binary files differnew file mode 100644 index 000000000..ed6575c98 --- /dev/null +++ b/res/drawable-hdpi/setup_illustration_tile.jpg diff --git a/res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg Binary files differnew file mode 100644 index 000000000..fccea72a1 --- /dev/null +++ b/res/drawable-hdpi/setup_illustration_wifi_wide_image.jpg diff --git a/res/drawable-mdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-mdpi/setup_illustration_horizontal_tile.jpg Binary files differnew file mode 100644 index 000000000..52e7993ff --- /dev/null +++ b/res/drawable-mdpi/setup_illustration_horizontal_tile.jpg diff --git a/res/drawable-mdpi/setup_illustration_tile.jpg b/res/drawable-mdpi/setup_illustration_tile.jpg Binary files differnew file mode 100644 index 000000000..9dbe13174 --- /dev/null +++ b/res/drawable-mdpi/setup_illustration_tile.jpg diff --git a/res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg Binary files differnew file mode 100644 index 000000000..f21dffb23 --- /dev/null +++ b/res/drawable-mdpi/setup_illustration_wifi_wide_image.jpg diff --git a/res/drawable-nodpi/setup_illustration_tile.png b/res/drawable-nodpi/setup_illustration_tile.png Binary files differdeleted file mode 100644 index ae6d2449a..000000000 --- a/res/drawable-nodpi/setup_illustration_tile.png +++ /dev/null diff --git a/res/drawable-nodpi/setup_illustration_wifi_image.jpg b/res/drawable-nodpi/setup_illustration_wifi_image.jpg Binary files differindex 257922546..a27c93e9d 100644 --- a/res/drawable-nodpi/setup_illustration_wifi_image.jpg +++ b/res/drawable-nodpi/setup_illustration_wifi_image.jpg diff --git a/res/drawable-nodpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-nodpi/setup_illustration_wifi_wide_image.jpg Binary files differdeleted file mode 100644 index b876fa610..000000000 --- a/res/drawable-nodpi/setup_illustration_wifi_wide_image.jpg +++ /dev/null diff --git a/res/drawable-xhdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-xhdpi/setup_illustration_horizontal_tile.jpg Binary files differnew file mode 100644 index 000000000..2733f8e76 --- /dev/null +++ b/res/drawable-xhdpi/setup_illustration_horizontal_tile.jpg diff --git a/res/drawable-xhdpi/setup_illustration_tile.jpg b/res/drawable-xhdpi/setup_illustration_tile.jpg Binary files differnew file mode 100644 index 000000000..71dabd575 --- /dev/null +++ b/res/drawable-xhdpi/setup_illustration_tile.jpg diff --git a/res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg Binary files differnew file mode 100644 index 000000000..3d1b3f32d --- /dev/null +++ b/res/drawable-xhdpi/setup_illustration_wifi_wide_image.jpg diff --git a/res/drawable-xxhdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-xxhdpi/setup_illustration_horizontal_tile.jpg Binary files differnew file mode 100644 index 000000000..aec8d0f66 --- /dev/null +++ b/res/drawable-xxhdpi/setup_illustration_horizontal_tile.jpg diff --git a/res/drawable-xxhdpi/setup_illustration_tile.jpg b/res/drawable-xxhdpi/setup_illustration_tile.jpg Binary files differnew file mode 100644 index 000000000..46b3d029d --- /dev/null +++ b/res/drawable-xxhdpi/setup_illustration_tile.jpg diff --git a/res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg Binary files differnew file mode 100644 index 000000000..6a590b7f5 --- /dev/null +++ b/res/drawable-xxhdpi/setup_illustration_wifi_wide_image.jpg diff --git a/res/drawable-xxxhdpi/illustration_tile.jpg b/res/drawable-xxxhdpi/illustration_tile.jpg Binary files differnew file mode 100644 index 000000000..ab3899e4a --- /dev/null +++ b/res/drawable-xxxhdpi/illustration_tile.jpg diff --git a/res/drawable-xxxhdpi/setup_illustration_horizontal_tile.jpg b/res/drawable-xxxhdpi/setup_illustration_horizontal_tile.jpg Binary files differnew file mode 100644 index 000000000..448a6518a --- /dev/null +++ b/res/drawable-xxxhdpi/setup_illustration_horizontal_tile.jpg diff --git a/res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg b/res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg Binary files differnew file mode 100644 index 000000000..d6f2f8288 --- /dev/null +++ b/res/drawable-xxxhdpi/setup_illustration_wifi_wide_image.jpg diff --git a/res/drawable/setup_illustration_wifi_wide.xml b/res/drawable/setup_illustration_wifi_wide.xml index 3af35615c..33ee2f604 100644 --- a/res/drawable/setup_illustration_wifi_wide.xml +++ b/res/drawable/setup_illustration_wifi_wide.xml @@ -15,6 +15,19 @@ limitations under the License. --> -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:autoMirrored="true" - android:src="@drawable/setup_illustration_wifi_wide_image" /> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" + android:autoMirrored="true"> + + <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>
\ No newline at end of file diff --git a/res/layout-land/setup_preference.xml b/res/layout-land/setup_preference.xml index b2e1cc75a..ce655d62e 100644 --- a/res/layout-land/setup_preference.xml +++ b/res/layout-land/setup_preference.xml @@ -33,13 +33,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/wifi_setup_wizard_title" /> + </FrameLayout> <TextView android:id="@+id/wifi_required_info" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="6dip" + android:layout_marginBottom="6dp" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/wifi_required_info_text" android:visibility="gone" /> diff --git a/res/layout-sw600dp-land/setup_preference.xml b/res/layout-sw600dp-land/setup_preference.xml index 3d4db3d88..2bb8f96f5 100644 --- a/res/layout-sw600dp-land/setup_preference.xml +++ b/res/layout-sw600dp-land/setup_preference.xml @@ -39,6 +39,7 @@ style="@style/SetupCardTitle" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height" android:layout_weight="6" android:text="@string/wifi_setup_wizard_title"/> diff --git a/res/layout-sw720dp-port/setup_preference.xml b/res/layout-sw600dp/setup_preference.xml index 8d1f53b2b..1e772d984 100644 --- a/res/layout-sw720dp-port/setup_preference.xml +++ b/res/layout-sw600dp/setup_preference.xml @@ -15,9 +15,7 @@ limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> @@ -28,12 +26,12 @@ android:layout_height="0dp" android:layout_weight="1" android:background="@drawable/setup_illustration_bg" - android:foreground="@drawable/setup_illustration_wifi_wide" - settings:aspectRatio="4.0"> + android:foreground="@drawable/setup_illustration_wifi_wide"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height" android:orientation="vertical" android:paddingLeft="@dimen/setup_wizard_card_port_margin_sides" android:paddingRight="@dimen/setup_wizard_card_port_margin_sides"> diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index 1aa4b5501..5f524af53 100755 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -45,7 +45,6 @@ <!-- Dashboard tile image margin start / end --> <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_start">56dp</dimen> <dimen name="setup_wizard_card_title_padding_top">24dp</dimen> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 18306ca0a..fcfd5bc90 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -50,7 +50,7 @@ <dimen name="setup_add_network_item_height">56dp</dimen> <dimen name="setup_wizard_card_corner_radius">2dp</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_start">0dp</dimen> <dimen name="setup_wizard_card_title_padding_top">16dp</dimen> diff --git a/res/values/styles.xml b/res/values/styles.xml index 3f5f39d06..c3d256403 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -176,7 +176,6 @@ <!-- Alternate title style used for some tablet layouts --> <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:paddingEnd">@dimen/setup_wizard_card_title_padding_end</item> <item name="android:paddingStart">@dimen/setup_wizard_card_title_padding_start</item> diff --git a/src/com/android/settings/widget/SetupWizardIllustration.java b/src/com/android/settings/widget/SetupWizardIllustration.java index fa8dd809e..acdb5b363 100644 --- a/src/com/android/settings/widget/SetupWizardIllustration.java +++ b/src/com/android/settings/widget/SetupWizardIllustration.java @@ -20,9 +20,11 @@ package com.android.settings.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; +import android.view.Gravity; import android.widget.FrameLayout; import com.android.settings.R; @@ -42,7 +44,8 @@ public class SetupWizardIllustration extends FrameLayout { private float mBaselineGridSize; private Drawable mBackground; 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 mAspectRatio = 0.0f; @@ -112,36 +115,35 @@ public class SetupWizardIllustration extends FrameLayout { final int layoutWidth = right - left; final int layoutHeight = bottom - top; if (mForeground != null) { - final float intrinsicWidth = mForeground.getIntrinsicWidth(); - final float intrinsicHeight = mForeground.getIntrinsicHeight(); - if (intrinsicWidth <= 0 || intrinsicHeight <= 0) { - Log.e(TAG, "Foreground drawable intrinsic size must be defined and positive"); - mForeground = null; - mForegroundHeight = 0; - mScale = 1.0f; - } else { - // Scale the foreground to fill the width of the view - mScale = layoutWidth / intrinsicWidth; - mForegroundHeight = (int) (intrinsicHeight * mScale); - mForeground.setBounds(0, 0, layoutWidth, mForegroundHeight); + int intrinsicWidth = mForeground.getIntrinsicWidth(); + int intrinsicHeight = mForeground.getIntrinsicHeight(); + final int layoutDirection = getLayoutDirection(); + + mViewBounds.set(0, 0, layoutWidth, layoutHeight); + if (mAspectRatio != 0f) { + mScale = layoutWidth / (float) intrinsicWidth; + intrinsicWidth = layoutWidth; + intrinsicHeight = (int) (intrinsicHeight * mScale); } + Gravity.apply(Gravity.FILL_HORIZONTAL | Gravity.TOP, intrinsicWidth, intrinsicHeight, + mViewBounds, mForegroundBounds, layoutDirection); + mForeground.setBounds(mForegroundBounds); } if (mBackground != null) { // Scale the bounds by mScale to compensate for the scale done to the canvas before // drawing. 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); } @Override public void onDraw(Canvas canvas) { - canvas.save(); if (mBackground != null) { canvas.save(); // 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 canvas.scale(mScale, mScale, 0, 0); mBackground.draw(canvas); @@ -153,7 +155,6 @@ public class SetupWizardIllustration extends FrameLayout { mForeground.draw(canvas); canvas.restore(); } - canvas.restore(); super.onDraw(canvas); } } |