diff --git a/OsmAnd/res/layout/fragment_map_markers_groups.xml b/OsmAnd/res/layout/fragment_map_markers_groups.xml index 9779f103f5..74911b1118 100644 --- a/OsmAnd/res/layout/fragment_map_markers_groups.xml +++ b/OsmAnd/res/layout/fragment_map_markers_groups.xml @@ -1,17 +1,28 @@ - + - \ No newline at end of file + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/fragment_marker_add_markers_group_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_marker_add_markers_group_bottom_sheet_dialog.xml new file mode 100644 index 0000000000..baacf61b55 --- /dev/null +++ b/OsmAnd/res/layout/fragment_marker_add_markers_group_bottom_sheet_dialog.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 8b776cf537..00b6b43f1c 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -194,4 +194,6 @@ 5dp 28dp + + 88dp \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2f01ba8056..cc48cd99ee 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,10 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Track waypoints + Favourites group + Add group + You can add group of favourites or track waypoints. Markers on map! Mark places on map by tap. Import groups diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/AddMarkersGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/AddMarkersGroupBottomSheetDialogFragment.java new file mode 100644 index 0000000000..46aa54df21 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/AddMarkersGroupBottomSheetDialogFragment.java @@ -0,0 +1,75 @@ +package net.osmand.plus.mapmarkers; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import net.osmand.plus.R; +import net.osmand.plus.base.MenuBottomSheetDialogFragment; + +public class AddMarkersGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { + + public final static String TAG = "AddMarkersGroupBottomSheetDialogFragment"; + + private AddMarkersGroupFragmentListener listener; + + public void setListener(AddMarkersGroupFragmentListener listener) { + this.listener = listener; + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; + final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_add_markers_group_bottom_sheet_dialog, container); + + if (nightMode) { + ((TextView) mainView.findViewById(R.id.add_group_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark)); + } + + ((ImageView) mainView.findViewById(R.id.favourites_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_fav_dark)); + ((ImageView) mainView.findViewById(R.id.waypoints_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark)); + + mainView.findViewById(R.id.favourites_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (listener != null) { + listener.favouritesOnClick(); + } + dismiss(); + } + }); + mainView.findViewById(R.id.waypoints_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (listener != null) { + listener.waypointsOnClick(); + } + dismiss(); + } + }); + + mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + + setupHeightAndBackground(mainView, R.id.add_markers_group_scroll_view); + + return mainView; + } +} + +interface AddMarkersGroupFragmentListener { + + void favouritesOnClick(); + + void waypointsOnClick(); +} diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java index 00c913ccaa..cbe89b41dc 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java @@ -58,6 +58,12 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL final MapActivity mapActivity = (MapActivity) getActivity(); final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent(); final View mainView = inflater.inflate(R.layout.fragment_map_markers_groups, container, false); + + Fragment addMarkersGroupFragment = getChildFragmentManager().findFragmentByTag(AddMarkersGroupBottomSheetDialogFragment.TAG); + if (addMarkersGroupFragment != null) { + ((AddMarkersGroupBottomSheetDialogFragment) addMarkersGroupFragment).setListener(createAddMarkersGroupFragmentListener()); + } + final EmptyStateRecyclerView recyclerView = (EmptyStateRecyclerView) mainView.findViewById(R.id.list); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @@ -229,9 +235,37 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL emptyImageView.setImageResource(night ? R.drawable.ic_empty_state_marker_group_night : R.drawable.ic_empty_state_marker_group_day); recyclerView.setEmptyView(emptyView); recyclerView.setAdapter(adapter); + + mainView.findViewById(R.id.add_group_fab).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + openAddGroupMenu(); + } + }); return mainView; } + private void openAddGroupMenu() { + AddMarkersGroupBottomSheetDialogFragment fragment = new AddMarkersGroupBottomSheetDialogFragment(); + fragment.setListener(createAddMarkersGroupFragmentListener()); + fragment.setUsedOnMap(false); + fragment.show(getChildFragmentManager(), AddMarkersGroupBottomSheetDialogFragment.TAG); + } + + private AddMarkersGroupFragmentListener createAddMarkersGroupFragmentListener() { + return new AddMarkersGroupFragmentListener() { + @Override + public void favouritesOnClick() { + + } + + @Override + public void waypointsOnClick() { + + } + }; + } + void updateAdapter() { if (adapter != null) { adapter.createDisplayGroups();