Merge remote-tracking branch 'origin/plan_route_options' into plan_route_options
This commit is contained in:
commit
c034f7deab
4 changed files with 58 additions and 22 deletions
|
@ -40,6 +40,10 @@ public class RenderingRulesStorage {
|
|||
|
||||
private final static int SHIFT_TAG_VAL = 16;
|
||||
|
||||
|
||||
private final static String SEQ_ATTR_KEY = "seq";
|
||||
private final static String SEQ_PLACEHOLDER = "#SEQ";
|
||||
|
||||
// C++
|
||||
List<String> dictionary = new ArrayList<String>();
|
||||
Map<String, Integer> dictionaryMap = new LinkedHashMap<String, Integer>();
|
||||
|
@ -191,8 +195,19 @@ public class RenderingRulesStorage {
|
|||
List<XmlTreeSequence> children = new ArrayList<RenderingRulesStorage.XmlTreeSequence>();
|
||||
|
||||
private void process(RenderingRulesHandler handler, int el) throws XmlPullParserException, IOException {
|
||||
// TODO create new attrsMap and replace #SEQ -> el
|
||||
handler.startElement(attrsMap, name);
|
||||
Map<String, String> seqAttrsMap = new HashMap<String, String>(attrsMap);
|
||||
if (attrsMap.containsKey(SEQ_ATTR_KEY)) {
|
||||
attrsMap.remove(SEQ_ATTR_KEY);
|
||||
}
|
||||
|
||||
for (Entry<String, String> attr: attrsMap.entrySet()) {
|
||||
if (attr.getValue().contains(SEQ_PLACEHOLDER)) {
|
||||
seqAttrsMap.put(attr.getKey(), attr.getValue().replace(SEQ_PLACEHOLDER, el+""));
|
||||
} else {
|
||||
seqAttrsMap.put(attr.getKey(), attr.getValue());
|
||||
}
|
||||
}
|
||||
handler.startElement(seqAttrsMap, name);
|
||||
for(XmlTreeSequence s : children) {
|
||||
s.process(handler, el);
|
||||
}
|
||||
|
@ -223,13 +238,13 @@ public class RenderingRulesStorage {
|
|||
attrsMap.clear();
|
||||
parseAttributes(parser, attrsMap);
|
||||
String name = parser.getName();
|
||||
if (!Algorithms.isEmpty(parser.getAttributeValue("", "seq")) || currentSeqElement != null) {
|
||||
if (!Algorithms.isEmpty(parser.getAttributeValue("", SEQ_ATTR_KEY)) || currentSeqElement != null) {
|
||||
XmlTreeSequence seq = new XmlTreeSequence();
|
||||
seq.name = name;
|
||||
seq.attrsMap = attrsMap;
|
||||
seq.attrsMap = new HashMap<String, String>(attrsMap);
|
||||
seq.parent = currentSeqElement;
|
||||
if (currentSeqElement == null) {
|
||||
seq.seqOrder = parser.getAttributeValue("", "seq");
|
||||
seq.seqOrder = parser.getAttributeValue("", SEQ_ATTR_KEY);
|
||||
} else {
|
||||
currentSeqElement.children.add(seq);
|
||||
seq.seqOrder = currentSeqElement.seqOrder;
|
||||
|
@ -246,7 +261,8 @@ public class RenderingRulesStorage {
|
|||
currentSeqElement = currentSeqElement.parent;
|
||||
if (currentSeqElement == null) {
|
||||
// Here we process sequence element
|
||||
for(int i = 1; i < 5; i++) {
|
||||
int seqEnd = Integer.parseInt(process.seqOrder.substring(process.seqOrder.indexOf(':') + 1, process.seqOrder.length()));
|
||||
for(int i = 1; i < seqEnd; i++) {
|
||||
process.process(this, i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1606,7 +1606,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
private void onGpxSaved(Exception warning) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
final MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1626,8 +1626,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
.setAction(R.string.shared_string_rename, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
if (AndroidUtils.isActivityNotDestroyed(mapActivity)) {
|
||||
FileUtils.renameFile(mapActivity, toSave, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,25 +172,43 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
}
|
||||
|
||||
private void setQuickActionButtonMargin() {
|
||||
int defRightMargin = calculateTotalSizePx(R.dimen.map_button_size, R.dimen.map_button_spacing_land) * 2;
|
||||
int defBottomMargin = calculateTotalSizePx(R.dimen.map_button_size, R.dimen.map_button_spacing) * 2;
|
||||
FrameLayout.LayoutParams param = (FrameLayout.LayoutParams) quickActionButton.getLayoutParams();
|
||||
if (AndroidUiHelper.isOrientationPortrait(mapActivity)) {
|
||||
Pair<Integer, Integer> fabMargin = settings.getPortraitFabMargin();
|
||||
if (fabMargin != null) {
|
||||
param.rightMargin = fabMargin.first;
|
||||
param.bottomMargin = fabMargin.second;
|
||||
} else {
|
||||
param.bottomMargin = calculateTotalSizePx(R.dimen.map_button_size, R.dimen.map_button_spacing) * 2;
|
||||
}
|
||||
setQuickActionButtonMargin(param, fabMargin, 0, defBottomMargin);
|
||||
} else {
|
||||
Pair<Integer, Integer> fabMargin = settings.getLandscapeFabMargin();
|
||||
if (fabMargin != null) {
|
||||
param.rightMargin = fabMargin.first;
|
||||
param.bottomMargin = fabMargin.second;
|
||||
} else {
|
||||
param.rightMargin = calculateTotalSizePx(R.dimen.map_button_size, R.dimen.map_button_spacing_land) * 2;
|
||||
}
|
||||
setQuickActionButtonMargin(param, fabMargin, defRightMargin, 0);
|
||||
}
|
||||
quickActionButton.setLayoutParams(param);
|
||||
}
|
||||
|
||||
private void setQuickActionButtonMargin(FrameLayout.LayoutParams params,
|
||||
Pair<Integer, Integer> fabMargin,
|
||||
int defRightMargin, int defBottomMargin) {
|
||||
int screenHeight = AndroidUtils.getScreenHeight(mapActivity);
|
||||
int screenWidth = AndroidUtils.getScreenWidth(mapActivity);
|
||||
int btnHeight = quickActionButton.getHeight();
|
||||
int btnWidth = quickActionButton.getWidth();
|
||||
int rightMargin;
|
||||
int bottomMargin;
|
||||
if (fabMargin != null) {
|
||||
rightMargin = fabMargin.first;
|
||||
bottomMargin = fabMargin.second;
|
||||
if (rightMargin < 0 || rightMargin > screenWidth - btnWidth) {
|
||||
rightMargin = defRightMargin;
|
||||
}
|
||||
if (bottomMargin < 0 || bottomMargin > screenHeight - btnHeight) {
|
||||
bottomMargin = defBottomMargin;
|
||||
}
|
||||
} else {
|
||||
rightMargin = defRightMargin;
|
||||
bottomMargin = defBottomMargin;
|
||||
}
|
||||
params.rightMargin = rightMargin;
|
||||
params.bottomMargin = bottomMargin;
|
||||
quickActionButton.setLayoutParams(params);
|
||||
}
|
||||
|
||||
private int calculateTotalSizePx(@DimenRes int... dimensId) {
|
||||
|
|
|
@ -977,6 +977,9 @@ public class MapInfoWidgetsFactory {
|
|||
updateVisibility(true);
|
||||
AndroidUiHelper.updateVisibility(addressText, false);
|
||||
AndroidUiHelper.updateVisibility(addressTextShadow, false);
|
||||
AndroidUiHelper.updateVisibility(turnIcon, false);
|
||||
AndroidUiHelper.updateVisibility(shieldIcon, false);
|
||||
AndroidUiHelper.updateVisibility(exitRefText, false);
|
||||
} else if (streetName == null) {
|
||||
updateVisibility(false);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue