Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,782,164 Members 50,068 Now Online
XDA Developers Android and Mobile Development Forum

[APP][09/29/11] Book button menu. {NEW:LandscapeSwitch,Propagation}

Tip us?
 
XorZone
Old
(Last edited by XorZone; 30th September 2011 at 07:14 AM.)
#1  
XorZone's Avatar
Senior Member - OP
Thanks Meter 136
Posts: 275
Join Date: Jan 2009
Location: Walnut Creek, CA
Lightbulb [APP][09/29/11] Book button menu. {NEW:LandscapeSwitch,Propagation}

Heya all.

Changelog:
1.1 - Added orientation switch and propagation (open "Reading Now") to Nook reader
1.0 - Initial release with home and CoolReader option.

Working on:
Investigating the way to distinguish if opening reading now book and not other epubs in order not to show menu on any library book click.


History/Idea:
Just got nook last Sunday as gift and immediately noticed after root that back/menu buttons in status bar is great, but would be even better to use book button as home OR as menu, was messing with framework, etc. to no avail, but finally got a better and simpler solution, but with cons.

After installing CoolReader I noticed that "reading now" button will trigger android select app menu with Nook Reader and CoolReader, so it is broadcast event, opening with CoolReader shows it is getting started epub.

So, here it is. Simple app, registers as one of the epub readers, by having last read in native nook reader any epub - and by pressing "reading now" button it will trigger app select dialog with my app in list (you can check to always open epubs with it).

It will show styled popup menu (see screenshot) containing only Home (will open default one or list of available homes if none selected as default), orientation switch, CoolReader shortcut (hardcoded now) and Nook Reader (this one will open remembered "Reading Now" book)

