New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android): Fix a regressions of changing TabGroup's title after it was created. #10778
Conversation
… was created. Fixes TIMOB-26889
Tests:
|
{ | ||
// If the native view is drawn get the title value from the SupportActionBar | ||
if (view != null) { | ||
return ((AppCompatActivity) getActivity()).getSupportActionBar().getTitle().toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a null
check on:
getActivity()
when fetching "title" after aTabGroup
has been closed.getSupportActionBar()
when using the "Theme.AppCompat.NoTitleBar" theme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can getTitle()
return null
if you use a Toolbar
as an action bar without the title set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turned out to be something bigger I have missed. Using a Toolbar as an ActionBar relies on adding it the usual way to a Window (through the window.add()
), but this method is not available for the TabGroup. I am going to make setting the supportToolbar
the only requirement for it to work for TabGroup. So far that raised a few interesting questions, but I will try to answer them all with the next update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good point. Yeah, there is no good way to add a Toolbar
to a TabGroup
since we don't allow TabGroup.add()
to add any views.
I suppose we don't "need" to add toolbar support to tab groups. Sticking to the action bar might be fine. And we have TabbedBar
support now which (in combination with ScrollableView
) allows app devs to construct whatever elaborate tabbing interface they want now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will leave using a Toolbar as an ActionBar with TabGroup as a separate task. It turned out to be a bit more complicated than I expected. With the current way we support this for Window through Alloy and the TabGroup's implementation itself I prefer for it to be addressed together.
@@ -386,6 +391,11 @@ public TabProxy getSelectedTab() | |||
return ((TabGroupProxy) getProxy()).getTabList().get(this.tabGroupViewPager.getCurrentItem()); | |||
} | |||
|
|||
public void updateTitle(String title) | |||
{ | |||
this.actionBar.setTitle(title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a null
check in case we're using the "Theme.AppCompat.NoTitleBar" theme.
# Conflicts: # tests/Resources/ti.ui.tabgroup.addontest.js
@jquick-axway I have updated the PR (and the backport as well) with the null guards. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FR Passed: When a Window has its own title in a tabGroup the title now appears. Tested with the test case above.
Test Environment
Google pixel xl 7.1.1 sim
APPC CLI: 7.0.10
Operating System Name: Mac OS Mojave
Operating System Version: 10.14.2
Node.js Version: 8.9.1
Xcode 10.1
JIRA: https://jira.appcelerator.org/browse/TIMOB-26889
Description:
Fixes a regression introduced in 8.0.0 for TabGroup where if you change a TabGroup's
title
property after it was drawn does not work anymore.Test case:
app.js