Open CRImier opened 6 years ago
Plan:
create a system for apps and users to set hooks on keypad key press/hold events, essentially, have same behaviour people expect from keypad phones, but also accessible for users, and with ways to change button-to-action mappings.
set a global "hold HANGUP to switch to shutdown app" hook
set a global "hold LEFT to switch to main screen" hook
set a global "press PROG1 to do X" hook
allow an app to set "hook to use with a button"
Optional:
ZeroPhone, and some other platforms that can run ZPUI, have spare keys that can be used with various ZPUI functions. Currently, the way to bind a function to a key is adding a non-maskable callback in code of the app that contains the desired function - for example, here's how it's currently done for volume buttons and for "Next"/"Previous" MOCP player control app actions. It's an option that works, but it's not easily configurable:
My idea is to have apps register some kind of "actions" into ZPUI, say, app-specific functions, during app import process. ZPUI then would have a list of available actions, and the user could access that list and map actions to keys - the actions would be then registered as non-maskable callbacks. Once a key is pressed, the action would be resolved into a function and executed. Possible problems with this approach: