Example usage for android.view KeyEvent KEYCODE_CALL

List of usage examples for android.view KeyEvent KEYCODE_CALL

Introduction

In this page you can find the example usage for android.view KeyEvent KEYCODE_CALL.

Prototype

int KEYCODE_CALL

To view the source code for android.view KeyEvent KEYCODE_CALL.

Click Source Link

Document

Key code constant: Call key.

Usage

From source file:Main.java

public static String getKeyNameByCode(int code) {
    switch (code) {
    case KeyEvent.KEYCODE_0:
        return "<0>";
    case KeyEvent.KEYCODE_1:
        return "<1>";
    case KeyEvent.KEYCODE_2:
        return "<2>";
    case KeyEvent.KEYCODE_3:
        return "<3>";
    case KeyEvent.KEYCODE_4:
        return "<4>";
    case KeyEvent.KEYCODE_5:
        return "<5>";
    case KeyEvent.KEYCODE_6:
        return "<6>";
    case KeyEvent.KEYCODE_7:
        return "<7>";
    case KeyEvent.KEYCODE_8:
        return "<8>";
    case KeyEvent.KEYCODE_9:
        return "<9>";
    case KeyEvent.KEYCODE_A:
        return "<A>";
    case KeyEvent.KEYCODE_B:
        return "<B>";
    case KeyEvent.KEYCODE_C:
        return "<C>";
    case KeyEvent.KEYCODE_D:
        return "<D>";
    case KeyEvent.KEYCODE_E:
        return "<E>";
    case KeyEvent.KEYCODE_F:
        return "<F>";
    case KeyEvent.KEYCODE_G:
        return "<G>";
    case KeyEvent.KEYCODE_H:
        return "<H>";
    case KeyEvent.KEYCODE_I:
        return "<I>";
    case KeyEvent.KEYCODE_J:
        return "<J>";
    case KeyEvent.KEYCODE_K:
        return "<K>";
    case KeyEvent.KEYCODE_L:
        return "<L>";
    case KeyEvent.KEYCODE_M:
        return "<M>";
    case KeyEvent.KEYCODE_N:
        return "<N>";
    case KeyEvent.KEYCODE_O:
        return "<O>";
    case KeyEvent.KEYCODE_P:
        return "<P>";
    case KeyEvent.KEYCODE_Q:
        return "<Q>";
    case KeyEvent.KEYCODE_R:
        return "<R>";
    case KeyEvent.KEYCODE_S:
        return "<S>";
    case KeyEvent.KEYCODE_T:
        return "<T>";
    case KeyEvent.KEYCODE_U:
        return "<U>";
    case KeyEvent.KEYCODE_V:
        return "<V>";
    case KeyEvent.KEYCODE_W:
        return "<W>";
    case KeyEvent.KEYCODE_X:
        return "<X>";
    case KeyEvent.KEYCODE_Y:
        return "<Y>";
    case KeyEvent.KEYCODE_Z:
        return "<Z>";
    case KeyEvent.KEYCODE_APOSTROPHE:
        return "<'>";
    case KeyEvent.KEYCODE_AT:
        return "<@>";
    case KeyEvent.KEYCODE_BACK:
        return "<Back>";
    case KeyEvent.KEYCODE_BACKSLASH:
        return "<\\>";
    case KeyEvent.KEYCODE_CALL:
        return "<Call>";
    case KeyEvent.KEYCODE_CAMERA:
        return "<Camera>";
    case KeyEvent.KEYCODE_CLEAR:
        return "<Clear>";
    case KeyEvent.KEYCODE_COMMA:
        return "<,>";
    case KeyEvent.KEYCODE_DEL:
        return "<Del>";
    case KeyEvent.KEYCODE_DPAD_CENTER:
        return "<PadCenter>";
    case KeyEvent.KEYCODE_DPAD_DOWN:
        return "<PadDown>";
    case KeyEvent.KEYCODE_DPAD_LEFT:
        return "<PadLeft>";
    case KeyEvent.KEYCODE_DPAD_RIGHT:
        return "<PadRight>";
    case KeyEvent.KEYCODE_DPAD_UP:
        return "<PadUp>";
    case KeyEvent.KEYCODE_ENDCALL:
        return "<EndCall>";
    case KeyEvent.KEYCODE_ENTER:
        return "<Enter>";
    case KeyEvent.KEYCODE_ENVELOPE:
        return "<Envelope>";
    case KeyEvent.KEYCODE_EQUALS:
        return "<=>";
    case KeyEvent.KEYCODE_EXPLORER:
        return "<Explorer>";
    case KeyEvent.KEYCODE_FOCUS:
        return "<??? 0>";
    case KeyEvent.KEYCODE_GRAVE:
        return "<??? 1>";
    case KeyEvent.KEYCODE_HEADSETHOOK:
        return "<??? 2>";
    case KeyEvent.KEYCODE_HOME:
        return "<Home>";
    case KeyEvent.KEYCODE_LEFT_BRACKET:
        return "<(>";
    case KeyEvent.KEYCODE_MENU:
        return "<Menu>";
    case KeyEvent.KEYCODE_MINUS:
        return "<->";
    case KeyEvent.KEYCODE_NOTIFICATION:
        return "<??? 3>";
    case KeyEvent.KEYCODE_NUM:
        return "<Num>";
    case KeyEvent.KEYCODE_PERIOD:
        return "<??? 4>";
    case KeyEvent.KEYCODE_PLUS:
        return "<+>";
    case KeyEvent.KEYCODE_POUND:
        return "<??? 5>";
    case KeyEvent.KEYCODE_POWER:
        return "<Power>";
    case KeyEvent.KEYCODE_RIGHT_BRACKET:
        return "<)>";
    case KeyEvent.KEYCODE_SEMICOLON:
        return "<;>";
    case KeyEvent.KEYCODE_SLASH:
        return "</>";
    case KeyEvent.KEYCODE_SOFT_LEFT:
        return "<??? 6>";
    case KeyEvent.KEYCODE_SOFT_RIGHT:
        return "<??? 7>";
    case KeyEvent.KEYCODE_SPACE:
        return "<Space>";
    case KeyEvent.KEYCODE_STAR:
        return "<*>";
    case KeyEvent.KEYCODE_SYM:
        return "<Sym>";
    case KeyEvent.KEYCODE_TAB:
        return "<Tab>";
    case KeyEvent.KEYCODE_VOLUME_DOWN:
        return "<VolumeDown>";
    case KeyEvent.KEYCODE_VOLUME_UP:
        return "<VolumeUp>";
    case KeyEvent.KEYCODE_UNKNOWN:
    default://w w w  .j  a va2s  .c om
        return "<Unknown>";
    }
}

