Fix select obj menu
This commit is contained in:
parent
47a6c8d0f8
commit
5cebb6cf5a
4 changed files with 30 additions and 35 deletions
|
@ -1,36 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout android:id="@+id/share_fragment_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/bottom_menu_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_view"
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/bottom_menu_view_bg"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
</ListView>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
|
@ -116,6 +116,10 @@ public class ObjectSelectionMenu extends BaseMenuController {
|
|||
|
||||
public static void show(LatLon latLon, Map<Object, IContextMenuProvider> selectedObjects, MapActivity mapActivity) {
|
||||
|
||||
if (isVisible(mapActivity)) {
|
||||
hide(mapActivity);
|
||||
}
|
||||
|
||||
ObjectSelectionMenu menu = new ObjectSelectionMenu(latLon, mapActivity);
|
||||
menu.createCollection(selectedObjects);
|
||||
ObjectSelectionMenuFragment.showInstance(menu);
|
||||
|
|
|
@ -107,8 +107,6 @@ public class ObjectSelectionMenuFragment extends Fragment implements AdapterView
|
|||
private void buildHeader(View view, MenuObject item, MapActivity mapActivity) {
|
||||
|
||||
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
|
||||
boolean light = mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
|
||||
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
||||
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
|
||||
Drawable icon = item.getLeftIcon();
|
||||
|
@ -118,7 +116,7 @@ public class ObjectSelectionMenuFragment extends Fragment implements AdapterView
|
|||
iconLayout.setVisibility(View.VISIBLE);
|
||||
} else if (iconId != 0) {
|
||||
iconView.setImageDrawable(iconsCache.getIcon(iconId,
|
||||
light ? R.color.osmand_orange : R.color.osmand_orange_dark, 0.75f));
|
||||
menu.isLight() ? R.color.osmand_orange : R.color.osmand_orange_dark, 0.75f));
|
||||
iconLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iconLayout.setVisibility(View.GONE);
|
||||
|
|
|
@ -128,6 +128,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
if (latLon == null) {
|
||||
latLon = getLatLon(point, tileBox);
|
||||
}
|
||||
hideVisibleMenues();
|
||||
menu.show(latLon, pointDescription, selectedObj);
|
||||
return true;
|
||||
|
||||
|
@ -136,6 +137,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
return true;
|
||||
|
||||
} else if (showUnknownLocation) {
|
||||
hideVisibleMenues();
|
||||
menu.show(getLatLon(point, tileBox), null, null);
|
||||
return true;
|
||||
}
|
||||
|
@ -217,6 +219,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||
if (pressedContextMarker(tileBox, point.x, point.y)) {
|
||||
hideVisibleMenues();
|
||||
menu.show();
|
||||
return true;
|
||||
}
|
||||
|
@ -237,11 +240,17 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
}
|
||||
}
|
||||
|
||||
ObjectSelectionMenu.hide(activity);
|
||||
hideVisibleMenues();
|
||||
menu.onSingleTapOnMap();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void hideVisibleMenues() {
|
||||
if (ObjectSelectionMenu.isVisible(activity)) {
|
||||
ObjectSelectionMenu.hide(activity);
|
||||
}
|
||||
}
|
||||
|
||||
private void showContextMenuForSelectedObjects(final LatLon latLon, final Map<Object, IContextMenuProvider> selectedObjects) {
|
||||
ObjectSelectionMenu.show(latLon, selectedObjects, activity);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue