Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/ios/collectionview.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

// Calculate the cell specs
var screenRect = UIScreen.mainScreen.bounds;
screenRect = CGRectMake(0 , 0, UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height - 64);
screenRect = CGRectMake(0, 0, UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height - 64);
var cellWidth = screenRect.size.width / 3.0;

// Create the cell layout and assign the size
Expand Down
115 changes: 1 addition & 114 deletions app/controllers/ios/libraries/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,120 +20,7 @@
GLDateUtils = require('GLCalendarView/GLDateUtils');

var calendar, delegate, currentSelectedRange;

/**
* Create a native class to act as the delegate of the GLCalendarView.
* A delegate is similar to an Alloy javascript controller file for the XML
* view. It is responsible for interacting with the UI elements.
*
* GLCalendarView Obj- C Delegate Protocol Reference
* =================================================
* @protocol GLCalendarViewDelegate <NSObject>
* - (BOOL)calenderView:(GLCalendarView *)calendarView canAddRangeWithBeginDate:(NSDate *)beginDate;
* - (GLCalendarDateRange *)calenderView:(GLCalendarView *)calendarView rangeToAddWithBeginDate:(NSDate *)beginDate;
* - (void)calenderView:(GLCalendarView *)calendarView beginToEditRange:(GLCalendarDateRange *)range;
* - (void)calenderView:(GLCalendarView *)calendarView finishEditRange:(GLCalendarDateRange *)range continueEditing:(BOOL)continueEditing;
* - (BOOL)calenderView:(GLCalendarView *)calendarView canUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate;
* - (void)calenderView:(GLCalendarView *)calendarView didUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate;
* @optional
* - (NSArray *)weekDayTitlesForCalendarView:(GLCalendarView *)calendarView;
* @end
*/
var CalendarDelegate = Hyperloop.defineClass('CalendarDelegate', 'NSObject'/*,'GLCalendarViewDelegate'*/);


/**
* Implement the required delegate methods that are defined by the
* GLCalendarView
*/
CalendarDelegate.addMethod({
selector: 'calenderView:canAddRangeWithBeginDate:',
instance: true,
returnType: 'BOOL',
arguments: [
'GLCalendarView',
'NSDate'
],
callback: function (view, beginDate) {
return true;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:rangeToAddWithBeginDate:',
instance: true,
returnType: 'GLCalendarDateRange',
arguments: [
'GLCalendarView',
'NSDate'
],
callback: function (calendarView, beginDate) {
Ti.API.info(beginDate);

var endDate = GLDateUtils.dateByAddingDaysToDate(2, beginDate);
var range = GLCalendarDateRange.rangeWithBeginDateEndDate(beginDate, endDate);
range.backgroundColor = UIColor.redColor;
range.editable = true;

return range;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:beginToEditRange:',
instance: true,
arguments: [
'GLCalendarView',
'NSDate'
],
callback: function (view, range) {
Ti.API.info('calenderView:beginToEditRange:');
currentSelectedRange = range;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:finishEditRange:continueEditing:',
instance: true,
arguments: [
'GLCalendarView',
'NSDate',
'BOOL'
],
callback: function (view, range, continueEditing) {
currentSelectedRange = null;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:canUpdateRange:toBeginDate:endDate:',
instance: true,
returnType: 'BOOL',
arguments: [
'GLCalendarView',
'GLCalendarDateRange',
'NSDate',
'NSDate'
],
callback: function (view, range, beginDate, endDate) {
return true;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:didUpdateRange:toBeginDate:endDate:',
instance: true,
arguments: [
'GLCalendarView',
'GLCalendarDateRange',
'NSDate',
'NSDate'
],
callback: function (view, range, beginDate, endDate) {
Ti.API.info('Did Update Range' + range);
return;
}
});
var CalendarDelegate = require('/subclasses/calendardelegate');

// Get the screensize
var bounds = UIScreen.mainScreen.bounds
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/ios/libraries/charting.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

// make the chart take up most of the screen bounds
var bounds = UIScreen.mainScreen.bounds;
chart.frame = CGRectMake(0, 0, bounds.size.width - 40, bounds.size.height - 100);
chart.frame = CGRectMake(20, 0, bounds.size.width - 40, bounds.size.height - 100);

// docs say we need to reload the data initially to cause it to paint
chart.reloadData();
Expand Down
114 changes: 114 additions & 0 deletions app/lib/ios/subclasses/calendardelegate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* Create a native class to act as the delegate of the GLCalendarView.
* A delegate is similar to an Alloy javascript controller file for the XML
* view. It is responsible for interacting with the UI elements.
*
* GLCalendarView Obj- C Delegate Protocol Reference
* =================================================
* @protocol GLCalendarViewDelegate <NSObject>
* - (BOOL)calenderView:(GLCalendarView *)calendarView canAddRangeWithBeginDate:(NSDate *)beginDate;
* - (GLCalendarDateRange *)calenderView:(GLCalendarView *)calendarView rangeToAddWithBeginDate:(NSDate *)beginDate;
* - (void)calenderView:(GLCalendarView *)calendarView beginToEditRange:(GLCalendarDateRange *)range;
* - (void)calenderView:(GLCalendarView *)calendarView finishEditRange:(GLCalendarDateRange *)range continueEditing:(BOOL)continueEditing;
* - (BOOL)calenderView:(GLCalendarView *)calendarView canUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate;
* - (void)calenderView:(GLCalendarView *)calendarView didUpdateRange:(GLCalendarDateRange *)range toBeginDate:(NSDate *)beginDate endDate:(NSDate *)endDate;
* @optional
* - (NSArray *)weekDayTitlesForCalendarView:(GLCalendarView *)calendarView;
* @end
*/
var CalendarDelegate = Hyperloop.defineClass('CalendarDelegate', 'NSObject');

/**
* Implement the required delegate methods that are defined by the
* GLCalendarView
*/
CalendarDelegate.addMethod({
selector: 'calenderView:canAddRangeWithBeginDate:',
instance: true,
returnType: 'BOOL',
arguments: [
'GLCalendarView',
'NSDate'
],
callback: function (view, beginDate) {
return true;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:rangeToAddWithBeginDate:',
instance: true,
returnType: 'GLCalendarDateRange',
arguments: [
'GLCalendarView',
'NSDate'
],
callback: function (calendarView, beginDate) {
Ti.API.info(beginDate);

var endDate = GLDateUtils.dateByAddingDaysToDate(2, beginDate);
var range = GLCalendarDateRange.rangeWithBeginDateEndDate(beginDate, endDate);
range.backgroundColor = UIColor.redColor;
range.editable = true;

return range;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:beginToEditRange:',
instance: true,
arguments: [
'GLCalendarView',
'NSDate'
],
callback: function (view, range) {
Ti.API.info('calenderView:beginToEditRange:');
currentSelectedRange = range;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:finishEditRange:continueEditing:',
instance: true,
arguments: [
'GLCalendarView',
'NSDate',
'BOOL'
],
callback: function (view, range, continueEditing) {
currentSelectedRange = null;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:canUpdateRange:toBeginDate:endDate:',
instance: true,
returnType: 'BOOL',
arguments: [
'GLCalendarView',
'GLCalendarDateRange',
'NSDate',
'NSDate'
],
callback: function (view, range, beginDate, endDate) {
return true;
}
});

CalendarDelegate.addMethod({
selector: 'calenderView:didUpdateRange:toBeginDate:endDate:',
instance: true,
arguments: [
'GLCalendarView',
'GLCalendarDateRange',
'NSDate',
'NSDate'
],
callback: function (view, range, beginDate, endDate) {
Ti.API.info('Did Update Range' + range);
return;
}
});

module.exports = CalendarDelegate;