8 New, 4 updated patches.
[webos-internals:imagineer1981s-modifications.git] / pandora / pandora-headset-advance-vibrate.patch
1 --- .orig/media/cryptofs/apps/usr/palm/applications/com.palm.pandora/app/core/device_service.js
2 +++ /media/cryptofs/apps/usr/palm/applications/com.palm.pandora/app/core/device_service.js
3 @@ -51,8 +51,8 @@
4         },
5  
6         registerForMediaEvents: function() {
7 -               this.mediaServiceRef = new Mojo.Service.Request('palm://com.palm.keys/media', {
8 -                       method: 'status',
9 +               this.mediaServiceRef = new Mojo.Service.Request('palm://com.palm.mediaevents', {
10 +                       method: 'mediaEvents',
11                         onSuccess: this.mediaCallback,
12                         parameters: {subscribe: true}
13                 });
14 @@ -54,7 +54,7 @@
15                 this.mediaServiceRef = new Mojo.Service.Request('palm://com.palm.keys/media', {
16                         method: 'status',
17                         onSuccess: this.mediaCallback,
18 -                       parameters: {subscribe: true}
19 +                       parameters: {appName: AppConstants.appId, subscribe: true}
20                 });
21         },
22  
23 @@ -118,17 +118,35 @@
24                         return;
25                 }
26  
27 -        if (event.key == "pause" && event.state == "down") {
28 -            AppGlobals.station.pause();
29 -        } else if (event.key == "play" && event.state == "down") {
30 -            AppGlobals.station.pause();
31 -        } else if (event.key == "next" && event.state == "down") {
32 -            AppGlobals.station.skip();
33 -        } else if (event.key == "togglePausePlay" && event.state == "down") {
34 -            AppGlobals.station.pause();
35 -        } else if (event.key == "stop" && event.state == "down") {
36 -            AppGlobals.station.pauseIfPlaying();
37 -        }
38 +               Util.log("media event: " + event.key);
39 +               switch (event.key) {
40 +                       case "next":
41 +                               AppGlobals.station.skip();
42 +                               break;
43 +                               
44 +                       case "nextAndPlay":
45 +                               AppGlobals.station.skip();
46 +                               this.serviceRequest = new Mojo.Service.Request("palm://com.palm.vibrate", {
47 +                                       method: 'vibrate', parameters: { 'period': 0,'duration': 750 }
48 +                               });
49 +                               break;
50 +
51 +                       case "pause":
52 +                               AppGlobals.station.pause();
53 +                               break;
54 +
55 +                       case "play":
56 +                               AppGlobals.station.pause();
57 +                               break;
58 +
59 +                       case "togglePausePlay":
60 +                               AppGlobals.station.pause();
61 +                               break;
62 +
63 +                       case "stop":
64 +                               AppGlobals.station.pauseIfPlaying();
65 +                               break;
66 +               }
67         }
68  
69  });
70 \ No newline at end of file