Skip to content
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

TIMOB-13427 add title property and add title in doc #4920

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
*/
package ti.modules.titanium.ui.widget.tabgroup;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.titanium.TiBaseActivity;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiLifecycle.OnLifecycleEvent;
import org.appcelerator.titanium.view.TiCompositeLayout;

Expand Down Expand Up @@ -46,7 +49,7 @@ public TiUIActionBarTabGroup(TabGroupProxy proxy, TiBaseActivity activity) {
// Setup the action bar for navigation tabs.
actionBar = activity.getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);

// Create a view to present the contents of the currently selected tab.
FrameLayout tabContent = new FrameLayout(activity);
Expand All @@ -61,6 +64,28 @@ public TiUIActionBarTabGroup(TabGroupProxy proxy, TiBaseActivity activity) {
// will not transform it along with the rest of the group.
setNativeView(tabContent);
}

@Override
public void processProperties(KrollDict d)
{
// TODO Auto-generated method stub
super.processProperties(d);
if (d.containsKey(TiC.PROPERTY_TITLE)) {
actionBar.setTitle(d.getString(TiC.PROPERTY_TITLE));
}

}

@Override
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy)
{
// TODO Auto-generated method stub
if (key.equals(TiC.PROPERTY_TITLE)) {
actionBar.setTitle((String) newValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TiConvert.toString

} else {
super.propertyChanged(key, oldValue, newValue, proxy);
}
}

@Override
public void addTab(TabProxy tabProxy) {
Expand Down
7 changes: 6 additions & 1 deletion apidoc/Titanium/UI/TabGroup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,12 @@ properties:
default: null
osver: {ios: {min: "7.0"}}
platforms: [iphone,ipad]


- name: title
summary: Title for this tabGroup.
type: String
platforms: [android]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add "since: {android: 3.3.0}"


- name: tabsBackgroundImage
summary: Default background image for tabs.
description: |
Expand Down