diff --git a/OsmAnd/res/menu/copy_paste_menu.xml b/OsmAnd/res/menu/copy_paste_menu.xml new file mode 100644 index 0000000000..6353a06311 --- /dev/null +++ b/OsmAnd/res/menu/copy_paste_menu.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index f5b024130c..fa45a0f346 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 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 --> + Paste View Waypoints added to map markers Wrong input diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index c813cb04fc..4125591f22 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -1,5 +1,6 @@ package net.osmand.plus.mapmarkers; +import android.content.ClipboardManager; import android.content.Context; import android.os.Bundle; import android.support.annotation.NonNull; @@ -14,6 +15,8 @@ import android.text.InputType; import android.text.TextWatcher; import android.util.TypedValue; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -32,12 +35,15 @@ import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandTextFieldBoxes; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.widgets.IconPopupMenu; import java.util.ArrayList; import java.util.List; import studio.carbonylgroup.textfieldboxes.ExtendedEditText; +import static android.content.Context.CLIPBOARD_SERVICE; + public class CoordinateInputDialogFragment extends DialogFragment { public static final String TAG = "CoordinateInputDialogFragment"; @@ -307,7 +313,33 @@ public class CoordinateInputDialogFragment extends DialogFragment { View.OnLongClickListener editTextOnLongClickListener = new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { - return useOsmandKeyboard; + if (useOsmandKeyboard) { + View focusedView = getDialog().getCurrentFocus(); + if (focusedView != null) { + IconPopupMenu popupMenu = new IconPopupMenu(getContext(), focusedView); + Menu menu = popupMenu.getMenu(); + popupMenu.getMenuInflater().inflate(R.menu.copy_paste_menu, menu); + popupMenu.setOnMenuItemClickListener(new IconPopupMenu.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + ClipboardManager clipboardManager = ((ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE)); + switch (item.getItemId()) { + case R.id.action_copy: + + return true; + case R.id.action_paste: + + return true; + } + return false; + } + }); + popupMenu.show(); + } + return true; + } else { + return false; + } } };