當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyEvent.KEYCODE_VOLUME_DOWN屬性代碼示例

本文整理匯總了Java中android.view.KeyEvent.KEYCODE_VOLUME_DOWN屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.KEYCODE_VOLUME_DOWN屬性的具體用法?Java KeyEvent.KEYCODE_VOLUME_DOWN怎麽用?Java KeyEvent.KEYCODE_VOLUME_DOWN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.view.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.KEYCODE_VOLUME_DOWN屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setButtonPlumbedToJs

@Override
public void setButtonPlumbedToJs(int keyCode, boolean override) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_VOLUME_DOWN:
        case KeyEvent.KEYCODE_VOLUME_UP:
        case KeyEvent.KEYCODE_BACK:
        case KeyEvent.KEYCODE_MENU:
            // TODO: Why are search and menu buttons handled separately?
            if (override) {
                boundKeyCodes.add(keyCode);
            } else {
                boundKeyCodes.remove(keyCode);
            }
            return;
        default:
            throw new IllegalArgumentException("Unsupported keycode: " + keyCode);
    }
}
 
開發者ID:alex-shpak,項目名稱:keemob,代碼行數:18,代碼來源:CordovaWebViewImpl.java

示例2: dispatchKeyEvent

/**
 * Clients can call this method to delegate handling of the volume. Clients should override
 * {@code dispatchEvent} and call this method:
 * <pre>
 public boolean dispatchKeyEvent(KeyEvent event) {
     if (mCastManager.onDispatchVolumeKeyEvent(event, VOLUME_DELTA)) {
        return true;
     }
     return super.dispatchKeyEvent(event);
 }
 * </pre>
 * @param event The dispatched event.
 * @param volumeDelta The amount by which volume should be increased or decreased in each step
 * @return <code>true</code> if volume is handled by the library, <code>false</code> otherwise.
 */
public boolean onDispatchVolumeKeyEvent(KeyEvent event, double volumeDelta) {
    if (isConnected()) {
        boolean isKeyDown = event.getAction() == KeyEvent.ACTION_DOWN;
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_VOLUME_UP:
                if (changeVolume(volumeDelta, isKeyDown)) {
                    return true;
                }
                break;
            case KeyEvent.KEYCODE_VOLUME_DOWN:
                if (changeVolume(-volumeDelta, isKeyDown)) {
                    return true;
                }
                break;
        }
    }
    return false;
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:33,代碼來源:VideoCastManager.java

示例3: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
        Toast.makeText(this, "Volume Up", Toast.LENGTH_LONG).show();
        currentVolume += 0.1;
        if (currentVolume >= 1) currentVolume = 1;
        jobManager.addJobInBackground(new SetVolumeJob(currentVolume));
        return true;
    }

    if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
        Toast.makeText(this, "Volume Down", Toast.LENGTH_LONG).show();
        currentVolume -= 0.1;
        if (currentVolume <= 0) currentVolume = 0;
        jobManager.addJobInBackground(new SetVolumeJob(currentVolume));
        return true;
    }

    return super.onKeyDown(keyCode, event);
}
 
開發者ID:anikraj1994,項目名稱:Remote,代碼行數:21,代碼來源:Home.java

示例4: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    // Handle volume key usage for navigation
    if (mSettings.useVolumeKeysForNavigation() && mPresenterVisible) {
        if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
            onNextSlide();
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
            onPrevSlide();
            return true;
        }
    }
    return super.onKeyUp(keyCode, event);
}
 
開發者ID:FelixWohlfrom,項目名稱:Presenter-Client-Android,代碼行數:14,代碼來源:BluetoothConnector.java

示例5: _isRunKey

boolean _isRunKey(int keyCode){
	switch(keyCode){
	case KeyEvent.KEYCODE_BUTTON_R1:
	case KeyEvent.KEYCODE_BUTTON_R2:
	case KeyEvent.KEYCODE_BUTTON_L1:
	case KeyEvent.KEYCODE_BUTTON_L2:
	case KeyEvent.KEYCODE_VOLUME_UP:
	case KeyEvent.KEYCODE_VOLUME_DOWN:
		return true;
	default: return false;
	}
}
 
開發者ID:efroemling,項目名稱:bombsquad-remote-android,代碼行數:12,代碼來源:GamePadActivity.java

示例6: 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_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL;
  if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) {
    if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE) {
      if (mMediaPlayer.isPlaying()) {
        pause();
        mMediaController.show();
      } else {
        start();
        mMediaController.hide();
      }
      return true;
    } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) {
      if (!mMediaPlayer.isPlaying()) {
          start();
          mMediaController.hide();
      }
      return true;
    } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
      if (mMediaPlayer.isPlaying()) {
        pause();
        mMediaController.show();
      }
      return true;
    } else {
      toggleMediaControlsVisiblity();
    }
  }

  return super.onKeyDown(keyCode, event);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:32,代碼來源:VideoView.java

示例7: onKeyDown

@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
    debug = !debug;
    requestRender();
    onSetDebug(debug);
    return true;
  }
  return super.onKeyDown(keyCode, event);
}
 
開發者ID:PallabPaul,項目名稱:AI_Calorie_Counter_Demo,代碼行數:10,代碼來源:CameraActivity.java

