View Single Post
Old 09-27-2012, 08:02 AM   #8
silver18
THE NOOB
silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.
 
silver18's Avatar
 
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
New update...

Here is what I discovered last time.

How to catch menu and back button:

Code:
kindle.messaging.receiveMessage('searchBarButtonSelected', YOUR_FUNCTION HERE);

function YOUR_FUNCTION HERE (property, json){
	if ((property == 'searchBarButtonSelected') && (json == 'menu')){
       	        do something when menu button is choosed
	}

	if ((property == 'searchBarButtonSelected') && (json == 'back')){
		do something when back button is choosed
	}
}
Place this in config.xml:

Code:
<kindle:messaging>
       	<kindle:app name="com.lab126.pillow" value="yes"/>
</kindle:messaging>
However I can't catch the back button as it seems to be still controlled by the kindle framework (i.e it brings me back to home).

This could be used to read any other message...you just need to find the message (showlog -f) and duplicate the system used by pillow.
Example:
place this in config.xml:
Code:
<kindle:app name="com.lab126.adManager" value="yes" />
and this in javascript:
Code:
kindle.messaging.receiveMessage('adViewerMsgCallback', YOUR_FUNCTION_HERE);


How to increase the available memory for WAFs:

Code:
sqlite3 /var/local/appreg.db "INSERT INTO properties (handlerId, name, value) VALUES ('YOUR_APP_HERE','memUnloadLevel','150000')"

sqlite3 /var/local/appreg.db "INSERT INTO properties (handlerId, name, value) VALUES ('YOUR_APP_HERE','memWarnLevel','71680')"
This changes the warning level and unload level (as used by the browser). It solves the force closing problem when using an heavy WAFs for long time.


Content window & CO:

You can use the index.html page of your WAF as a landing page. Then you can use
Code:
kindle.chrome.createContentWindow(YOUR_PAGE_HERE);
to create a new content window. It can address also local saved pages:
Code:
YOUR_PAGE_HERE = "/mnt/us/hello.html"
Once you created the content window, you can move it foreground or background:
Code:
kindle.chrome.setContentWinDisplay('foreground');
kindle.chrome.setContentWinDisplay('background');
Moving background will bring back your landing page index.html (but it won't trigger the onload event).

EDIT: I forgot to mention that content windows have PINCH-TO-ZOOM (I still don't understand why WAFs can't have it).

Search in wikipedia from a WAF:

You can launch a wiki search this way:
Code:
search = YOUR_SEARCH_HERE
remoteUri = "http://en.wikipedia.org/wiki/"+search;
kindle.appmgr.start('com.lab126.browser?view=' + remoteUri );
Search variable could be retrieved from a classic prompt.
This can obviously used to search everything on the internet using the browser.
You can return to your WAF using the back button.


Miscellaneous:

These should be self explanatory...

Code:
kindle.gestures.ontap = function () {   }
kindle.appmgr.onback = function () {   }
kindle.gestures.onswipe = function () {   }
kindle.appmgr.back()
kindle.appmgr.onforward = function () {   }
kindle.dev.clearApplicationCache()
kindle.dev.clearCookies()
kindle.dev.clearCache()

Now....anyone knows how to create a menu like the one used by the browser?
I tried to study the browser WAF but the menu thing is just...beyond my knowledge...

Last edited by silver18; 09-27-2012 at 08:07 AM.
silver18 is offline   Reply With Quote