Cons:
1. Will be triggered on any broadcast event to open epub. (I don't care as I read in fb2)
2. If nothing in "reading now" it will not be triggered as well if "reading now" is not epub
3. hardcoded shortcuts for now

If it generates enough interest I can improve app (in current state functionality is enough for me). I could think of adding next features:
1. Add/Configure any shortcuts, e.g.:
* Back/Menu buttons in addition to home (this will required root to run)
* Add/Configure any shortcut
2. Add ability to propagate event data, e.g. if "reading now" sending "warandpeace.epub" to this app - send it to launching app if configured. This will allow to register this app to open epub and then open configured reader with epub data - done, besides configuration
3. Investigate launch origin (launching activity) and if it is not opening from status bar, but for example from astro/library - open configured reader propagating data.
4. Organize shortcuts as tree
5. Add recent apps submenu
Attached Thumbnails
Click image for larger version

Name:	NookBB_1.1.png
Views:	4023
Size:	20.9 KB
ID:	735752  
Attached Files
File Type: apk NookBB_1.1.apk - [Click for QR Code] (45.8 KB, 964 views)
Good-bye... and hello... as always!
Xor

[Widget][For 4.4] Desk Clock Resizable Widget
The Following 9 Users Say Thank You to XorZone For This Useful Post: [ Click to Expand ]
 
mdall
Old
#2  
Member
Thanks Meter 29
Posts: 95
Join Date: Dec 2010
Location: Paris
Really interesting

It could even replace Button Savior in a subtler way


BTW, in the same spirit, do you know if it could be possible to change the app launched when you click on the home button in the menu that appear when you press the n button ?
 
unattached
Old
#3  
Member
Thanks Meter 1
Posts: 44
Join Date: Jul 2009
hi,

i tried it and it works great, thanks!!

isn't it possible to launch the default app automatically, when pressing the button?

(on a side note: wouldn't it be possible to reconfiger the home button of the standard nook menu (the one that opens when you press the n-hardware-button) to launch the default android home?app?

edit: ok, somebody was quicker, i swear i didn't copy..
 
cymoze
Old
(Last edited by cymoze; 29th September 2011 at 06:05 PM.)
#4  
Member
Thanks Meter 13
Posts: 77
Join Date: May 2011
Quote:
Originally Posted by XorZone View Post

If it generates enough interest I can improve app (in current state functionality is enough for me). I could think of adding next features:
1. Add/Configure any shortcuts, e.g.:
* Back/Menu buttons in addition to home (this will required root to run)
* Add/Configure any shortcut
2. Add ability to propagate event data, e.g. if "reading now" sending "warandpeace.epub" to this app - send it to launching app if configured. This will allow to register this app to open epub and then open configured reader with epub data
3. Investigate launch origin (launching activity) and if it is not opening from status bar, but for example from astro/library - open configured reader propagating data.
Consider my interest highly generated. This is flat out great, especially if the option to go to Reader is built into Nook Book Button menu, and with the options of Back and Menu. I like Button Savior, but this has all of the same potential with a less obvious footprint and more seamless execution.

I'm running it now and this is really fun - if #2 can be done as well I see this as becoming an indispensible app for the nook touch root.

Sent from my NookColor using xda premium
 
XorZone
Old
#5  
XorZone's Avatar
Senior Member - OP
Thanks Meter 136
Posts: 275
Join Date: Jan 2009
Location: Walnut Creek, CA
Thanks. I'm trying to get a clue if it was launched from "Reading now" button or from other app. I can easily distinguish between "Reading now" and let's say Astro, but cannot distinguish from Nook Library.

And... great news - I'll post update soon with working landscape/portrait button.

Working on: opening only from "Reading now" or other nook app, but skips to configured reader otherwise. Also, instead of CoolReader I'll have configured reader in the menu.

For the back/menu buttons this will require root.

It is possible to change "n" button, I have it configured as Search button and assigned SoftKeys to search button long press. I'll post instructions soon as well as modified SoftKeys to handle Search long press without need of external app and also with a bit more friendly colors for eInk (background of recent apps white instead of blured)
Good-bye... and hello... as always!
Xor

[Widget][For 4.4] Desk Clock Resizable Widget
 
XorZone
Old
#6  
XorZone's Avatar
Senior Member - OP
Thanks Meter 136
Posts: 275
Join Date: Jan 2009
Location: Walnut Creek, CA
Quote:
Originally Posted by unattached View Post
isn't it possible to launch the default app automatically, when pressing the button?
Do you mean just to launch let's say CoolReader instead of NookReader by the press of "Reading now" button?
Good-bye... and hello... as always!
Xor

[Widget][For 4.4] Desk Clock Resizable Widget
 
apeine
Old
#7  
Senior Member
Thanks Meter 30
Posts: 266
Join Date: Mar 2011
Location: Sao Paulo
I think you've done a great job. and I guess adding a list of (programmable) shortcuts on that button would be neat (like when copying several chunks of text from a pdf to a doc text or something of the sort).
 
XorZone
Old
#8  
XorZone's Avatar
Senior Member - OP
Thanks Meter 136
Posts: 275
Join Date: Jan 2009
Location: Walnut Creek, CA
Ok, story number 1:
I dissembled (smali) framework jars and now have good idea how that book button works, basically it send custom broadcast, problem is that broadcast not ordered, I can change service.jar to broadcast mine event and this will allow to configure how to act, e.g. you can configure as default (reading now so I'll just send original broadcast), popup this menu or launch any app including home or softkeys directly.

Will play a bit more if androidriority indeed works even for unordered sendBroadcast and if I can abortBroadcast to not allow original reader spawn - we can avoid modification of the service.jar.

story 2:
WindowManagerPolicy/WindowManagerService seams like directly invoking native (JNI) code on home button, I was playing with remapping keys and finally found one that works with single press (Call not bringing dialer at all, camera only sends broadcast at long press, etc.), but by default it will not awake device, will have to play if I can awake from broadcastReceiver, if yes - it means we can configure "n" (home) button to do whatever we want.
Good-bye... and hello... as always!
Xor

[Widget][For 4.4] Desk Clock Resizable Widget
 
apeine
Old
#9  
Senior Member
Thanks Meter 30
Posts: 266
Join Date: Mar 2011
Location: Sao Paulo
Well, I don't use coolreader, but the extra home button and portrait/landscape button works very well.
Great job!
For me, the only thing missing is adding 2-3 apps on the list, and I'll be quite happy.
I don't use the N button much, but it could become a neat menu or back button.
 
spook
Old
#10  
Member
Thanks Meter 0
Posts: 32
Join Date: Aug 2006
Default Great App

Thanks for spending time making this app for us Nook Touch users.

I think this app is definitely a candidate for partial refresh. Having the full screen refreshed to draw the small dialog seems to be overkill. Not sure if that's under your control or not...

I definitely have an interest in remapping the N button to home. Perhaps long press launches the original menu?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes