[Nook Touch Themes and Apps] nmyshkin:
User-customizable DIY RN Menu Kit!

The impetus for this new version of one of the first Tasker-made apps I put together comes from XDA member @aiamuzz. If you scroll back a few posts you'll see some of our conversation throughout which I was working on a custom version of the original app for him. I repeated then what I said in the first post, that I didn't see any way to give the

user

the ability to customize the menu.

Never say never. My experience with the Dictionary Management app and the update of QuickTiles expanded my bag of tricks a bit and I began to think about this old app in a different way.

The result is RN Menu 2.0, a "kit" for creating your own menu of from 2 to 6 items that takes the place of the "reading now" status bar button. To use this app you need to be able to manipulate bitmap and png images (setting the latter for a transparent background) and make your menu choices into adb shell commands. Before you roll your eyes at that last one, consider that most people will probably just want to start an app from the menu. This is a command that always takes the same form. Anyone can write it once they've seen one. More complicated things, like the broadcast intent that opens the current book, may not be so simple but that's what this forum is for. Someone will try to help if you get stuck.

Because this app executes shell commands, it requires root access

Note: this app has an odd effect on the notification drawer access. When the drawer is empty, the tap zone is actually not where the notification number would be, but rather between that spot and the "back" button. When a notification number is displayed, the tap zone is

extended

over it. This app somehow prevents an effective tap on the number itself, but the zone nearer the "back" button remains active. No fix yet. Maybe there is none.

What this app does

When installed and initialized the app places an invisible overlay on top of the status bar "reading now" button. A tap on this area destroys the overlay and opens the menu. An upswipe on the menu, closes it--this is difficult to do on a 2-item menu, admittedly-- and restores the overlay. Once the menu is open, you make your selection, the menu closes and your choice is executed. Meanwhile the overlay returns, ready for another go-round. This overlay is always "on" whether you can see the status bar or not (it is placed there automatically shortly after a reboot). This means you can access the menu even from full-screen applications like the stock Reader. If some full-screen app uses that spot for touch input, you can disable the overlay for 1 minute by long-pressing on it.

The menu itself is just a png image that you prepare yourself using the provided templates. You can look back at some of the previous posts to see the really nice job @aiamuzz did with his menu. To do this you will need a graphics program of some kind. More details below.

The menu actions are contained in a text file, menu.txt, which is in /sdcard/RNMenu. This file consists of the shell commands for the menu actions, separated by commas. When the app is first initialized it reads this file, determines how many commands there are and therefore what size of menu to display, and stores the commands. This ensures that the menu opens promptly. When the menu closes after executing the shell command selected, the app rescans the file menu.txt, just in case you have changed it. Again, the object is to have no delay in opening the menu. That means a change in the menu will not be reflected until it has gone through one cycle (an upswipe "close" is enough to trigger a rescan of menu.txt).

Preparing a menu

Although the app comes with a default blank 2-item menu "installed", it would be better to prepare your own menu before you even install the app. That way when the app initializes your menu will automatically display. Included in the zip below is a folder called "RNMenu". This is to be copied to the root of your sdcard. But before you do that, take a look at the contents. It has the menu.txt file as well as 10 images, 5 bitmaps and 5 transparent-background pngs. The bitmaps should be considered archive files. You can use these (or a copy of one of them) to create your menu, then save it as a png with the transparent background color matching the bluish green corner colors. This gives you round corners for the menu, conforming with other drop-downs like in the stock Library. If you have trouble with this step, just zip up your bitmap file and send it to me. I'll convert it for you.

Do not change the size of the menu images, the divisions or the file names.

Whether you choose to use icons or not is up to you. Again, see the excellent sample by @aiamuzz in the previous posts. As far as the text, I was once told that the device screen font was Gill Sans. You can extract this ttf from /system/fonts if you don't have it on your PC. I found that installing only the principal font (not all the variations) gave the best result. YMMV. Even so, the font does not seem to me to be an exact match. If you use it, 17pt regular seems to be about the right size, compared to the menus in the Library. Alternatively, you can just use something like Arial. The actual screen font (whatever it is) seems a bit more "squished" than either Gill Sans or Arial, with "o" and "e" noticeably ovoid. In any case, for Arial, 15pt regular seems about right. Again, results may vary for different software. The best way to judge is with a true-size screenshot of the Library with one of the menus open (screenshot attached below).

Writing the menu commands

Once you have your menu prepared (that means one of the png images is no longer just a blank rectangle), it's time to customize the menu.txt to reflect the choices on your menu. As provided, this file contains two options:

1. open the last read book in the stock Reader

2. open the stock Library app

The shell commands for these operations are:

1. am broadcast -a com.bn.nook.launch.LAST_BOOK

2. monkey -p com.bn.nook.library 1

The second command is an example of how you open an app, in this case, the stock Library. To change the app which opens, you need to replace "com.bn.nook.library" with the package name of the app you want to open. The easiest way to get the package name is to look for your app in /data/data. The folder names are the package names. So for the Kindle app, that would be "com.amazon.kindle", or for EbookDroid, "org.ebookdroid".

So, we separate these commands with a comma (no extra spaces before or after!) and get:

am broadcast -a com.bn.nook.launch.LAST_BOOK,monkey -p com.bn.nook.library 1

If you have additional items in your menu, just add another comma and another command. It's very important that this file not have a CR or LF at the end. I was editing mine on the NST with ES Note Editor (or whatever it's called) and found that the final menu options were not working. When I finally tracked down the issue I discovered that every time the file was opened a LF or CR was added to the final line! So check to be sure your cursor won't go beyond the last command before you save the file.

One more example. Let's say you want a menu with these commands:

1. Open last-read book in stock Reader

2. Open Amazon Kindle app

3. Open EBookDroid app

The shell commands are:

1. am broadcast -a com.bn.nook.launch.LAST_BOOK

2. monkey -p com.amazon.kindle 1

3. monkey -p org.ebookdroid 1

Therefore the menu.txt file would look like:

am broadcast -a com.bn.nook.launch.LAST_BOOK,monkey -p com.amazon.kindle 1,monkey -p org.ebookdroid 1

Putting it all together

1. Copy the RNMenu folder (with your custom menu and commands) to the root of your sdcard.

2. This is a Tasker-generated app and requires two library files (in attached zip package) or it will not install. If you already have one of my other Tasker-generated apps you can discard these files. Otherwise, copy them as indicated below:

/system/etc/permissions/com.google.android.maps.xml

/system/framework/com.google.android.maps.jar

Set permissions for both files to rw-r--r-- and reboot. Without these files resident, the app will not install.

3. Install the app with a file manager or via ADB.

4. Tap on the app icon and wait for the activation message.

5. Tap in the upper left of the screen to see your new custom menu!

Remember, if you make any changes, whether to the commands in menu.txt or just some tweaks to your menu image, they will not be reflected until after one menu cycle.

Bug reports are welcome.