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-24352] (6_1_X) iOS: Make more ListItem templates available by default #9043

Merged
merged 3 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
36 changes: 25 additions & 11 deletions apidoc/Titanium/UI/ListItem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ description: |

* <Titanium.UI.ActivityIndicator>
* <Titanium.UI.Button>
* <Titanium.UI.ButtonBar>
* <Titanium.UI.ImageView>
* <Titanium.UI.Label>
* <Titanium.UI.MaskedImage>
* <Titanium.UI.ProgressBar>
* <Titanium.UI.Picker>
* <Titanium.UI.ScrollableView>
* <Titanium.UI.Slider>
* <Titanium.UI.Switch>
* <Titanium.UI.TextArea>
* <Titanium.UI.TextField>
* <Titanium.UI.iOS.BlurView>
* <Titanium.UI.iOS.LivePhotoView>
* <Titanium.UI.iOS.Stepper>
* <Titanium.UI.iOS.TabbedBar>

For example, suppose you have a list data item defined as `{foo:{text: 'foobar'}}` and an item
template defined as `{childTemplates: [{type: 'Ti.UI.Label', bindId: 'foo'}]}`. The `foo`
Expand Down Expand Up @@ -334,8 +342,8 @@ examples:

var data = [];
for (var i = 0; i < tasks.length; i++) {
data.push(
{ properties: {
data.push({
properties: {
itemId: tasks[i].id,
title: tasks[i].name,
image: tasks[i].icon,
Expand All @@ -348,13 +356,12 @@ examples:
var section = Ti.UI.createListSection();
section.setItems(data);
listView.sections = [section];
listView.addEventListener('itemclick', function(e){
listView.addEventListener('itemclick', function(e) {
var item = section.getItemAt(e.itemIndex);
if (item.properties.accessoryType == Ti.UI.LIST_ACCESSORY_TYPE_NONE) {
item.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_CHECKMARK;
item.properties.color = 'red';
}
else {
} else {
item.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_NONE;
item.properties.color = 'black';
}
Expand Down Expand Up @@ -385,13 +392,12 @@ examples:
index.js

<!-- controllers/index.js -->
$.listView.addEventListener('itemclick', function(e){
$.listView.addEventListener('itemclick', function(e) {
var item = $.section.getItemAt(e.itemIndex);
if (item.properties.accessoryType == Ti.UI.LIST_ACCESSORY_TYPE_NONE) {
item.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_CHECKMARK;
item.properties.color = 'red';
}
else {
} else {
item.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_NONE;
item.properties.color = 'black';
}
Expand Down Expand Up @@ -491,13 +497,12 @@ examples:

// Modified version of the `itemclick` event listener
// Changes the item template rather than the list item's color property
function toggleCheck (e) {
function toggleCheck(e) {
var item = section.getItemAt(e.itemIndex);
if (item.properties.accessoryType == Ti.UI.LIST_ACCESSORY_TYPE_NONE) {
item.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_CHECKMARK;
item.template = 'check';
}
else {
} else {
item.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_NONE;
item.template = 'uncheck';
}
Expand Down Expand Up @@ -549,13 +554,22 @@ properties:

* <Titanium.UI.ActivityIndicator>
* <Titanium.UI.Button>
* <Titanium.UI.ButtonBar>
* <Titanium.UI.ImageView>
* <Titanium.UI.Label>
* <Titanium.UI.MaskedImage>
* <Titanium.UI.ProgressBar>
* <Titanium.UI.Picker>
* <Titanium.UI.ScrollableView>
* <Titanium.UI.Slider>
* <Titanium.UI.Switch>
* <Titanium.UI.TextArea>
* <Titanium.UI.TextField>
* <Titanium.UI.iOS.BlurView>
* <Titanium.UI.iOS.LivePhotoView>
* <Titanium.UI.iOS.Stepper>
* <Titanium.UI.iOS.TabbedBar>

type: String
optional: false

Expand Down
5 changes: 5 additions & 0 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6061,7 +6061,9 @@ iOSBuilder.prototype.processTiSymbols = function processTiSymbols() {
'#ifdef USE_TI_UILISTVIEW',
'#define USE_TI_UILABEL',
'#define USE_TI_UIBUTTON',
'#define USE_TI_UIBUTTONBAR',
'#define USE_TI_UIIMAGEVIEW',
'#define USE_TI_UIMASKEDIMAGE',
'#define USE_TI_UIPROGRESSBAR',
'#define USE_TI_UIACTIVITYINDICATOR',
'#define USE_TI_UISWITCH',
Expand All @@ -6070,6 +6072,9 @@ iOSBuilder.prototype.processTiSymbols = function processTiSymbols() {
'#define USE_TI_UITEXTAREA',
'#define USE_TI_UISCROLLABLEVIEW',
'#define USE_TI_UIIOSSTEPPER',
'#define USE_TI_UIIOSBLURVIEW',
'#define USE_TI_UIIOSLIVEPHOTOVIEW',
'#define USE_TI_UIIOSTABBEDBAR',
'#define USE_TI_UIPICKER',
'#endif'
);
Expand Down