示例8: 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 && mMediaController != null) {
        if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK ||
                keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
            if (mMediaPlayer.isPlaying()) {
                pause();
                mMediaController.show();
            } else {
                start();
                mMediaController.hide();
            }
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) {
            if (!mMediaPlayer.isPlaying()) {
                start();
                mMediaController.hide();
            }
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
                || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) {
            if (mMediaPlayer.isPlaying()) {
                pause();
                mMediaController.show();
            }
            return true;
        } else {
            toggleMediaControlsVisiblity();
        }
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:wheat7,項目名稱:VRPlayer,代碼行數:39,代碼來源:PlayerView.java

示例9: onKeyDown

@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
        debug = !debug;
        requestRender();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:hpi-xnor,項目名稱:android-image-classification,代碼行數:9,代碼來源:MainActivity.java

示例10: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch(keyCode){
    case KeyEvent.KEYCODE_BACK:
    	Intent i=new Intent(this, MainActivity.class);
        i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        Bundle bundle = new Bundle();
        i.putExtra("currentfolder", currentfolder);
        startActivity(i);

        return true;
        
    case KeyEvent.KEYCODE_MENU:
    	if (currentactivity == 1)
    		createToast(currentfolder);
    	return true;
        
    case KeyEvent.KEYCODE_VOLUME_DOWN:
    	vd_pressed = true;
		return true;
		
    case KeyEvent.KEYCODE_VOLUME_UP:
    	if (volupholdur < 999999)
    	{
    	voluphold = System.currentTimeMillis();
    	volupholdur = 10000000; 
    	}
		return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:flatt3rn,項目名稱:raspicon,代碼行數:31,代碼來源:MainActivity.java

示例11: onKeyUp

@Override
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
    SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean navigate = defaultSharedPreferences.
            getBoolean(SettingsFragment.PREF_USE_VOLUME_KEY_NAV, false);
    boolean b = false;
    if (navigate && keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
        mTurnPageByVolumeDownKey = true;
        b = true;
    } else if (navigate && keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
        mTurnPageByVolumeUpKey = true;
        b = true;
    }
    return b || super.onKeyUp(keyCode, event);
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:15,代碼來源:ReadingActivity.java

示例12: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_BACK:
            if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
                mTocListPopupWindow.dismiss();
                gone(mTvBookReadTocTitle);
                visible(mTvBookReadReading, mTvBookReadCommunity, mTvBookReadChangeSource);
                return true;
            } else if (isVisible(rlReadAaSet)) {
                gone(rlReadAaSet);
                return true;
            } else if (isVisible(mLlBookReadBottom)) {
                hideReadBar();
                return true;
            } else if (!CollectionsManager.getInstance().isCollected(bookId)) {
                showJoinBookShelfDialog(recommendBooks);
                return true;
            }
            break;
        case KeyEvent.KEYCODE_MENU:
            toggleReadBar();
            return true;
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            if (SettingManager.getInstance().isVolumeFlipEnable()) {
                return true;
            }
            break;
        case KeyEvent.KEYCODE_VOLUME_UP:
            if (SettingManager.getInstance().isVolumeFlipEnable()) {
                return true;
            }
            break;
        default:
            break;
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:ynztlxdeai,項目名稱:TextReader,代碼行數:38,代碼來源:ReadActivity.java

示例13: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
  int action = event.getAction();
  int keyCode = event.getKeyCode();
  if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
    if (action == KeyEvent.ACTION_DOWN) {
      ((AndroidCompatibility) Compatibility.get()).modifier = true;
    } else if (action == KeyEvent.ACTION_UP) {
      ((AndroidCompatibility) Compatibility.get()).modifier = false;
    }
  }
  return super.dispatchKeyEvent(event);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:13,代碼來源:AndroidLauncher.java

示例14: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    Log.d(THIS_FILE, "Key up : " + keyCode);
    switch (keyCode) {
        case KeyEvent.KEYCODE_VOLUME_DOWN:
        case KeyEvent.KEYCODE_VOLUME_UP:
        case KeyEvent.KEYCODE_CALL:
        case KeyEvent.KEYCODE_SEARCH:
            return true;
        case KeyEvent.KEYCODE_ENDCALL:
            return inCallAnswerControls.onKeyDown(keyCode, event);

    }
    return super.onKeyUp(keyCode, event);
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:15,代碼來源:InCallActivity.java

示例15: 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 && mMediaController != null)
    {
        if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE)
        {
            if (mMediaPlayer.isPlaying())
            {
                pause();
                mMediaController.show();
            }
            else
            {
                start();
                mMediaController.hide();
            }
            return true;
        }
        else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY)
        {
            if (!mMediaPlayer.isPlaying())
            {
                start();
                mMediaController.hide();
            }
            return true;
        }
        else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE)
        {
            if (mMediaPlayer.isPlaying())
            {
                pause();
                mMediaController.show();
            }
            return true;
        }
        else
        {
            toggleMediaControlsVisiblity();
        }
    }
    
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:Dreamxiaoxuan,項目名稱:AndroidTvDemo,代碼行數:49,代碼來源:IjkVideoView.java


注:本文中的android.view.KeyEvent.KEYCODE_VOLUME_DOWN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。