diff --git a/OsmAnd/res/layout-land/dashboard_over_map.xml b/OsmAnd/res/layout-land/dashboard_over_map.xml index e708d73936..5ca2bbb8bb 100644 --- a/OsmAnd/res/layout-land/dashboard_over_map.xml +++ b/OsmAnd/res/layout-land/dashboard_over_map.xml @@ -59,6 +59,19 @@ android:background="?attr/bg_color" android:fadeScrollbars="true" > + + + diff --git a/OsmAnd/res/layout/dashboard_over_map.xml b/OsmAnd/res/layout/dashboard_over_map.xml index b25766238e..d136f79247 100644 --- a/OsmAnd/res/layout/dashboard_over_map.xml +++ b/OsmAnd/res/layout/dashboard_over_map.xml @@ -55,11 +55,26 @@ android:layout_height="match_parent" android:visibility="gone" > - + android:layout_height="match_parent" + android:background="?attr/bg_color" + android:gravity="center_horizontal" + android:orientation="vertical"> + + + + + Please add map markers via map + No waypoints found - Creating a group please give it a name and fill in description\n - From the application group are created only with Simple type, read more on the website https://osmo.mobi/g/new \n diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index b2beb75272..4762871e70 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -36,6 +36,7 @@ import com.github.ksoichiro.android.observablescrollview.ObservableScrollView; import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks; import com.github.ksoichiro.android.observablescrollview.ScrollState; +import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.ValueHolder; import net.osmand.data.LatLon; @@ -151,6 +152,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis private int mFlexibleBlurSpaceHeight; private boolean portrait; private long lastUpOrCancelMotionEventTime; + private TextView listEmptyTextView; int baseColor; @@ -218,6 +220,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis //listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); listView.setDrawSelectorOnTop(true); listView.setDynamicListViewCallbacks(this); + listEmptyTextView = (TextView) dashboardView.findViewById(R.id.emptyTextView); // Create a ListView-specific touch listener. ListViews are given special treatment because // by default they handle touches for their list items... i.e. they're in charge of drawing @@ -839,6 +842,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); } else { listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); + listEmptyTextView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)); } if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS && visibleType != DashboardType.MAP_MARKERS_SELECTION) { @@ -853,6 +857,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis listBackgroundView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); } else { listView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); + listEmptyTextView.setBackgroundColor(mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)); } if (visibleType != DashboardType.WAYPOINTS && visibleType != DashboardType.MAP_MARKERS && visibleType != DashboardType.MAP_MARKERS_SELECTION) { @@ -863,6 +868,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis listView.setDivider(null); } } + AndroidUtils.setTextSecondaryColor(mapActivity, listEmptyTextView, nightMode); /* listView.setOverscrollFooter(new ColorDrawable( nightMode ? mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark) @@ -876,6 +882,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis } private void updateListAdapter() { + listEmptyTextView.setVisibility(View.GONE); + listView.setEmptyView(null); ContextMenuAdapter cm = null; if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) { @@ -887,6 +895,15 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis setDynamicListItems(listView, listAdapter); updateListAdapter(listAdapter, listener); + if (listAdapter.getObjects().size() == 0) { + listEmptyTextView.setText(mapActivity.getString(R.string.no_waypoints_found)); + if (landscape) { + listView.setEmptyView(listEmptyTextView); + } else { + listEmptyTextView.setVisibility(View.VISIBLE); + } + } + } else if (DashboardType.MAP_MARKERS == visibleType || visibleType == DashboardType.MAP_MARKERS_SELECTION) { mapMarkerDialogHelper.setSelectionMode(visibleType == DashboardType.MAP_MARKERS_SELECTION); @@ -900,6 +917,15 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis showMarkersRouteOnMap(); } + if (listAdapter.getObjects().size() == 0) { + listEmptyTextView.setText(mapActivity.getString(R.string.no_map_markers_found)); + if (landscape) { + listView.setEmptyView(listEmptyTextView); + } else { + listEmptyTextView.setVisibility(View.VISIBLE); + } + } + } else { if (DashboardType.CONFIGURE_SCREEN == visibleType) {