當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。