Fixes - context menu + download maps layer
This commit is contained in:
parent
fd80843baf
commit
2ff332c49e
2 changed files with 36 additions and 15 deletions
|
@ -222,6 +222,9 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
updateButtonsAndProgress();
|
updateButtonsAndProgress();
|
||||||
|
|
||||||
if (menu.isLandscapeLayout()) {
|
if (menu.isLandscapeLayout()) {
|
||||||
|
final TypedValue typedValueAttr = new TypedValue();
|
||||||
|
getMapActivity().getTheme().resolveAttribute(R.attr.left_menu_view_bg, typedValueAttr, true);
|
||||||
|
mainView.setBackgroundResource(typedValueAttr.resourceId);
|
||||||
mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
|
mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
View fabContainer = view.findViewById(R.id.context_menu_fab_container);
|
View fabContainer = view.findViewById(R.id.context_menu_fab_container);
|
||||||
|
@ -339,6 +342,11 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
// FAB
|
// FAB
|
||||||
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
|
fabView = (ImageView)view.findViewById(R.id.context_menu_fab_view);
|
||||||
if (menu.fabVisible()) {
|
if (menu.fabVisible()) {
|
||||||
|
if (menu.isLandscapeLayout()) {
|
||||||
|
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) fabView.getLayoutParams();
|
||||||
|
params.setMargins(0, 0, dpToPx(28f), 0);
|
||||||
|
fabView.setLayoutParams(params);
|
||||||
|
}
|
||||||
fabView.setOnClickListener(new View.OnClickListener() {
|
fabView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -184,19 +184,19 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
|
||||||
final List<BinaryMapDataObject> selectedObjects = new LinkedList<>(this.selectedObjects);
|
final List<BinaryMapDataObject> selectedObjects = new LinkedList<>(this.selectedObjects);
|
||||||
|
|
||||||
if (selectedObjects.size() > 0) {
|
if (selectedObjects.size() > 0) {
|
||||||
currentObjects.removeAll(selectedObjects);
|
removeObjectsFromList(currentObjects, selectedObjects);
|
||||||
drawBorders(canvas, tileBox, selectedObjects, pathSelected, paintSelected);
|
drawBorders(canvas, tileBox, selectedObjects, pathSelected, paintSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS) {
|
if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS) {
|
||||||
downloadingObjects.removeAll(selectedObjects);
|
removeObjectsFromList(downloadingObjects, selectedObjects);
|
||||||
if (downloadingObjects.size() > 0) {
|
if (downloadingObjects.size() > 0) {
|
||||||
currentObjects.removeAll(downloadingObjects);
|
removeObjectsFromList(currentObjects, downloadingObjects);
|
||||||
drawBorders(canvas, tileBox, downloadingObjects, pathDownloading, paintDownloading);
|
drawBorders(canvas, tileBox, downloadingObjects, pathDownloading, paintDownloading);
|
||||||
}
|
}
|
||||||
outdatedObjects.removeAll(selectedObjects);
|
removeObjectsFromList(outdatedObjects, selectedObjects);
|
||||||
if (outdatedObjects.size() > 0) {
|
if (outdatedObjects.size() > 0) {
|
||||||
currentObjects.removeAll(outdatedObjects);
|
removeObjectsFromList(currentObjects, outdatedObjects);
|
||||||
drawBorders(canvas, tileBox, outdatedObjects, pathOutdated, paintOutdated);
|
drawBorders(canvas, tileBox, outdatedObjects, pathOutdated, paintOutdated);
|
||||||
}
|
}
|
||||||
if (currentObjects.size() > 0) {
|
if (currentObjects.size() > 0) {
|
||||||
|
@ -216,6 +216,19 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeObjectsFromList(List<BinaryMapDataObject> list, List<BinaryMapDataObject> objects) {
|
||||||
|
Iterator<BinaryMapDataObject> it = list.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
BinaryMapDataObject o = it.next();
|
||||||
|
for (BinaryMapDataObject obj : objects) {
|
||||||
|
if (o.getId() == obj.getId()) {
|
||||||
|
it.remove();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void drawBorders(Canvas canvas, RotatedTileBox tileBox, final List<BinaryMapDataObject> objects, Path path, Paint paint) {
|
private void drawBorders(Canvas canvas, RotatedTileBox tileBox, final List<BinaryMapDataObject> objects, Path path, Paint paint) {
|
||||||
path.reset();
|
path.reset();
|
||||||
for (BinaryMapDataObject o : objects) {
|
for (BinaryMapDataObject o : objects) {
|
||||||
|
|
Loading…
Reference in a new issue