Skip to content

Commit

Permalink
feat(android): animated parameter for disableTabNavigation (#13770)
Browse files Browse the repository at this point in the history
* feat(android): animated parameter for disableTabNavigation

* docs

* docs
  • Loading branch information
m1ga authored Mar 31, 2023
1 parent 34da923 commit fbc8c7e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.annotations.Kroll;
Expand Down Expand Up @@ -85,11 +86,23 @@ public int getTabIndex(TabProxy tabProxy)
}

@Kroll.method
public void disableTabNavigation(boolean disable)
public void disableTabNavigation(Object params)
{
TiUIAbstractTabGroup tabGroup = (TiUIAbstractTabGroup) view;
if (tabGroup != null) {
tabGroup.disableTabNavigation(disable);
if (params instanceof Boolean) {
TiUIAbstractTabGroup tabGroup = (TiUIAbstractTabGroup) view;
if (tabGroup != null) {
tabGroup.disableTabNavigation(TiConvert.toBoolean(params, false));
}
} else if (params instanceof HashMap<?, ?>) {
KrollDict options = new KrollDict((HashMap<String, Object>) params);
TiUIAbstractTabGroup tabGroup = (TiUIAbstractTabGroup) view;
if (tabGroup != null) {
if (options.getBoolean(TiC.PROPERTY_ANIMATED)) {
setTabBarVisible(options.getBoolean(TiC.PROPERTY_ENABLED));
} else {
tabGroup.disableTabNavigation(options.getBoolean(TiC.PROPERTY_ENABLED));
}
}
}
}

Expand Down
22 changes: 19 additions & 3 deletions apidoc/Titanium/UI/TabGroup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ methods:
Disable (or re-enable) tab navigation. If tab navigation is disabled, the tabs are hidden and
the last selected tab window is shown.
parameters:
- name: disable
summary: True to disable tab navigation, false to re-enable the tabs.
type: Boolean
- name: params
summary: Boolean to disable tab navigation or dictionary (since 12.1.0).
type: disableTabOptions
platforms: [android]
since: 3.6.0

Expand Down Expand Up @@ -678,3 +678,19 @@ examples:
});
tabGroup.open();
```
---
name: disableTabOptions
summary: Dictionary of options for the <Titanium.UI.TabGroup.disableTabOptions> method.
platforms: [android, iphone, ipad, macos]
since: {android: "12.1.0", iphone: "12.1.0", ipad: "12.1.0", macos: "12.1.0"}
properties:
- name: animated
summary: |
Determines whether to use an animated effect to hide/show the navigation bar.
type: Boolean
default: false
- name: enabled
summary: |
Show or hide the navigation bar.
type: Boolean
default: false

0 comments on commit fbc8c7e

Please sign in to comment.