[TIMOB-11642] Android: Enable click event listeners for app icon/app logo in action bar
GitHub Issue | n/a |
---|---|
Type | Sub-task |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-11-13T22:05:31.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | actionbar, qe-testadded |
Reporter | Allen Yeung |
Assignee | Allen Yeung |
Created | 2012-11-02T00:31:41.000+0000 |
Updated | 2014-06-19T12:42:51.000+0000 |
Description
We need to be able to add click event listeners to the app icon button inside the action bar. According the action docs, we would need to handle it in the onOptionsItemSelected() method.
http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems
Test case: 1. Set your target sdk version to 14 by adding the entry if your tiapp.xml"
2. Run the following code:
3. Click on the app logo on the top left, and you should see the log message pop up in the logs This needs to be tested in v8 and rhino.
Is it possible to add the event this way too?
I couldn't find in the 3.0 docs yet about the ActionBar object, sorry if I'm being too fast.
No, we currently don't support anything like that. You need to add a handler onHomeIconItemSelected as shown above.
Ok, thanks!
I tried to add it to my code now. The log command worked just fine, and also worked opening a new window. Although, I tried to run an alert() and fire another event in the same window when the App Icon was clicked, and the application crashed.
Allen, This property is missing from ActionBar.yml.
Added the testcase for it.
Clicking on App icon on actionBar. '-------------------Home Icon Selected' is logged on the console. Verifed on: Device : Google Nexus 7, Android Version: 4.1 SDK version: 3.1.0.v20130320190115 CLI version : 3.0.24 OS : MAC OSX 10.7.5