[TIMOB-13427] Android: Expose TabGroup title properly when using the ActionBar
| GitHub Issue | n/a |
| Type | New Feature |
| Priority | High |
| Status | Reopened |
| Resolution | Unresolved |
| Affected Version/s | Release 8.1.0, Release 8.3.0 |
| Fix Version/s | 2013 Sprint 25, 2013 Sprint 25 API, Release 3.3.0 |
| Components | Android |
| Labels | module_tabgroup, qe-testadded, triage |
| Reporter | Igor Santos |
| Assignee | Biju pm |
| Created | 2012-12-13T00:09:56.000+0000 |
| Updated | 2019-11-07T15:18:06.000+0000 |
Description
As Arthur Evans said:
{quote}
I think there are two competing schools of though here (at least):
1) We should expose a title on the tab group.
2) The action bar title should take the title of the current tab's window.
I've spent some time reviewing the Android docs, and it's not clear to me which of these is preferable.
{quote}
IMHO, if the tab already has a title, it's quite pointless to repeat this title in the ActionBar. In my application I'm using tabs to split the content of a shopping list between the items and the values... one tab is called "products", the other is "summary", and the actionBar title would be the list's name. I've attached a screenshot as an example.
*Bottom line*: Maybe the TabGroup could use the provided title property, and when it's not present, use the active tab title?
Attachments
Any news on this? Currently my tabgroup ActionBar titles are empty :/
Test case
var win1 = Ti.UI.createWindow({ title: 'Win 1' }); var tab1 = Ti.UI.createTab({ title: 'PRODUCTS', }); var win2 = Ti.UI.createWindow({ title: 'Win 2' }); var tab2 = Ti.UI.createTab({ title: 'List SUMMARY', window: win2 }); var tabGroup = Ti.UI.createTabGroup({ title: 'Group Test', }); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.open();PR :- https://github.com/appcelerator/titanium_mobile/pull/4920
Another test case for changing the tab group's title:
Run the above test case withvar win1 = Ti.UI.createWindow({ title: 'Win 1' }); var tab1 = Ti.UI.createTab({ title: 'PRODUCTS', window: win1 }); var win2 = Ti.UI.createWindow({ title: 'Win 2' }); var tab2 = Ti.UI.createTab({ title: 'List SUMMARY', window: win2 }); var tabGroup = Ti.UI.createTabGroup({ title: 'Group Test', }); var b1 = Ti.UI.createButton({ top: 10, title: "tabGroup.title = 'title changed'" }); b1.addEventListener("click", function(){ tabGroup.title = "title changed"; alert("tabGroup.title = " + tabGroup.title); }); win1.add(b1); var b2 = Ti.UI.createButton({ top: 110, title: "tabGroup.setTitle('title reset')" }); b2.addEventListener("click", function(){ tabGroup.setTitle("title reset"); alert("tabGroup.getTitle() = " + tabGroup.getTitle()); }); win1.add(b2); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.open();and withsetTitle no longer changes the tab group title. With the test case below note that the second button does not change the tabGroup title. *Test Case:*
*Test Environment*var win1 = Ti.UI.createWindow({ title: 'Win 1' }); var tab1 = Ti.UI.createTab({ title: 'PRODUCTS', window: win1 }); var win2 = Ti.UI.createWindow({ title: 'Win 2' }); var tab2 = Ti.UI.createTab({ title: 'List SUMMARY', window: win2 }); var tabGroup = Ti.UI.createTabGroup({ title: 'Group Test', }); var b1 = Ti.UI.createButton({ top: 10, title: "tabGroup.title = 'title changed'" }); b1.addEventListener("click", function(){ tabGroup.title = "title changed"; alert("tabGroup.title = " + tabGroup.title); }); win1.add(b1); var b2 = Ti.UI.createButton({ top: 110, title: "tabGroup.setTitle('title reset')" }); b2.addEventListener("click", function(){ tabGroup.setTitle("title reset"); alert("tabGroup.getTitle() = " + tabGroup.getTitle()); }); win1.add(b2); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.open();MacOS Catalina 10.15.1 Beta Node.js 10.16.3 Google Pixel Emulator7.1.1 {"NPM":"4.2.15-1","CLI":"7.1.1"} SDK 8.3.0.v20191030085531 SDK 8.2.1.GA