Hey guys!
First of all: I am no coder and posting something in an Open Source group means that i actualy don't know what i am doing ;-)
But i am good at googling and digging through things. In manipulating some WordPress stuff this way i had good outcomes.
But this is the first time that i looked behind the scenes of an android app. I am posting here, because i would like to share what i have done with the open source community. I guess others have simular wishes and maybe better guys can extend this to add new features. Additionaly i would like to see you "pros" commenting on this. I do have only one test device (Galaxy S4, 4.4.2) and on my device it works. But i have no clue about other phones and i have no clue if this can lead to unexpected errors or hurting something else, so please give me your opinions.
So, what was my intend?
I realy don't like the behaviour of the AI2 apps when the hardware menu button is clicked. It is not about the "Invented by MIT" part (which can be out-commented anyway), but the total thing. It is ugly and doesn't go with android design guidelines. It holds only two objects, while my app has another menu with around 10 objects and i think it is stupid to have two different menus in one app. And it is not translateable, so my app is in a total different language than the hardware menu is. My wish would be to set the hardware menu button to something like ListPicker1 for example. But as i have no clue how to do it, i focused on just disabling the hardware button. I prefer to have this button rather dead than having two different menus and not being able to influence one of them.
What have i done?
Based on a post in this thread (
https://groups.google.com/forum/#!topic/mitappinventortest/0CODzTxifCc) i decompiled my apk with apktool, went to "your_project_name.apk\smali\com\google\appinventor\components\runtime\form.smali" and deleted this whole part of code:
.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
.locals 1
.param p1, "menu" # Landroid/view/Menu;
.prologue
.line 1365
invoke-super {p0, p1}, Landroid/app/Activity;->onCreateOptionsMenu(Landroid/view/Menu;)Z
.line 1368
invoke-virtual {p0, p1}, Lcom/google/appinventor/components/runtime/Form;->addExitButtonToMenu(Landroid/view/Menu;)V
.line 1369
invoke-virtual {p0, p1}, Lcom/google/appinventor/components/runtime/Form;->addAboutInfoToMenu(Landroid/view/Menu;)V
.line 1370
const/4 v0, 0x1
return v0
.end method
After that i recompiled using apktool, zipped it, copied the classes.dex out of the zip, decompiled the
original apk with app2market, deleted the classes.dex from the original, added the one i got out of the modified smali, recompiled and signed the app with app2market.
On my phone this apk does now what i want: i does nothing when hitting the hardware menu button.
Pls give me your thoughts on this.
Enjoy the evening :-)
Toni