diff --git a/OsmAnd/res/drawable/bg_select_group_button_outline.xml b/OsmAnd/res/drawable/bg_select_group_button_outline.xml
new file mode 100644
index 0000000000..6da75bff64
--- /dev/null
+++ b/OsmAnd/res/drawable/bg_select_group_button_outline.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/point_editor_fragment_new.xml b/OsmAnd/res/layout/point_editor_fragment_new.xml
index 021a557c78..8485334370 100644
--- a/OsmAnd/res/layout/point_editor_fragment_new.xml
+++ b/OsmAnd/res/layout/point_editor_fragment_new.xml
@@ -101,8 +101,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="60dp"
- android:layout_marginEnd="48dp"
- android:layout_marginRight="48dp"
+ android:drawableRight="@drawable/btn_circle_transparent_full"
android:inputType="textMultiLine"
android:maxLines="4"
android:scrollHorizontally="false"
@@ -171,57 +170,84 @@
-
-
+ android:gravity="center_vertical"
+ android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
+ android:orientation="vertical">
+
+
+ android:orientation="horizontal">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
index 0213af5f3c..7a6f53765d 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java
@@ -16,6 +16,8 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
@@ -23,10 +25,13 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.textfield.TextInputLayout;
import net.osmand.AndroidUtils;
+import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@@ -35,6 +40,10 @@ import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
import net.osmand.util.Algorithms;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private View view;
@@ -43,6 +52,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private Button addDelDescription;
private boolean cancelled;
private boolean nightMode;
+ GroupAdapter groupListAdapter;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
@@ -208,6 +218,26 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
addDelDescription.setText(app.getString(R.string.add_description));
}
}
+
+ groupListAdapter = new GroupAdapter(app);
+
+ groupListAdapter.setItemClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+// int position = recyclerView.getChildAdapterPosition(v);
+// if (position == RecyclerView.NO_POSITION) {
+// return;
+// }
+// selectFavorite(favouritePoints.get(position));
+ }
+ });
+
+ LinearLayoutManager layoutManager = new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false);
+ RecyclerView recyclerView = view.findViewById(R.id.group_recycler_view);
+ recyclerView.setAdapter(groupListAdapter);
+ recyclerView.setLayoutManager(layoutManager);
+ groupListAdapter.notifyDataSetChanged();
+
return view;
}
@@ -421,4 +451,86 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
protected Drawable getPaintedIcon(int iconId, int color) {
return getPaintedContentIcon(iconId, color);
}
+
+ class GroupAdapter extends RecyclerView.Adapter {
+
+ private static final int VIEW_TYPE_FOOTER = 1;
+ private static final int VIEW_TYPE_CELL = 0;
+ View.OnClickListener listener;
+ OsmandApplication app;
+ List items;
+
+ public GroupAdapter(OsmandApplication app) {
+ this.app = app;
+ items = app.getFavorites().getFavoriteGroups();
+ }
+
+ @NonNull
+ @Override
+ public GroupsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view;
+ if (viewType == VIEW_TYPE_CELL) {
+ view = LayoutInflater.from(parent.getContext()).inflate(R.layout.point_group_select_item, parent, false);
+ view.setOnClickListener(listener);
+ } else {
+ view = LayoutInflater.from(parent.getContext()).inflate(R.layout.point_group_select_item, parent, false);
+ ((ImageView) view.findViewById(R.id.groupIcon)).setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_add));
+ ((TextView) view.findViewById(R.id.groupName)).setText(requireMyApplication().getString(R.string.add_group));
+ }
+ return new GroupsViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull GroupsViewHolder holder, int position) {
+ if (position == items.size()) {
+ holder.groupButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Set categories = new HashSet<>();
+ for (FavouritesDbHelper.FavoriteGroup fg : items) {
+ categories.add(fg.getDisplayName(app));
+ }
+ EditCategoryDialogFragment dialogFragment =
+ EditCategoryDialogFragment.createInstance("editorTag", categories, false);
+ dialogFragment.show(getActivity().getSupportFragmentManager(), EditCategoryDialogFragment.TAG);
+ }
+ });
+ } else {
+ final FavouritesDbHelper.FavoriteGroup group = items.get(position);
+ holder.groupName.setText(group.getDisplayName(getMyApplication()));
+ holder.pointsCounter.setText(String.valueOf(group.getPoints().size()));
+ }
+ }
+
+ @Override
+ public int getItemViewType(int position) {
+ return (position == items.size()) ? VIEW_TYPE_FOOTER : VIEW_TYPE_CELL;
+ }
+
+ @Override
+ public int getItemCount() {
+ return items == null ? 0 : items.size() + 1;
+ }
+
+ public void setItemClickListener(View.OnClickListener listener) {
+ this.listener = listener;
+ }
+ }
+
+ class GroupsViewHolder extends RecyclerView.ViewHolder {
+
+ final TextView pointsCounter;
+ final TextView groupName;
+ final ImageView groupIcon;
+ final ImageView groupButton;
+
+
+ public GroupsViewHolder(View itemView) {
+ super(itemView);
+ pointsCounter = (TextView) itemView.findViewById(R.id.counter);
+ groupName = (TextView) itemView.findViewById(R.id.groupName);
+ groupIcon = (ImageView) itemView.findViewById(R.id.groupIcon);
+ groupButton = (ImageView) itemView.findViewById(R.id.outlineRect);
+ }
+ }
}