Fix blocker issue/crash map. Tested on 1.5. Should work on 2.1 as well

This commit is contained in:
Victor Shcherb 2011-12-10 23:41:12 +01:00
parent 75a6e93df3
commit 79484705fe
2 changed files with 10 additions and 20 deletions

View file

@ -111,24 +111,24 @@ public class MapInfoLayer extends OsmandMapLayer {
}
int i = 0;
for(MapInfoControl m : rightStack.getAllViews()){
m.setBackgroundDrawable(view.getResources().getDrawable(i == 0 ? boxTopR : boxTop).mutate());
m.setBackgroundDrawable(view.getResources().getDrawable(i == 0 ? boxTopR : boxTop));
i++;
}
rightStack.setExpandImageDrawable(view.getResources().getDrawable(expand).mutate());
rightStack.setExpandImageDrawable(view.getResources().getDrawable(expand));
i = 0;
for(MapInfoControl m : leftStack.getAllViews()){
m.setBackgroundDrawable(view.getResources().getDrawable(i < 2 ? boxTopL : boxTop).mutate());
m.setBackgroundDrawable(view.getResources().getDrawable(i < 2 ? boxTopL : boxTop));
i++;
}
leftStack.setExpandImageDrawable(view.getResources().getDrawable(expand).mutate());
statusBar.setBackgroundDrawable(view.getResources().getDrawable(boxTop).mutate());
leftStack.setExpandImageDrawable(view.getResources().getDrawable(expand));
statusBar.setBackgroundDrawable(view.getResources().getDrawable(boxTop));
showAltitude = view.getSettings().SHOW_ALTITUDE_INFO.get();
}
public void createTopBarElements() {
// 1. Create view groups and controls
statusBar = createStatusBar();
statusBar.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_top).mutate());
statusBar.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_top));
rightStack = new MapStackControl(view.getContext());
rightStack.addStackView(createDistanceControl());
@ -218,7 +218,7 @@ public class MapInfoLayer extends OsmandMapLayer {
}
private TextInfoControl createSpeedControl(){
final TextInfoControl speedControl = new TextInfoControl(map, 0, paintText, paintSubText) {
final TextInfoControl speedControl = new TextInfoControl(map, 3, paintText, paintSubText) {
private float cachedSpeed = 0;
@Override

View file

@ -28,7 +28,6 @@ public class MapStackControl extends ViewGroup {
final Bitmap arrowUp = BitmapFactory.decodeResource(context.getResources(), R.drawable.arrow_up);
final Paint paintImg = new Paint();
paintImg.setAntiAlias(true);
setChildrenDrawingOrderEnabled(true);
expandView = new ImageView(context) {
@Override
protected void onDraw(Canvas canvas) {
@ -43,7 +42,7 @@ public class MapStackControl extends ViewGroup {
}
}
};
expandView.setImageDrawable(context.getResources().getDrawable(R.drawable.box_expand).mutate());
expandView.setImageDrawable(context.getResources().getDrawable(R.drawable.box_expand));
expandView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -70,23 +69,14 @@ public class MapStackControl extends ViewGroup {
}
@Override
protected int getChildDrawingOrder(int childCount, int i) {
// start from expand view
if (i == 0) {
return 0;
}
return childCount - i;
}
public void addStackView(MapInfoControl v) {
stackViews.add(v);
MapStackControl.this.addView(v);
MapStackControl.this.addView(v, 1);
}
public void addCollapsedView(MapInfoControl v) {
collapsedViews.add(v);
MapStackControl.this.addView(v);
MapStackControl.this.addView(v, 1);
}
public List<MapInfoControl> getStackViews() {