mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Copy text to clipboard on Long Click (#2411)
* Fixed issue #2405 * Final changes
This commit is contained in:
parent
9867143099
commit
ea45335b4f
3 changed files with 30 additions and 3 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
|
|
@ -237,5 +239,14 @@ public class Utils {
|
|||
}
|
||||
return map;
|
||||
}
|
||||
/*
|
||||
*Copies the content to the clipboard
|
||||
*
|
||||
*/
|
||||
public static void copy(String label,String text, Context context){
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText(label, text);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue