Parking drawable
This commit is contained in:
parent
d6cbfa18f8
commit
d83ecbc507
3 changed files with 21 additions and 10 deletions
|
@ -21,7 +21,7 @@
|
||||||
android:layout_marginLeft="@dimen/dashboard_parking_left_margin"
|
android:layout_marginLeft="@dimen/dashboard_parking_left_margin"
|
||||||
android:layout_marginRight="@dimen/dashFavIconMargin"
|
android:layout_marginRight="@dimen/dashFavIconMargin"
|
||||||
android:src="@drawable/ic_action_start_navigation"
|
android:src="@drawable/ic_action_start_navigation"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="center"
|
||||||
android:background="@drawable/btn_inset_circle_no_shadow"/>
|
android:background="@drawable/btn_inset_circle_no_shadow"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -114,13 +114,8 @@ public class DashParkingFragment extends DashLocationFragment {
|
||||||
ImageView direction = (ImageView) mainView.findViewById(R.id.direction_icon);
|
ImageView direction = (ImageView) mainView.findViewById(R.id.direction_icon);
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
DashLocationView dv = new DashLocationView(direction, (TextView) mainView.findViewById(R.id.distance), position);
|
DashLocationView dv = new DashLocationView(direction, (TextView) mainView.findViewById(R.id.distance), position);
|
||||||
// Drawable dds = getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_start_navigation,
|
|
||||||
// R.color.color_distance);
|
|
||||||
// DirectionDrawable dd = new DirectionDrawable(mainView.getContext(),
|
|
||||||
// dds.getIntrinsicWidth(), dds.getIntrinsicHeight());
|
|
||||||
// direction.setImageDrawable(dd);
|
|
||||||
dv.paint = false;
|
dv.paint = false;
|
||||||
dv.arrowResId = R.drawable.ic_action_start_navigation;
|
dv.arrowResId = R.drawable.ic_action_start_navigation;
|
||||||
distances.add(dv);
|
distances.add(dv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,19 +73,35 @@ public class DirectionDrawable extends Drawable {
|
||||||
public void setAngle(float angle) {
|
public void setAngle(float angle) {
|
||||||
this.angle = angle;
|
this.angle = angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIntrinsicWidth() {
|
||||||
|
if (arrowImage != null) {
|
||||||
|
return arrowImage.getIntrinsicWidth();
|
||||||
|
}
|
||||||
|
return super.getIntrinsicWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIntrinsicHeight() {
|
||||||
|
if (arrowImage != null) {
|
||||||
|
return arrowImage.getIntrinsicHeight();
|
||||||
|
}
|
||||||
|
return super.getIntrinsicHeight();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
canvas.save();
|
canvas.save();
|
||||||
|
|
||||||
if (arrowImage != null) {
|
if (arrowImage != null) {
|
||||||
int w = arrowImage.getIntrinsicWidth();
|
int w = arrowImage.getIntrinsicWidth();
|
||||||
int h = arrowImage.getIntrinsicHeight();
|
int h = arrowImage.getIntrinsicHeight();
|
||||||
int dx = canvas.getWidth() - w;
|
int dx = canvas.getWidth() - w;
|
||||||
int dy = canvas.getHeight() - h;
|
int dy = canvas.getHeight() - h;
|
||||||
arrowImage.setBounds(0, 0, w, h);
|
arrowImage.setBounds(0, 0, w, h);
|
||||||
canvas.rotate(angle, canvas.getWidth() / 2, canvas.getHeight() / 2);
|
canvas.rotate(angle, w / 2, h / 2);
|
||||||
canvas.translate(dx/2, dy/2);
|
canvas.translate(dx / 3, dy / 3);
|
||||||
arrowImage.draw(canvas);
|
arrowImage.draw(canvas);
|
||||||
} else {
|
} else {
|
||||||
canvas.rotate(angle, canvas.getWidth() / 2, canvas.getHeight() / 2);
|
canvas.rotate(angle, canvas.getWidth() / 2, canvas.getHeight() / 2);
|
||||||
|
|
Loading…
Reference in a new issue