public MockApplication(ApplicationListener listener, int width, int height) { this.listener = listener; // Create stub objects files = new MockFiles(); audio = new MockAudio(); input = new MockInput(); graphics = new MockGraphics(width, height); Gdx.app = this; Gdx.graphics = graphics; Gdx.files = files; Gdx.audio = audio; Gdx.input = input; Gdx.gl = graphics.getGL20(); Gdx.gl20 = graphics.getGL20(); GdxNativesLoader.load(); clipboard = new Clipboard() { private String contents; @Override public String getContents() { return contents; } @Override public void setContents(String content) { this.contents = content; } }; start(); }
@Override public Clipboard getClipboard () { if (clipboard == null) { clipboard = new AndroidClipboard(this); } return clipboard; }
public void importLevel() { String fromClipboard = ""; Clipboard clipboard = Gdx.app.getClipboard(); fromClipboard = clipboard.getContents(); // if (YioGdxGame.ANDROID) { // GetAndroidClipboardContents getAndroidClipboardContents = new GetAndroidClipboardContents(); // getAndroidClipboardContents.run(); // while (!getAndroidClipboardContents.isComplete()) { // try { // Thread.holdsLock(Thread.currentThread()); // Thread.currentThread().wait(100); // System.out.println("waiting!!!!!"); // } catch (InterruptedException e) { // e.printStackTrace(); // } // } // System.out.println("--------------------- 2"); // fromClipboard = getAndroidClipboardContents.getResult(); // } else { // Clipboard clipboard = Gdx.app.getClipboard(); // fromClipboard = clipboard.getContents(); // } if (isValidLevelString(fromClipboard)) { LoadingParameters instance = LoadingParameters.getInstance(); instance.mode = LoadingParameters.MODE_EDITOR_LOAD; instance.applyFullLevel(fromClipboard); instance.colorOffset = 0; LoadingManager.getInstance().startGame(instance); } }
public void exportLevel() { // this was not working properly // String fullLevel = getFullLevelString(); Preferences prefs = Gdx.app.getPreferences(EDITOR_PREFS); String fullLevel = prefs.getString(SLOT_NAME + currentSlotNumber, ""); System.out.println("fullLevel = " + fullLevel); Clipboard clipboard = Gdx.app.getClipboard(); clipboard.setContents(fullLevel); Scenes.sceneNotification.showNotification("exported"); }
@Override public void run() { handler.post(new Runnable() { @Override public void run() { Clipboard clipboard = Gdx.app.getClipboard(); result = clipboard.getContents(); complete = true; System.out.println("---------------------- 1"); } }); }
@Override public Clipboard getClipboard() { if (clipboard == null) { clipboard = new AndroidClipboard(this); } return clipboard; }
public String getContents () { java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Transferable contents = clipboard.getContents(null); if (contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) { try { return (String)contents.getTransferData(DataFlavor.stringFlavor); } catch (Exception ignored) { } } return ""; }
@Override public Clipboard getClipboard () { return new Clipboard() { @Override public void setContents (String content) { UIPasteboard.getGeneralPasteboard().setString(content); } @Override public String getContents () { return UIPasteboard.getGeneralPasteboard().getString(); } }; }
@Override public Clipboard getClipboard () { if (clipboard == null) { clipboard = new AndroidClipboard(service); } return clipboard; }
@Override public Clipboard getClipboard () { if (clipboard == null) { clipboard = new AndroidClipboard(getActivity()); } return clipboard; }
@Override public Clipboard getClipboard() { return new Clipboard() { @Override public String getContents() { return null; } @Override public void setContents(String content) { } }; }
public Clipboard getClipboard() { return new LwjglClipboard(); }
public Clipboard getClipboard () { return clipboard; }
@Override public Clipboard getClipboard() { throw new UnsupportedOperationException(); }
@Override public Clipboard getClipboard() { return null; }
@Override public Clipboard getClipboard() { // TODO Auto-generated method stub return null; }
public void setClipboard (Clipboard clipboard) { this.clipboard = clipboard; }
public void setContents (String content) { java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(content), this); }
public void lostOwnership (java.awt.datatransfer.Clipboard clipboard, Transferable transferable) { }
@Override public Clipboard getClipboard () { return clipboard; }
@Override public Clipboard getClipboard () { // no clipboards for headless apps return null; }
@Override public Clipboard getClipboard () { return new LwjglClipboard(); }
@Override public void setContents (String content) { StringSelection stringSelection = new StringSelection(content); java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, this); }
@Override public void lostOwnership (java.awt.datatransfer.Clipboard arg0, Transferable arg1) { }
public void setClipboard(Clipboard clipboard) { this.clipboard = clipboard; }
@Override public Clipboard getClipboard() { return delegate.getClipboard(); }
@Override public Clipboard getClipboard() { return clipboard; }
@Override public void setContents(String content) { StringSelection stringSelection = new StringSelection(content); java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, this); }
@Override public void lostOwnership(java.awt.datatransfer.Clipboard arg0, Transferable arg1) { }
@Override public Clipboard getClipboard() { return new ServerClipboard(); }
@Override public Clipboard getClipboard() { return new LwjglClipboard(); }