Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-21-2013, 05:19 AM   #1
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Battery % in the tray - KUAL app for kindles is now READY!

Finally we have a tiny app to display the battery % in the system tray. All credits for this go to Eureka (see this post for the original code: https://www.mobileread.com/forums/sho...87&postcount=8).

I've only set up this KUAL launcher and tuned a bit the layout to give it a native look on Kindle Paperwhite. I couldn't test it on Kindle Touch, so every feedback and screenshots on this device are welcome.

Once launched the KUAL shortcut, changes will persist until the next system (or framework) reboot. Its work range is 10%-100%

If it doesn't show the first time, restart kindle and retry.

Update: now it should work properly both on Touch and PW
Update 2: it has been reported that on touches devices it shows in different ways depending on the firmware version. Try to play with marginLeft and marginTop values in the script to fit better your needs, reapplying the patch each time you change something.
Attached Thumbnails
Click image for larger version

Name:	screenshot_2013_10_21T11_04_55+0200.png
Views:	3848
Size:	100.7 KB
ID:	113745  
Attached Files
File Type: zip batterylevel-1.0.1.zip (1.7 KB, 3357 views)

Last edited by Aeris; 10-21-2013 at 10:30 AM. Reason: Added Twobob's code
Aeris is offline   Reply With Quote
Old 10-21-2013, 05:45 AM   #2
brianinmaine
Evangelist
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 456
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
Sucess on a Touch! Looks pretty good - there is a tiny line above the 99% that looks like it might be from the battery icon. Still usable, just not perfect. I haven't looked at code yet.
brianinmaine is offline   Reply With Quote
Advert
Old 10-21-2013, 05:47 AM   #3
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Quote:
Originally Posted by brianinmaine View Post
Sucess on a Touch! Looks pretty good - there is a tiny line above the 99% that looks like it might be from the battery icon. Still usable, just not perfect. I haven't looked at code yet.
I'll make two different versions then. If you post the screenshot I'll try to fix it! Just have to change a single value. Thanks for report
Aeris is offline   Reply With Quote
Old 10-21-2013, 06:05 AM   #4
brianinmaine
Evangelist
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 456
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
percentage doesn't show while plugged in, so a screenshot wouldn't show unless I used kterm? What value to change - paddingTop or Height?
brianinmaine is offline   Reply With Quote
Old 10-21-2013, 06:11 AM   #5
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Yes, you must plug off it, take the screenshot then plug it in again.

Try to set _batteryMeterEl.style.marginTop="-1.6pt";
Aeris is offline   Reply With Quote
Advert
Old 10-21-2013, 06:14 AM   #6
brianinmaine
Evangelist
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 456
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
yep, much nicer. Thanks! I'll probably play around with the numbers a bit to see what I like best.
brianinmaine is offline   Reply With Quote
Old 10-21-2013, 06:16 AM   #7
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Ok, when you are done please send a screenie and your folder so we can make a Kindle touch dedicated zip too, and attach both files to the post. You can take inspiration from kindle PW screen, so we could make an app that looks the same in both models Thank you!
Aeris is offline   Reply With Quote
Old 10-21-2013, 08:57 AM   #8
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
one release fits all :

Code:
#!/bin/sh
SCRIPT=""

PLATFORM="$(cat /sys/devices/platform/mxc_epdc_fb/graphics/fb0/modes)"

if [ "$PLATFORM" = "${PLATFORM/758/}" ]; then
#Touch
#setup touch version of stuff

SCRIPT=`cat << 'JAVASCRIPT' | tr -d '\n' | sed -e 's,",\\\\",g'
(function () {
  var _batteryMeterId = BatteryState.batteryFillDiv,
      _batteryMeterEl = _batteryMeterId && document.getElementById(_batteryMeterId),
      _currentBatteryLevel = nativeBridge.getIntLipcProperty("com.lab126.powerd", "battLevel"),
      _originalResolveLabel = BatteryState.resolveLabel;

  if (!_batteryMeterEl || !_originalResolveLabel) {
    return;
  }

  /* Text should be WHITE to be visible. */      
  _batteryMeterEl.style.color = "white";
  /* Hack style to set vertical alignment of text. */
  _batteryMeterEl.style.lineHeight = "5.2pt";
  /* Add style for smaller font size. */
  _batteryMeterEl.style.fontSize = "7.2pt";
  /* Background color for hiding the battery */
  _batteryMeterEl.style.backgroundColor="black";
  _batteryMeterEl.style.marginTop="-1.6pt";
  _batteryMeterEl.style.marginLeft="-2pt";
  _batteryMeterEl.style.width="20pt";
  _batteryMeterEl.style.minWidth="20pt";
  _batteryMeterEl.style.height="12pt";
  _batteryMeterEl.style.paddingTop="0.8pt";

  if (_currentBatteryLevel) {
    _batteryMeterEl.textContent = _currentBatteryLevel + "%";
  }
      
  BatteryState.resolveLabel = function () {
    var batteryMeterId = BatteryState.batteryFillDiv,
        batteryMeterEl = batteryMeterId && document.getElementById(batteryMeterId);
        
    _originalResolveLabel();
    
    if (batteryMeterEl) {
      batteryMeterEl.textContent = BatteryState.percent + "%";
    }
  };
})();
`

fi


if [ "$PLATFORM" != "${PLATFORM/758/}" ]; then
#It's a PW
#setup PW version of stuff...


SCRIPT=`cat << 'JAVASCRIPT' | tr -d '\n' | sed -e 's,",\\\\",g'
(function () {
  var _batteryMeterId = BatteryState.batteryFillDiv,
      _batteryMeterEl = _batteryMeterId && document.getElementById(_batteryMeterId),
      _currentBatteryLevel = nativeBridge.getIntLipcProperty("com.lab126.powerd", "battLevel"),
      _originalResolveLabel = BatteryState.resolveLabel;

  if (!_batteryMeterEl || !_originalResolveLabel) {
    return;
  }

  /* Text should be WHITE to be visible. */      
  _batteryMeterEl.style.color = "white";
  /* Hack style to set vertical alignment of text. */
  _batteryMeterEl.style.lineHeight = "5.2pt";
  /* Add style for smaller font size. */
  _batteryMeterEl.style.fontSize = "7.2pt";
  /* Background color for hiding the battery */
  _batteryMeterEl.style.backgroundColor="black";
  _batteryMeterEl.style.marginTop="-1.4pt";
  _batteryMeterEl.style.marginLeft="-2pt";
  _batteryMeterEl.style.width="20pt";
  _batteryMeterEl.style.minWidth="20pt";
  _batteryMeterEl.style.height="12pt";
  _batteryMeterEl.style.paddingTop="0.8pt";

  if (_currentBatteryLevel) {
    _batteryMeterEl.textContent = _currentBatteryLevel + "%";
  }
      
  BatteryState.resolveLabel = function () {
    var batteryMeterId = BatteryState.batteryFillDiv,
        batteryMeterEl = batteryMeterId && document.getElementById(batteryMeterId);
        
    _originalResolveLabel();
    
    if (batteryMeterEl) {
      batteryMeterEl.textContent = BatteryState.percent + "%";
    }
  };
})();
`
fi

MESSAGE='{
  "pillowId": "default_status_bar",
  "function": "'${SCRIPT}'"
}'

