当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.KEYCODE_MENU属性代码示例

本文整理汇总了Java中android.view.KeyEvent.KEYCODE_MENU属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_MENU属性的具体用法?Java KeyEvent.KEYCODE_MENU怎么用?Java KeyEvent.KEYCODE_MENU使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.KEYCODE_MENU属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:26,代码来源:Launcher.java

示例2: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
	if (isOnKeyLongPress) {
		isOnKeyLongPress = false;
		return true;
	}

	switch (keyCode) {
	case KeyEvent.KEYCODE_BACK:
		if (onBottomDragListener != null) {
			onBottomDragListener.onDragBottom(false);
			return true;
		}
		break;
	case KeyEvent.KEYCODE_MENU:
		if (onBottomDragListener != null) {
			onBottomDragListener.onDragBottom(true);
			return true;
		}
		break;
	default:
		break;
	}

	return super.onKeyUp(keyCode, event);
}
 
开发者ID:TommyLemon,项目名称:APIJSON-Android-RxJava,代码行数:26,代码来源:BaseActivity.java

示例3: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        // Ignore the menu key if we are currently dragging or are on the custom content screen
        if (!isOnCustomContent() && !mDragController.isDragging()) {
            // Close any open folders
            closeFolder();

            // Close any shortcuts containers
            closeShortcutsContainer();

            // Stop resizing any widgets
            mWorkspace.exitWidgetResizeMode();

            // Show the overview mode if we are on the workspace
            if (mState == State.WORKSPACE && !mWorkspace.isInOverviewMode() &&
                    !mWorkspace.isSwitchingState()) {
                mOverviewPanel.requestFocus();
                showOverviewMode(true, true /* requestButtonFocus */);
            }
        }
        return true;
    }
    return super.onKeyUp(keyCode, event);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:25,代码来源:Launcher.java

示例4: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        // Ignore the menu key if we are currently dragging or are on the custom content screen
        if (!isOnCustomContent() && !mDragController.isDragging()) {
            // Close any open floating view
            AbstractFloatingView.closeAllOpenViews(this);

            // Stop resizing any widgets
            mWorkspace.exitWidgetResizeMode();

            // Show the overview mode if we are on the workspace
            if (mState == State.WORKSPACE && !mWorkspace.isInOverviewMode() &&
                    !mWorkspace.isSwitchingState()) {
                mOverviewPanel.requestFocus();
                showOverviewMode(true, true /* requestButtonFocus */);
            }
        }
        return true;
    }
    return super.onKeyUp(keyCode, event);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:22,代码来源:Launcher.java

示例5: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK &&
            keyCode != KeyEvent.KEYCODE_VOLUME_UP &&
            keyCode != KeyEvent.KEYCODE_VOLUME_DOWN &&
            keyCode != KeyEvent.KEYCODE_VOLUME_MUTE &&
            keyCode != KeyEvent.KEYCODE_MENU &&
            keyCode != KeyEvent.KEYCODE_CALL &&
            keyCode != KeyEvent.KEYCODE_ENDCALL;
    if (isInPlaybackState() && isKeyCodeSupported && mController != null) {
        if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK ||
                keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
            if (isPlaying()) {
                pause();
                //                    mController.setVisibility(VISIBLE);
            } else {
                start();
                //                    mController.setVisibility(GONE);
            }
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) {
            if (!isPlaying()) {
                start();
                //                    mController.setVisibility(GONE);
            }
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
                || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
            if (isPlaying()) {
                pause();
                //                    mController.setVisibility(VISIBLE);
            }
            return true;
        } else {
            //                toggleMediaControlsVisiblity();
        }
    }

    return super.onKeyDown(keyCode, event);
}
 
开发者ID:SethWen,项目名称:GestureVideoView,代码行数:40,代码来源:GestureVideoView.java

示例6: onKeyDown

public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        toggleDrawer();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:7,代码来源:MainActivity.java

示例7: onKeyDown

/**
 * 拦截Menu/KeyBack事件
 */
@Override
public boolean onKeyDown(int key_code, KeyEvent event)
{
	if (key_code == KeyEvent.KEYCODE_BACK)
	{

		if (currentPath.equalsIgnoreCase(sdcard_root_path))
		{
			return super.onKeyDown(key_code, event);
		}
		else if (!currentPath.equals(""))
		{
			// showDirectoryContents(getParent(currentPath));
			onReturnPrevLayer(currentPath);
		}

		return true;
	}
	else if ((key_code == KeyEvent.KEYCODE_MENU) && (allowMenuKey))
	{
		Intent intent = new Intent(this, FileExplorerSettingsActivity.class);
		startActivityForResult(intent, RC_SET_FILE_ROOT);
		return true;
	}
	else
	{
		return super.onKeyDown(key_code, event);
	}
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:32,代码来源:FileExplorerActivity.java

示例8: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        actionBarLayout.onKeyUp(keyCode, event);
    }
    return super.onKeyUp(keyCode, event);
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:7,代码来源:GalleryActivity.java

