List of usage examples for android.view KeyEvent dispatch
@Deprecated public final boolean dispatch(Callback receiver)
From source file:org.zirco.ui.activities.MainActivity.java
/** * Select Text in the webview and automatically sends the selected text to the clipboard. */// w w w. j av a 2 s. c o m public void swithToSelectAndCopyTextMode() { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); shiftPressEvent.dispatch(mCurrentWebView); } catch (Exception e) { throw new AssertionError(e); } }
From source file:com.ichi2.anki.AbstractFlashcardViewer.java
/** * Select Text in the webview and automatically sends the selected text to the clipboard. From * http://cosmez.blogspot.com/2010/04/webview-emulateshiftheld-on-android.html *///from w ww.j ava2 s . c o m private void selectAndCopyText() { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); shiftPressEvent.dispatch(mCard); shiftPressEvent.isShiftPressed(); mIsSelecting = true; } catch (Exception e) { throw new AssertionError(e); } }
From source file:com.hichinaschool.flashcards.anki.Reviewer.java
/** * Select Text in the webview and automatically sends the selected text to the clipboard. From * http://cosmez.blogspot.com/2010/04/webview-emulateshiftheld-on-android.html *///from w w w .j av a 2 s. com private void selectAndCopyText() { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); if (mCurrentSimpleInterface) { shiftPressEvent.dispatch(mSimpleCard); } else { shiftPressEvent.dispatch(mCard); } shiftPressEvent.isShiftPressed(); mIsSelecting = true; } catch (Exception e) { throw new AssertionError(e); } }