Advertisement
kernel_memory_dump

Untitled

May 13th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. /**
  2. * Ima init all mah importantz stuffs 'ere
  3. */
  4. public void initMyAwesomeShit() {
  5.  
  6. // first we makez our dialogz and shiet
  7. volumeDialog = new Dialog(ComediaTestActivity.this,
  8. com.comedia.use.R.style.Volume_Dialog);
  9. volumeDialog.getWindow().getAttributes().y = screenHeight / 2;
  10.  
  11. // da key listenah
  12. volumeDialog.setContentView(com.comedia.use.R.layout.seekbar);
  13. volumeDialog.setCancelable(true);
  14. volumeDialog.setOnKeyListener(new OnKeyListener() {
  15.  
  16. // wat to do on da key press man
  17. @Override
  18. public boolean onKey(DialogInterface dialog, int keyCode,
  19. KeyEvent event) {
  20. //SSSHIIIIIETTT
  21. // 22 je RIGHT
  22. // 21 je left
  23.  
  24. Log.e("LOG_TAG", "\n\n\tKEY CODEEEEEEEE\n"+keyCode);
  25. if (keyCode == 136) {
  26. Log.e("LOG_TAG", "VOLUME UP");
  27. try {
  28. double currentVolume = service.getAudioControl()
  29. .getCurrentVolume(liveRouteID);
  30. double nextVolume = currentVolume + 1;
  31. if (nextVolume > 100) {
  32. nextVolume = 100;
  33. }
  34. if (!service.getAudioControl().setCurrentVolume(
  35. liveRouteID, nextVolume)) {
  36. Log.e("LOG_TAG", "Error setting volume");
  37. }
  38. setVolume((int) nextVolume);
  39. } catch (RemoteException e) {
  40. // TODO Auto-generated catch block
  41. e.printStackTrace();
  42. }
  43. return true;
  44. } else if (keyCode == 135) {
  45. Log.e("LOG_TAG", "VOLUME DOWN");
  46. try {
  47. double currentVolume = service.getAudioControl()
  48. .getCurrentVolume(liveRouteID);
  49. double nextVolume = currentVolume - 1;
  50. if (nextVolume < 0) {
  51. nextVolume = 0;
  52. }
  53. if (!service.getAudioControl().setCurrentVolume(
  54. liveRouteID, nextVolume)) {
  55. Log.e("LOG_TAG", "Error setting volume");
  56. }
  57. setVolume((int) nextVolume);
  58. } catch (RemoteException e) {
  59. // TODO Auto-generated catch block
  60. e.printStackTrace();
  61. }
  62. }
  63. return false;
  64. }
  65. });
  66.  
  67. volumeBar = (SeekBar) volumeDialog
  68. .findViewById(com.comedia.use.R.id.seek_bar);
  69. volumeBar.setMax(100);
  70. volumeBar.setProgress(50);
  71. volumeBar.setFocusable(false);
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement