summaryrefslogtreecommitdiff
path: root/platform/android/java
diff options
context:
space:
mode:
authorXavier Sellier <xsellier@gmail.com>2018-04-03 11:58:17 -0400
committerXavier Sellier <xsellier@gmail.com>2018-09-05 17:27:45 -0400
commitf68e1270797b169e9a31ad5b45f6dd0a2041a27d (patch)
treeed9829bdc0f6974c28b024011369d94c8519cebf /platform/android/java
parent3a8f8381f210aebf6cb2279f14f8377706438d9c (diff)
Add clipboard operation for android OS
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index ef798fc790..92c9be5d43 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -59,6 +59,9 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.media.MediaPlayer;
+import android.content.ClipboardManager;
+import android.content.ClipData;
+
import java.lang.reflect.Method;
import java.util.List;
import java.util.ArrayList;
@@ -103,6 +106,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
private TextView mAverageSpeed;
private TextView mTimeRemaining;
private ProgressBar mPB;
+ private ClipboardManager mClipboard;
private View mDashboard;
private View mCellMessage;
@@ -441,6 +445,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
Window window = getWindow();
//window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+ mClipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
//check for apk expansion API
if (true) {
@@ -607,6 +612,24 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
}
}
+ public String getClipboard() {
+
+ String copiedText = "";
+
+ if (mClipboard.getPrimaryClip() != null) {
+ ClipData.Item item = mClipboard.getPrimaryClip().getItemAt(0);
+ copiedText = item.getText().toString();
+ }
+
+ return copiedText;
+ }
+
+ public void setClipboard(String p_text) {
+
+ ClipData clip = ClipData.newPlainText("myLabel", p_text);
+ mClipboard.setPrimaryClip(clip);
+ }
+
@Override
protected void onResume() {
super.onResume();