From source file:com.google.android.car.kitchensink.input.InputTestFragment.java

@Nullable
@Override//from   ww  w  .  java  2 s .c om
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.input_test, container, false);

    Collections.addAll(mButtons, BREAK_LINE, createButton(R.string.home, KeyEvent.KEYCODE_HOME),
            createButton(R.string.volume_up, KeyEvent.KEYCODE_VOLUME_UP),
            createButton(R.string.volume_down, KeyEvent.KEYCODE_VOLUME_DOWN),
            createButton(R.string.volume_mute, KeyEvent.KEYCODE_VOLUME_MUTE),
            createButton(R.string.voice, KeyEvent.KEYCODE_VOICE_ASSIST), BREAK_LINE,
            createButton(R.string.music, KeyEvent.KEYCODE_MUSIC),
            createButton(R.string.music_play, KeyEvent.KEYCODE_MEDIA_PLAY),
            createButton(R.string.music_stop, KeyEvent.KEYCODE_MEDIA_STOP),
            createButton(R.string.next_song, KeyEvent.KEYCODE_MEDIA_NEXT),
            createButton(R.string.prev_song, KeyEvent.KEYCODE_MEDIA_PREVIOUS),
            createButton(R.string.tune_right, KeyEvent.KEYCODE_CHANNEL_UP),
            createButton(R.string.tune_left, KeyEvent.KEYCODE_CHANNEL_DOWN), BREAK_LINE,
            createButton(R.string.call_send, KeyEvent.KEYCODE_CALL),
            createButton(R.string.call_end, KeyEvent.KEYCODE_ENDCALL));

    mCarEmulator = CarEmulator.create(getContext());
    addButtonsToPanel((LinearLayout) view.findViewById(R.id.input_buttons), mButtons);

    return view;
}

From source file:android.widget.TiVideoView4.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (mIsPrepared && 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 && mMediaPlayer != null
            && mMediaController != null) {
        if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
            if (mMediaPlayer.isPlaying()) {
                pause();// ww  w  . ja v a  2s  .  co  m
                mMediaController.show();
            } else {
                start();
                mMediaController.hide();
            }
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP && mMediaPlayer.isPlaying()) {
            pause();
            mMediaController.show();
        } else {
            toggleMediaControlsVisiblity();
        }
    }

    return super.onKeyDown(keyCode, event);
}

From source file:CookieVideoView.java

@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();//from  ww w.j  a va  2  s . c o  m
                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);
}

From source file:com.ll.myapplication.vitamio.widget.VideoView.java

@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();/*w w  w  .j  av a 2s. c o m*/
                  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);
  }

From source file:com.csipsimple.ui.incall.CallActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    Log.d(TAG, "Key down : " + keyCode);
    switch (keyCode) {
    case KeyEvent.KEYCODE_VOLUME_DOWN:
    case KeyEvent.KEYCODE_VOLUME_UP:
        ////from   w  w  w. ja v a 2s  .c  om
        // Volume has been adjusted by the user.
        //
        Log.d(TAG, "onKeyDown: Volume button pressed");
        int action = AudioManager.ADJUST_RAISE;
        if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
            action = AudioManager.ADJUST_LOWER;
        }

        // Detect if ringing
        SipCallSession currentCallInfo = getActiveCallInfo();
        // If not any active call active
        if (currentCallInfo == null && serviceConnected) {
            break;
        }

        //TODO: adjust volume here
        if (service != null) {
            try {
                service.adjustVolume(currentCallInfo, action, AudioManager.FLAG_SHOW_UI);
            } catch (RemoteException e) {
                Log.e(TAG, "Can't adjust volume", e);
            }
        }

        return true;
    case KeyEvent.KEYCODE_CALL:
    case KeyEvent.KEYCODE_ENDCALL:
        return inCallAnswerControls.onKeyDown(keyCode, event);
    case KeyEvent.KEYCODE_SEARCH:
        // Prevent search
        return true;
    default:
        // Nothing to do
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.csipsimple.ui.incall.CallActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    Log.d(TAG, "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);

    }/* w w  w.  ja v  a  2 s .  c o m*/
    return super.onKeyUp(keyCode, event);
}

From source file:com.lybeat.lilyplayer.widget.media.IjkVideoView.java

@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();// w  w  w.j  ava 2 s.c  om
                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 {
            toggleMediaControlsVisibility();
        }
    }

    return super.onKeyDown(keyCode, event);
}

From source file:com.xnxs.mediaplayer.widget.media.VRVideoView.java

@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();/*from   w  w w  .j  a v  a2  s  .c om*/
                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);
}