diff --git a/OsmAnd/res/layout/fragment_notes_sort_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_notes_sort_bottom_sheet_dialog.xml new file mode 100644 index 0000000000..a307700dd6 --- /dev/null +++ b/OsmAnd/res/layout/fragment_notes_sort_bottom_sheet_dialog.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index fc0f61819f..e23a3d74a4 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 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 --> + By date + By type Appearance on the map Select track waypoints of which OsmAnd will add to markers Select which favourite group you want to add to markers diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index 37d9f6d914..d187308369 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -174,7 +174,10 @@ public class NotesFragment extends OsmAndListFragment { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - Toast.makeText(getContext(), "Sort", Toast.LENGTH_SHORT).show(); + // todo: handle screen rotation + SortBottomSheetDialogFragment fragment = new SortBottomSheetDialogFragment(); + fragment.setUsedOnMap(false); + fragment.show(getChildFragmentManager(), SortBottomSheetDialogFragment.TAG); return true; } }); diff --git a/OsmAnd/src/net/osmand/plus/audionotes/SortBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/SortBottomSheetDialogFragment.java new file mode 100644 index 0000000000..668c9cc43d --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/audionotes/SortBottomSheetDialogFragment.java @@ -0,0 +1,70 @@ +package net.osmand.plus.audionotes; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup; +import android.widget.ImageView; + +import net.osmand.plus.R; +import net.osmand.plus.base.MenuBottomSheetDialogFragment; + +public class SortBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { + + public static final String TAG = "SortBottomSheetDialogFragment"; + + private SortFragmentListener listener; + + public void setListener(SortFragmentListener 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_notes_sort_bottom_sheet_dialog, null); + + ((ImageView) mainView.findViewById(R.id.by_type_icon)).setImageDrawable(getContentIcon(R.drawable.ic_groped_by_type)); + ((ImageView) mainView.findViewById(R.id.by_date_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_by_date)); + + mainView.findViewById(R.id.by_type_row).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + notifyListenerAndDismiss(); + } + }); + mainView.findViewById(R.id.by_date_row).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + notifyListenerAndDismiss(); + } + }); + mainView.findViewById(R.id.close_row).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + + setupHeightAndBackground(mainView, R.id.scroll_view); + + return mainView; + } + + private void notifyListenerAndDismiss() { + if (listener != null) { + listener.onSortModeChanged(); + } + dismiss(); + } + + interface SortFragmentListener { + void onSortModeChanged(); + } +}