lipc-set-prop -s com.lab126.pillow interrogatePillow "$MESSAGE"

Last edited by twobob; 10-21-2013 at 11:21 AM. Reason: dont matter if you're black or you're white.
twobob is offline   Reply With Quote
Old 10-21-2013, 10:10 AM   #9
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Package updated, thank you!
Aeris is offline   Reply With Quote
Old 10-21-2013, 10:19 AM   #10
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
small note..

There appears to be a minute disparity in Touch FW versions...

Pictured. Ancient and New.

So, yeah... Just mentioning it.
Attached Thumbnails
Click image for larger version

Name:	screenshot_2013-10-21T15_05_41-0100.gif
Views:	1194
Size:	13.6 KB
ID:	113781   Click image for larger version

Name:	screenshot_2013_10_21T14_15_31+0000.png
Views:	1067
Size:	7.1 KB
ID:	113782  
twobob is offline   Reply With Quote
Old 10-21-2013, 10:24 AM   #11
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Ok, if anybody see it in some bady way just ask. P.s. TO USERS: in the new (or old) version maybe it could look better with a positive and sligthly higher marginLeft value instead, in the other, it needs a more negative marginTop.

Last edited by Aeris; 10-21-2013 at 10:30 AM.
Aeris is offline   Reply With Quote
Old 10-21-2013, 11:18 AM   #12
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by twobob View Post
Code:
  ...
  /* Text should be black to be visible. */      
  _batteryMeterEl.style.color = "white";
Ugh, OK...

P.S. Just joking.
eureka is offline   Reply With Quote
Old 10-21-2013, 11:20 AM   #13
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
heh yeah I clocked that too...

in your original that was of course the case

I'll edit my posted code. just for the sake of it.
twobob is offline   Reply With Quote
Old 10-21-2013, 11:21 AM   #14
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Ahahahah my bad, I forgot to change it xD
Aeris is offline   Reply With Quote
Old 10-21-2013, 11:31 AM   #15
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Do you think guys that it would be easy, for example, with a similar approach, turn the wifi tray icon into a switch for the wifi off/on property? Inejcting some javascript as in this case... or javascript can't launch lipc commands?
Aeris is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
support for IBM/360/370/S-390 code on the Kindles (KUAL) knc1 Kindle Developer's Corner 63 01-08-2014 06:02 PM
Bible app for e-ink Kindles (Kindle Active Content) draytonbenner Self-Promotions by Authors and Publishers 0 10-18-2012 10:23 AM
iPad Amazon’s Kindle iOS app now ready for the new iPad’s Retina*Display monkeyluis Apple Devices 9 03-18-2012 08:27 PM
A tray app for Calibre ? thomass Calibre 3 08-21-2011 05:19 PM
So is the Iliad really production ready and is the market ready for e-readers? pdam iRex 28 09-14-2006 05:24 PM


All times are GMT -4. The time now is 05:17 PM.


MobileRead.com is a privately owned, operated and funded community.