[TIMOB-16900] Android: Add selected/unselected Tab events for parity with iOS Focus and Blur events
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Done |
Resolution Date | 2019-01-10T21:21:23.000+0000 |
Affected Version/s | Release 3.2.2 |
Fix Version/s | n/a |
Components | Android |
Labels | android, blur, focus, parity, tab |
Reporter | Mark Mokryn |
Assignee | Yordan Banev |
Created | 2014-04-20T20:42:57.000+0000 |
Updated | 2019-01-10T21:21:27.000+0000 |
Description
On iOS, the Tab focus and blur events fire for the relevant tabs when a tab is selected. On Android, these events also fire when the window gains or loses focus, such as when the Home button is clicked or when the screen is unlocked. The iOS behavior is the correct one, and should be matched. This is important, since we need a reliable indicator for when a tab is selected and unselected. We currently have no such indicator in Android, thus this is critical.
UPDATE: see PR in comment below. The PR added the selected and unselected tab events for Android, while not modifying focus and blur behavior to maintain app compatibility. In iOS, tab focus and blur were simply renamed to selected and unselected. These events function as expected, and have the benefit of being more appropriately named.
Pull request: https://github.com/appcelerator/titanium_mobile/pull/5636 See a detailed explanation in the PR comment. To test the PR: index.xml:
index.js
Any feedback from Appcelerator on this? Thanks.
Moving this parity fix PR to engineering for further evaluation and prioritization.
I just submitted a new PR for swipe tabs: https://github.com/appcelerator/titanium_mobile/pull/5651 which includes this functionality for Android, so you may close this ticket if that PR is accepted. I would just suggest that in iOS Tab.focus/blur be renamed to selected/unselected to match Android.
The described behavior works as expected and is retained after the refactoring. The ticket can be closed once the new TabGroup gets merged.
The "selected" and "unselected" events were added back in Titanium 3.6.0. We've verified that Titanium 8.0.0 maintains this behavior.