-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/grass_tile"
+ android:src="@drawable/setup_illustration_tile"
android:tileMode="repeat" />
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"
-->
<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"
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"
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"
<declare-styleable name="SetupWizardIllustration">
<attr name="aspectRatio" format="float" />
+ <attr name="autoMirrored" format="boolean" />
</declare-styleable>
<declare-styleable name="BatteryHistoryChart">
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;
private int mForegroundHeight = 0;
private float mScale = 1.0f;
private float mAspectRatio = 0.0f;
+ private boolean mAutoMirrored;
public SetupWizardIllustration(Context context) {
this(context, null);
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
@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
mForeground.draw(canvas);
canvas.restore();
}
+ canvas.restore();
super.onDraw(canvas);
}
}