Merge "Revert "[CarPowerManager] Disable STR by default for everyone""
diff --git a/.gitignore b/.gitignore
index 697ef2d..577e3ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,5 +4,6 @@
*.iml
gen/
*.pyc
+*.swp
__pycache__
-.idea
\ No newline at end of file
+.idea
diff --git a/car_product/overlay/frameworks/base/core/res/res/layout/alert_dialog_material.xml b/car_product/overlay/frameworks/base/core/res/res/layout/alert_dialog_material.xml
index a302a5d..0298cce 100644
--- a/car_product/overlay/frameworks/base/core/res/res/layout/alert_dialog_material.xml
+++ b/car_product/overlay/frameworks/base/core/res/res/layout/alert_dialog_material.xml
@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start|top"
+ android:background="@color/car_card"
android:orientation="vertical">
<include layout="@layout/alert_dialog_title_material" />
diff --git a/tests/DirectRenderingClusterSample/res/values/colors.xml b/tests/DirectRenderingClusterSample/res/values/colors.xml
index 6798b91..6ede0e7 100644
--- a/tests/DirectRenderingClusterSample/res/values/colors.xml
+++ b/tests/DirectRenderingClusterSample/res/values/colors.xml
@@ -9,4 +9,7 @@
<color name="icon_selected">#6EDDFF</color>
<color name="icon_unselected">#1B378A</color>
+ <!-- LaneView highlight colors -->
+ <color name="laneDirection">#888888</color>
+ <color name="laneDirectionHighlighted">#FFFFFF</color>
</resources>
diff --git a/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java b/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java
index a4c367b..6e86b92 100644
--- a/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java
+++ b/tests/DirectRenderingClusterSample/src/android/car/cluster/sample/LaneView.java
@@ -19,7 +19,8 @@
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.util.AttributeSet;
@@ -60,7 +61,6 @@
for (Lane lane : mLanes) {
Bitmap bitmap = combineBitmapFromLane(lane);
ImageView imgView = new ImageView(getContext());
- imgView.setColorFilter(Color.WHITE);
imgView.setImageBitmap(bitmap);
imgView.setAdjustViewBounds(true);
addView(imgView);
@@ -68,25 +68,39 @@
}
private Bitmap combineBitmapFromLane(Lane lane) {
- Bitmap bitmap = null;
- Canvas canvas = null;
+ if (lane.getDirections().isEmpty()) {
+ return null;
+ }
+
+ Bitmap bitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
for (LaneDirection laneDir : lane.getDirections()) {
- VectorDrawable icon = (VectorDrawable) getLaneIcon(laneDir);
-
- icon.setBounds(0, 0, mWidth, mHeight);
-
- if (bitmap == null) {
- bitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
- canvas = new Canvas(bitmap);
+ if (!laneDir.isHighlighted()) {
+ drawToCanvas(laneDir, canvas, false);
}
+ }
- icon.draw(canvas);
+ for (LaneDirection laneDir : lane.getDirections()) {
+ if (laneDir.isHighlighted()) {
+ drawToCanvas(laneDir, canvas, true);
+ }
}
return bitmap;
}
+
+ private void drawToCanvas(LaneDirection laneDir, Canvas canvas, boolean isHighlighted) {
+ VectorDrawable icon = (VectorDrawable) getLaneIcon(laneDir);
+ icon.setBounds(0, 0, mWidth, mHeight);
+ icon.setColorFilter(new PorterDuffColorFilter(isHighlighted
+ ? getContext().getColor(R.color.laneDirectionHighlighted)
+ : getContext().getColor(R.color.laneDirection),
+ PorterDuff.Mode.SRC_ATOP));
+ icon.draw(canvas);
+ }
+
private Drawable getLaneIcon(@Nullable LaneDirection laneDir) {
if (laneDir == null) {
return null;