Skip to content

Commit e128f82

Browse files
author
vakrilov
committed
Comments for documentation
1 parent 7adeb29 commit e128f82

File tree

3 files changed

+118
-9
lines changed

3 files changed

+118
-9
lines changed

ui/action-bar/action-bar-common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class ActionBar extends view.View implements dts.ActionBar {
158158
}
159159
}
160160

161-
public shouldShow(): boolean {
161+
public _shouldShow(): boolean {
162162
if (this.title ||
163163
(this.android && this.android.icon) ||
164164
this.navigationButton ||

ui/action-bar/action-bar.d.ts

Lines changed: 116 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,94 @@
1-
declare module "ui/action-bar" {
1+
/**
2+
* Contains the action bar related classes.
3+
*/
4+
declare module "ui/action-bar" {
25
import observable = require("data/observable");
36
import view = require("ui/core/view");
47
import dependencyObservable = require("ui/core/dependency-observable");
58
import bindable = require("ui/core/bindable");
69
import pages = require("ui/page");
710

11+
/**
12+
* Provides an abstraction over the ActionBar (android) and NavigationBar (iOS).
13+
*/
814
export class ActionBar extends view.View implements view.AddArrayFromBuilder, view.AddChildFromBuilder {
15+
16+
/**
17+
* Gets or sets the action bar title.
18+
*/
919
title: string;
1020

21+
/**
22+
* Gets or sets the title view. When set - replaces the title with a custom view.
23+
*/
24+
titleView: view.View;
25+
26+
/**
27+
* Gets or sets the navigation button (a.k.a. the back button).
28+
*/
1129
navigationButton: NavigationButton;
30+
31+
/**
32+
* Gets the collection of action items.
33+
*/
1234
actionItems: ActionItems;
13-
titleView: view.View;
14-
35+
36+
/**
37+
* Gets the android specific options of the action bar.
38+
*/
1539
android: AndroidActionBarSettings;
1640

41+
/**
42+
* Gets the page that contains the action bar.
43+
*/
1744
page: pages.Page;
1845

19-
shouldShow(): boolean
20-
46+
/**
47+
* Updates the action bar.
48+
*/
2149
update();
2250

2351
//@private
52+
_shouldShow(): boolean
2453
_updateAndroid(menu: android.view.IMenu);
2554
_onAndroidItemSelected(itemId: number): boolean
2655

2756
_addArrayFromBuilder(name: string, value: Array<any>): void;
2857
_addChildFromBuilder(name: string, value: any): void;
29-
3058
//@endprivate
3159
}
3260

61+
/**
62+
* Represents a collection of ActionItems.
63+
*/
3364
export class ActionItems {
65+
/**
66+
* Adds an item to the collection.
67+
* @param item - the item to be added
68+
*/
3469
addItem(item: ActionItem): void;
70+
71+
/**
72+
* Removes an item to the collection.
73+
* @param item - The item to be removed.
74+
*/
3575
removeItem(item: ActionItem): void;
76+
77+
/**
78+
* Gets an array of the current action items in the collection.
79+
*/
3680
getItems(): Array<ActionItem>;
81+
82+
/**
83+
* Gets an item at a specified index.
84+
* @param index - The index.
85+
*/
3786
getItemAt(index: number): ActionItem;
3887
}
3988

89+
/**
90+
* Base class for action items.
91+
*/
4092
export class ActionItemBase extends bindable.Bindable {
4193
/**
4294
* String value used when hooking to tap event.
@@ -53,8 +105,19 @@
53105
*/
54106
public static iconProperty: dependencyObservable.Property;
55107

108+
/**
109+
* Gets or sets the text of the action item.
110+
*/
56111
text: string;
112+
113+
/**
114+
* Gets or sets the icon of the action item.
115+
*/
57116
icon: string;
117+
118+
/**
119+
* Gets the action bar that contains the action item.
120+
*/
58121
actionBar: ActionBar;
59122

60123
/**
@@ -75,24 +138,70 @@
75138
//@endprivate
76139
}
77140

141+
/**
142+
* Represents an action item in the action bar.
143+
*/
78144
export class ActionItem extends ActionItemBase {
145+
/**
146+
* Gets the iOS specific options of the action item.
147+
*/
79148
ios: IOSActionItemSettings;
149+
150+
/**
151+
* Gets the Android specific options of the action item.
152+
*/
80153
android: AndroidActionItemSettings;
81154
}
82155

156+
/**
157+
* Represents Android specific options of the action item.
158+
*/
83159
export interface AndroidActionItemSettings {
160+
/**
161+
* Gets or sets the position of the action item in the action bar.
162+
* 1. actionBar - item is shown in the action bar.
163+
* 2. actionBarIfRoom - item is shown in the action bar if there is room for it. Otherwise it is put in the popup menu.
164+
* 3. popup - item is shown in the popup menu.
165+
*/
84166
position: string;
85167
}
86168

169+
/**
170+
* Represents Android specific options of the action item.
171+
*/
87172
export interface IOSActionItemSettings {
173+
/**
174+
* Gets or sets the position of the action item in the action bar.
175+
* 1. left - items is shown at the left part of the navigation bar. This is the default value.
176+
* 2. right - items is shown at the right part of the navigation bar.
177+
*/
88178
position: string;
89179
}
90180

181+
/**
182+
* Represents Android specific options of the action bar.
183+
*/
91184
export interface AndroidActionBarSettings {
185+
186+
/**
187+
* Gets or sets the action bar icon.
188+
*/
92189
icon: string;
190+
191+
/**
192+
* Gets or sets the visibility of the action bar icon.
193+
* The icon is visible by default in pre-lollipop (API level < 20) versions of android and is hidden in lollipop (API level >= 20)
194+
* The possible values are:
195+
* 1. auto - the default behavior. This is the default value.
196+
* 2. always - the icon is aways shown.
197+
* 3. never - the icon is aways hidden.
198+
*/
93199
iconVisibility: string;
94200
}
95-
201+
202+
/**
203+
* Represents the navigation (a.k.a. "back") button.
204+
*/
96205
export class NavigationButton extends ActionItemBase {
97206

98207
}

ui/frame/frame.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class Frame extends frameCommon.Frame {
8484

8585
case enums.NavigationBarVisibility.auto:
8686
var pageInstance: pages.Page = page || this.currentPage;
87-
newValue = this.backStack.length > 0 || (pageInstance && pageInstance.actionBar.shouldShow());
87+
newValue = this.backStack.length > 0 || (pageInstance && pageInstance.actionBar._shouldShow());
8888
newValue = !!newValue; // Make sure it is boolean
8989
break;
9090
}

0 commit comments

Comments
 (0)