forked from joejulian/gio
app/internal/window: [Android] implement clipboard
Updates gio#31 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
package org.gioui;
|
||||
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@@ -37,19 +35,5 @@ public final class Gio {
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeClipboard(Context ctx, String s) {
|
||||
ClipboardManager m = (ClipboardManager)ctx.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
m.setPrimaryClip(ClipData.newPlainText(null, s));
|
||||
}
|
||||
|
||||
private static String readClipboard(Context ctx) {
|
||||
ClipboardManager m = (ClipboardManager)ctx.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData c = m.getPrimaryClip();
|
||||
if (c == null || c.getItemCount() < 1) {
|
||||
return null;
|
||||
}
|
||||
return c.getItemAt(0).coerceToText(ctx).toString();
|
||||
}
|
||||
|
||||
static private native void runGoMain(byte[] dataDir, Context context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user