本文整理了Java中android.view.KeyEvent.dispatch()
方法的一些代码示例,展示了KeyEvent.dispatch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.dispatch()
方法的具体详情如下:
包路径:android.view.KeyEvent
类名称:KeyEvent
方法名:dispatch
暂无
代码示例来源:origin: k9mail/k-9
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()");
}
}
代码示例来源:origin: ankidroid/Anki-Android
/**
* 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);
}
}
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源:origin: BCsl/TwoWayGallery
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Gallery steals all key events
return event.dispatch(this, null, null);
}
代码示例来源:origin: binaryroot/CarouselView
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Carousel view steals all key events
return event.dispatch(this, null, null);
}
代码示例来源:origin: kingargyle/adt-leanback-support
@Override
public void handleKey(KeyEvent key) {
key.dispatch(mKeyEventCallback);
}
@Override
代码示例来源:origin: souliss/soulissapp
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Gallery steals all key events
return event.dispatch(this, null, null);
}
代码示例来源:origin: dalong982242260/CarrouselView
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Gallery steals all key events
return event.dispatch(this, null, null);
}
代码示例来源:origin: wuzhendev/android-wgallery
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Gallery steals all key events
return event.dispatch(this, null, null);
}
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源:origin: stackoverflow.com
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);
}
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源:origin: stackoverflow.com
/**
* 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);
}
}
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源:origin: stackoverflow.com
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);
}
代码示例来源:origin: stackoverflow.com
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);
}
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源:origin: fengdai/FragmentMaster
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
final View decor = mActivity.getWindow().getDecorView();
return event.dispatch(mActivity, decor != null ? decor.getKeyDispatcherState() : null, mActivity);
}
代码示例来源:origin: fengdai/FragmentMaster
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
View view = mMasterFragment.getView();
return event.dispatch(mMasterFragment, view != null ? view.getKeyDispatcherState() : null, this);
}
内容来源于网络,如有侵权,请联系作者删除!