public void emulateShiftHeld() { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); shiftPressEvent.dispatch(this, null, null); Toast.makeText(getContext() , R.string.select_text_now, Toast.LENGTH_SHORT).show(); } catch (Exception e) { Timber.e(e, "Exception in emulateShiftHeld()"); } }
/** * 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 */ @SuppressWarnings("deprecation") // Tracked separately in Github as #5024 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); } }
private void emulateShiftHeld(WebView view) { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); shiftPressEvent.dispatch(view); Toast.makeText(this, "select_text_now", Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("dd", "Exception in emulateShiftHeld()", e); } }
@Override public boolean dispatchKeyEvent(KeyEvent event) { // Gallery steals all key events return event.dispatch(this, null, null); }
@Override public boolean dispatchKeyEvent(KeyEvent event) { // Carousel view steals all key events return event.dispatch(this, null, null); }
@Override public void handleKey(KeyEvent key) { key.dispatch(mKeyEventCallback); } @Override
@Override public boolean dispatchKeyEvent(KeyEvent event) { // Gallery steals all key events return event.dispatch(this, null, null); }
@Override public boolean dispatchKeyEvent(KeyEvent event) { // Gallery steals all key events return event.dispatch(this, null, null); }
@Override public boolean dispatchKeyEvent(KeyEvent event) { // Gallery steals all key events return event.dispatch(this, null, null); }
public void SelectText(View v) { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ESCAPE, 0, 0); shiftPressEvent.dispatch(v); } catch (Exception e) { throw new AssertionError(e); } }
public void SelectText(){ try{ KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); shiftPressEvent.dispatch(myWebView); }catch(Exception e){ throw new AssertionError(e); }
public void SelectText(View v) { try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ESCAPE, 0, 0); shiftPressEvent.dispatch(v); } catch (Exception e) { throw new AssertionError(e); } }
/** * Select Text in the webview and automatically sends the selected text to the clipboard */ public void selectAndCopyText() { try { KeyEvent shiftPressEvent = new KeyEvent(0,0,KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT,0,0); shiftPressEvent.dispatch(mWebView); } catch (Exception e) { throw new AssertionError(e); } }
public void selectnCopy() { Toast.makeText(WebClass.this,getString(R.string.select_help),Toast.LENGTH_SHORT).show(); try { KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); shiftPressEvent.dispatch(wv); } catch (Exception e) { throw new AssertionError(e); } }
public void selectAndCopyText() { try { Method m = WebView.class.getMethod("emulateShiftHeld", null); m.invoke(this, null); } catch (Exception e) { e.printStackTrace(); // fallback KeyEvent shiftPressEvent = new KeyEvent(0,0, KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT,0,0); shiftPressEvent.dispatch(this); }
public void selectAndCopyText() { try { Method m = WebView.class.getMethod("emulateShiftHeld", null); m.invoke(this, null); } catch (Exception e) { e.printStackTrace(); // fallback KeyEvent shiftPressEvent = new KeyEvent(0,0, KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT,0,0); shiftPressEvent.dispatch(this); }
public void selectAndCopyText() { try { Method m = WebView.class.getMethod("emulateShiftHeld", null); m.invoke(this, null); } catch (Exception e) { e.printStackTrace(); // fallback KeyEvent shiftPressEvent = new KeyEvent(0,0, KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT,0,0); shiftPressEvent.dispatch(this); } }
public void selectAndCopyText() { try { Method m = WebView.class.getMethod("emulateShiftHeld", Boolean.TYPE); m.invoke(BookView.mWebView, false); } catch (Exception e) { e.printStackTrace(); // fallback KeyEvent shiftPressEvent = new KeyEvent(0,0, KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT,0,0); shiftPressEvent.dispatch(this); } }
@Override public boolean dispatchKeyEvent(KeyEvent event) { final View decor = mActivity.getWindow().getDecorView(); return event.dispatch(mActivity, decor != null ? decor.getKeyDispatcherState() : null, mActivity); }
@Override public boolean dispatchKeyEvent(KeyEvent event) { View view = mMasterFragment.getView(); return event.dispatch(mMasterFragment, view != null ? view.getKeyDispatcherState() : null, this); }