Fixed bug with maprouteinfocontrol dialog showing every time when control created. Fixed layout positioning bug with this dialog

This commit is contained in:
Denis_Bars 2014-08-02 11:50:54 +03:00
parent f2e40be50d
commit 39c6c1ffa8
2 changed files with 29 additions and 29 deletions

View file

@ -208,4 +208,8 @@ public abstract class MapControls {
public void setExtraVerticalMargin(int extraVerticalMargin) { public void setExtraVerticalMargin(int extraVerticalMargin) {
this.extraVerticalMargin = extraVerticalMargin; this.extraVerticalMargin = extraVerticalMargin;
} }
public int getExtraVerticalMargin() {
return this.extraVerticalMargin;
}
} }

View file

@ -3,6 +3,9 @@ package net.osmand.plus.views.controls;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import android.graphics.Point;
import android.os.SystemClock;
import android.view.*;
import net.osmand.data.FavouritePoint; import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
@ -31,10 +34,6 @@ import android.graphics.Canvas;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Handler; import android.os.Handler;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
@ -98,9 +97,6 @@ public class MapRouteInfoControl extends MapControls implements IRouteInformatio
} }
} }
}); });
if(getTargets().getPointToNavigate() == null) {
showDialog();
}
} }
private Dialog createDialog() { private Dialog createDialog() {
@ -131,7 +127,7 @@ public class MapRouteInfoControl extends MapControls implements IRouteInformatio
lp.width = WindowManager.LayoutParams.WRAP_CONTENT; lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.BOTTOM; lp.gravity = Gravity.BOTTOM;
lp.y = (int) (infoButton.getBottom() - infoButton.getTop() + scaleCoefficient * 5); lp.y = (int) (infoButton.getBottom() - infoButton.getTop() + scaleCoefficient * 5 + getExtraVerticalMargin());
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setAttributes(lp); dialog.getWindow().setAttributes(lp);