当前位置: 首页>>代码示例>>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;未经允许,请勿转载。