Usage graphs support RTL style.
Flips the canvas horizontally before drawing paths under RTL mode. Bug: 78008951 Test: manually verified graphs of wifi data usage, app data usage, and battery usage. Change-Id: I79286e9f3f98632e3a9710d42c3e197231a14c39
This commit is contained in:
@@ -80,8 +80,7 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal">
|
||||||
android:layoutDirection="ltr">
|
|
||||||
<include android:id="@+id/label_start"
|
<include android:id="@+id/label_start"
|
||||||
layout="@layout/usage_side_label" />
|
layout="@layout/usage_side_label" />
|
||||||
|
|
||||||
|
@@ -255,9 +255,15 @@ public class UsageGraph extends View {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canvas.save();
|
||||||
|
if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||||
|
// Flip the canvas along the y-axis of the center of itself before drawing paths.
|
||||||
|
canvas.scale(-1, 1, canvas.getWidth() * 0.5f, 0);
|
||||||
|
}
|
||||||
drawLinePath(canvas, mLocalProjectedPaths, mDottedPaint);
|
drawLinePath(canvas, mLocalProjectedPaths, mDottedPaint);
|
||||||
drawFilledPath(canvas, mLocalPaths, mFillPaint);
|
drawFilledPath(canvas, mLocalPaths, mFillPaint);
|
||||||
drawLinePath(canvas, mLocalPaths, mLinePaint);
|
drawLinePath(canvas, mLocalPaths, mLinePaint);
|
||||||
|
canvas.restore();
|
||||||
BatteryUtils.logRuntime(LOG_TAG, "onDraw", startTime);
|
BatteryUtils.logRuntime(LOG_TAG, "onDraw", startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user