~singpolyma/cheogram-android

ee5ae57f9c3b2c7ed9c2fb2c429a6b69bd7f28e5 — Stephen Paul Weber a month ago 2c156af
Allow copying result form fields to clipboard
1 files changed, 11 insertions(+), 0 deletions(-)

M src/main/java/eu/siacs/conversations/entities/Conversation.java
M src/main/java/eu/siacs/conversations/entities/Conversation.java => src/main/java/eu/siacs/conversations/entities/Conversation.java +11 -0
@@ 1,5 1,7 @@
package eu.siacs.conversations.entities;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.DataSetObserver;


@@ 18,6 20,7 @@ import android.widget.ArrayAdapter;
import android.widget.AdapterView;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.Spinner;
import android.webkit.WebView;
import android.webkit.WebViewClient;


@@ 1430,6 1433,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                        }
                    }
                    binding.values.setAdapter(values);

                    ClipboardManager clipboard = binding.getRoot().getContext().getSystemService(ClipboardManager.class);
                    binding.values.setOnItemLongClickListener((arg0, arg1, pos, id) -> {
                        ClipData myClip = ClipData.newPlainText("text", values.getItem(pos));
                        clipboard.setPrimaryClip(myClip);
                        Toast.makeText(binding.getRoot().getContext(), R.string.message_copied_to_clipboard, Toast.LENGTH_SHORT).show();
                        return true;
                    });
                }
            }