示例9: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	if (keyCode == KeyEvent.KEYCODE_ENTER) {
		if (mSearch.hasFocus()) {
			searchTheWeb(mSearch.getText().toString());
		}
	} else if ((keyCode == KeyEvent.KEYCODE_MENU) && (Build.VERSION.SDK_INT <= 16)
			&& (Build.MANUFACTURER.compareTo("LGE") == 0)) {
		// Workaround for stupid LG devices that crash
		return true;
	}
	return super.onKeyDown(keyCode, event);
}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:13,代码来源:BrowserActivity.java

示例10: isSystemKey

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public boolean isSystemKey(KeyEvent event, int keyCode) {
	GenericGamepad gamepad = event==null ? null : resolveGamepad(event.getDevice().getDescriptor(), event.getDeviceId());
	if (gamepad!=null && gamepad.getOriginCode(keyCode)!=0) return false;
	
	return 
		keyCode == KeyEvent.KEYCODE_BACK || 
		keyCode == KeyEvent.KEYCODE_MENU ||
		keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || 
		keyCode == KeyEvent.KEYCODE_VOLUME_UP || 
		keyCode == KeyEvent.KEYCODE_VOLUME_MUTE;
}
 
开发者ID:fcatrin,项目名称:retroxlibs,代码行数:12,代码来源:Mapper.java

示例11: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) {
        mReactInstanceManager.showDevOptionsDialog();
        return true;
    }
    return super.onKeyUp(keyCode, event);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:patchedMainActivity.java

示例12: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_MENU) {
    mDevSupportManager.showDevOptionsDialog();
    return true;
  }
  if (mDoubleTapReloadRecognizer.didDoubleTapR(keyCode, getCurrentFocus())) {
    mDevSupportManager.handleReloadJS();
  }
  return super.onKeyUp(keyCode, event);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:11,代码来源:RedBoxDialog.java

示例13: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(@NonNull KeyEvent event) {
    if (event.getKeyCode() == KeyEvent.KEYCODE_MENU && event.getAction() == KeyEvent.ACTION_UP) {
        showOverflowMenu();
        return true;
    }
    return super.dispatchKeyEvent(event);
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:8,代码来源:AbsBaseActivity.java

示例14: dispatchKeyEvent

/**
 * Called to process key events.  You can override this to intercept all
 * key events before they are dispatched to the window.  Be sure to call
 * this implementation for key events that should be handled normally.
 *
 * @param event The key event.
 *
 * @return boolean Return true if this event was consumed.
 */
public boolean dispatchKeyEvent(KeyEvent event) {
    onUserInteraction();

    // Let action bars open menus in response to the menu key prioritized over
    // the window handling it
    final int keyCode = event.getKeyCode();
    if (keyCode == KeyEvent.KEYCODE_MENU &&
            mActionBar != null && mActionBar.onMenuKeyEvent(event)) {
        return true;
    } else if (event.isCtrlPressed() &&
            event.getUnicodeChar(event.getMetaState() & ~KeyEvent.META_CTRL_MASK) == '<') {
        // Capture the Control-< and send focus to the ActionBar
        final int action = event.getAction();
        if (action == KeyEvent.ACTION_DOWN) {
            final ActionBar actionBar = getActionBar();
            if (actionBar != null && actionBar.isShowing() && actionBar.requestFocus()) {
                mEatKeyUpEvent = true;
                return true;
            }
        } else if (action == KeyEvent.ACTION_UP && mEatKeyUpEvent) {
            mEatKeyUpEvent = false;
            return true;
        }
    }

    Window win = getWindow();
    if (win.superDispatchKeyEvent(event)) {
        return true;
    }
    View decor = mDecor;
    if (decor == null) decor = win.getDecorView();
    return event.dispatch(this, decor != null
            ? decor.getKeyDispatcherState() : null, this);
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:43,代码来源:a.java

示例15: onKey

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if(event.getKeyCode() == KeyEvent.KEYCODE_MENU && event.getAction() != KeyEvent.ACTION_DOWN) {
        return false;
    }
    dismiss();
    return true;
}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:8,代码来源:OverflowHelper.java


注:本文中的android.view.KeyEvent.KEYCODE_MENU属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。