commiting top bar battery icon and vertical percent patch.
[webos-internals:skurriers-modifications.git] / top-bar / top-bar-battery-icon-and-vertical-percent.patch
1 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2 index 6d0a87a..6509bbb 100644
3 --- a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
4 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
5 @@ -1993,8 +1993,9 @@ handlePowerNotifications: function(payload) {
6                         // Show the battery level if not charging
7                         if (!this.isCharging) {
8                                 Mojo.Log.info("SystemUI- Is Charging "+ this.isCharging + " Battery level "+ i);
9 -                               Mojo.Dom.get('power').className = 'battery-' + i;
10 -                               
11 +                               Mojo.Dom.get('power').className = 'battery';
12 +                               Mojo.Dom.get('power').innerHTML = '<img src="images/battery-' + i + '.png" /><div style="-webkit-transform: rotate(-90deg); position: absolute; left: 162px; top: 1px; text-align: center; font-size: 10px">' + payload.percent_ui + '%</div>';
13 +
14                                 //Show Banner Message if the Battery level is below 20%
15                                 var batteryalert = $L("#{percent_ui}% battery remaining").interpolate(payload); 
16                                 if(this.batteryLevel <= 5 && !this.batteryLevel5Shown) {
17 @@ -2027,11 +2028,12 @@ handlePowerNotifications: function(payload) {
18                         }
19                         else {
20                                 Mojo.Log.info("SystemUI- Is Charging "+ this.isCharging );
21 -                               if(payload.percent_ui == 100)
22 -                                       Mojo.Dom.get('power').className = 'battery-charged';
23 -                               else
24 -                                       Mojo.Dom.get('power').className = 'battery-charging-' + i;
25 -                                       
26 +                               $('power').className = 'battery';
27 +                               if (payload.percent_ui == 100) {
28 +                                   Mojo.Dom.get('power').innerHTML = '<img src="images/battery-charged.png" /><div style="-webkit-transform: rotate(-90deg); position: absolute; left: 162px; top: 1px; text-align: center; font-size: 10px">' + payload.percent_ui + '%</div>';
29 +                               } else {
30 +                                   Mojo.Dom.get('power').innerHTML = '<img src="images/battery-charging-' + i + '.png" /><div style="-webkit-transform: rotate(-90deg); position: absolute; left: 162px; top: 1px; text-align: center; font-size: 10px">' + payload.percent_ui + '%</div>';
31 +                               }
32                         }
33                         
34                         if(this.batteryLevel > 5 && this.batteryLevel <= 10) {                          
35 @@ -2075,11 +2077,12 @@ handlePowerNotifications: function(payload) {
36                                                 
37                 if (this.isCharging) {
38                         Mojo.Log.info("SystemUI- Charger Notification "+ this.isCharging + " Last battery level "+ this.lastBatteryLevel);
39 -                       if(this.batteryLevel == 100)
40 -                               Mojo.Dom.get('power').className = 'battery-charged';
41 -                       else
42 -                               Mojo.Dom.get('power').className = 'battery-charging-' + this.lastBatteryLevel;
43 -                                               
44 +                       Mojo.Dom.get('power').className = 'battery';
45 +                       if (this.batteryLevel == 100) {
46 +                           Mojo.Dom.get('power').innerHTML = '<img src="images/battery-charged.png" /><div style="-webkit-transform: rotate(-90deg); position: absolute; left: 162px; top: 1px; text-align: center; font-size: 10px">' + this.batteryLevel + '%</div>';
47 +                       } else {
48 +                           Mojo.Dom.get('power').innerHTML = '<img src="images/battery-charging-' + this.lastBatteryLevel + '.png" /><div style="-webkit-transform: rotate(-90deg); position: absolute; left: 162px; top: 1px; text-align: center; font-size: 10px">' + this.batteryLevel + '%</div>';
49 +                       }
50                         var stageController = Mojo.Controller.getAppController().getStageController("LowBatteryAlert");
51                         if (stageController) {
52                                 stageController.delegateToSceneAssistant("close");
53 @@ -2102,7 +2105,9 @@ handlePowerNotifications: function(payload) {
54                 else {
55                         this.chargingBannerShown = false;                       
56                         Mojo.Log.info("SystemUI- Charger Notification "+ this.isCharging + " Last battery level "+ this.lastBatteryLevel);
57 -                       Mojo.Dom.get('power').className = 'battery-' + this.lastBatteryLevel;   
58 +                       Mojo.Dom.get('power').className = 'battery';
59 +                       Mojo.Dom.get('power').innerHTML = '<img src="images/battery-' + this.lastBatteryLevel + '.png" /><div style="-webkit-transform: rotate(-90deg); position: absolute; left: 162px; top: 1px; text-align: center; font-size: 10px">' + this.batteryLevel + '%</div>';
60 +
61                         Mojo.Controller.getAppController().removeBanner('chargingAlert');       
62                         if (this.batteryLevel < this.minBatThresholdForUpdate) {
63                                 Mojo.Log.info("SystemUI - OTA - Closing All Update Alerts due to battery level dropped below threshold level and charger disconnected.");
64 diff --git a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
65 index f3cacab..06164de 100644
66 --- a/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
67 +++ b/usr/lib/luna/system/luna-systemui/stylesheets/systemui.css
68 @@ -142,7 +142,10 @@ body.palm-default {
69  
70  #power {
71         margin-left: 2px;
72 -       width: 17px;            
73 +       width: 17px;
74 +}
75 +#power.battery {
76 +       width: 32px;
77  }
78  
79  #power.error { background-image: url(../images/battery-error.png); }