contactsLoaded: null,
+ checkedLogs: [],
+
/**
* @type {TemplateManager}
*/
addEvents: function Ui_addEvents() {
var self = this;
+ $(window).on('softkeyboardchange', function () {
+ $.mobile.activePage.page('refresh');
+ });
+
$('#callView').on('tap', '.ui-btn-back', app.exit.bind(app));
$('#callView').on('pagebeforeshow', function () {
$('#historyForCallerView .ui-content.ui-scrollview-clip .ui-scrollview-view')
.css('-webkit-transform', 'translate3d(0px, 0px, 0px)');
$('#selectAllDetails').on('change', function () {
- self.selectAllDetails();
+ self.selectAll();
});
});
$('#content').css('top', '160px');
$('#header').css('height', '160px');
$('#delete-toolbar').css('width', '70px');
+ $('#callerListContainer')
+ .children('.ui-overflow-indicator-top', '.ui-overflow-indicator-bottom')
+ .hide();
+ });
+
+ $('#callerListContainer').on('scrollstart', function () {
+ $(this)
+ .children('.ui-overflow-indicator-top', '.ui-overflow-indicator-bottom')
+ .fadeIn(200);
+ });
+
+ $('#callerListContainer').on('scrollstop', function () {
+ $(this)
+ .children('.ui-overflow-indicator-top', '.ui-overflow-indicator-bottom')
+ .fadeOut(200);
});
$(window).on('resize', function () {
$('#errorPopup').on('tap', '#errorPopupOkBtn', this.closeErrorPopup);
- // workaround fix for N_SE-39520
- window.addEventListener('softkeyboardchange', function (e) {
- if (e.state === 'off') {
- $.mobile.activePage.page('refresh');
+ $(window).keyup(function(e){
+ if (e.which === 13) {
+ $('input:focus').blur();
+ }
+ });
+
+ document.addEventListener('tizenhwkey', function(e) {
+ if (e.keyName == "back") {
+ if ($.mobile.activePage.attr('id') === 'callView') {
+ tizen.application.getCurrentApplication().exit();
+ } else {
+ history.back();
+ }
}
});
+
+ self.onVisibilityChange();
},
lockOptionButtons: function () {
});
},
- selectAll: function Ui_selectAll() {
- var selectAll = $('#selectAllDetails');
- if (selectAll.attr('checked')) {
- selectAll
- .attr('checked', false)
- .data('checkboxradio')
- .refresh();
- } else {
- selectAll
- .attr('checked', true)
- .data('checkboxradio')
- .refresh();
- }
- },
-
- selectAllDetails: function Ui_selectAllDetails() {
+ selectAll: function () {
if ($('#selectAllDetails').attr('checked')) {
- $('#selectAllDetails')
- .attr('checked', true)
- .data('checkboxradio')
- .refresh();
+ this.selectCheckbox($('#selectAllDetails'), true);
} else {
- $('#selectAllDetails')
- .attr('checked', false)
- .data('checkboxradio')
- .refresh();
+ this.selectCheckbox($('#selectAllDetails'), false);
}
this.selectAllDetailsEach();
},
+ selectCheckbox: function (obj, state) {
+ obj.attr('checked', state)
+ .data('checkboxradio')
+ .refresh();
+ },
+
/**
* Returns number of selected call logs
* @return {number} length
},
selectAllDetailsEach: function Ui_selectAllDetailsEach() {
+ var self = this;
$('#forCallerList').find('input').each(function () {
if ($('#selectAllDetails').attr('checked')) {
- $(this).attr('checked', true)
- .data('checkboxradio')
- .refresh();
+ self.selectCheckbox($(this), true);
} else {
- $(this).attr('checked', false)
- .data('checkboxradio')
- .refresh();
+ self.selectCheckbox($(this), false);
}
});
},
* Hides checkboxes
*/
hideCheckboxes: function Ui_hideCheckboxes() {
- $('#selectAllDetails')
- .attr('checked', false)
- .data('checkboxradio')
- .refresh();
+ var self = this;
+ this.selectCheckbox($('#selectAllDetails'), false);
$('#forCallerList').find('input').each(function () {
- $(this).attr('checked', false)
- .data('checkboxradio')
- .refresh();
+ self.selectCheckbox($(this), false);
});
this.changeDetailsToRemoveState('hide');
},
},
setSelectAllDetails: function Ui_setSelectAllDetails() {
- if ($('#forCallerList input[type="checkbox"]').length === $('#forCallerList input[checked="checked"]').length) {
- $('#selectAllDetails')
- .attr('checked', true)
- .data('checkboxradio')
- .refresh();
+ if ($('#forCallerList input[type="checkbox"]').length ===
+ $('#forCallerList input[checked="checked"]').length) {
+ this.selectCheckbox($('#selectAllDetails'), true);
} else {
- $('#selectAllDetails')
- .attr('checked', false)
- .data('checkboxradio')
- .refresh();
+ this.selectCheckbox($('#selectAllDetails'), false);
}
},
deleteCheckedLogs: function Ui_deleteCheckedLogs(e) {
this.closePopup();
- $('#selectAllDetails')
- .attr('checked', false)
- .data('checkboxradio')
- .refresh();
+ this.selectCheckbox($('#selectAllDetails'), false);
$('#forCallerList li.call').each(function () {
if ($(this).find('form label').hasClass('ui-checkbox-on')) {
/* workaround for registering call during working app in removeMode */
if (this.removeMode) {
if ($('#selectAllDetails').attr('checked')){
- this.selectAllDetails();
+ this.selectAll();
+ $('.toRemove, .selectAllBox', $('#historyForCallerView'))
+ .removeClass('hidden');
}
$('#forCallerList .toRemove').show()
}
tpl = this.templateManager.get('callItemRow', {
'name': name,
'callTime': entry.startTime.toLocaleTimeString(),
- 'cssClasses': this.cssClassesForEntry(entry)
+ 'cssClasses': this.cssClassesForEntry(entry),
+ 'uid': entry.uid
});
return $(tpl)
* @returns {HTMLElement}
*/
getCallerCallLogRow: function Ui_getCallerCallLogRow(entry) {
-
return $(this.templateManager.get('callerCallItemRow', {
'cssClass': this.cssClassesForEntry(entry),
'callTime': entry.startTime.toLocaleTimeString(),
- 'callDuration': this.helpers.secondsToHours(entry.duration)
+ 'callDuration': this.helpers.secondsToHours(entry.duration),
+ 'uid': entry.uid
})).data('entries', [entry]).get(0);
},
if (len) {
this.updateCallerHeader(entries[0], entries.length);
+ } else {
+ // if last call log has been removed
+ this.removedLastLog();
+ this.app.lastViewedCaller = 0;
}
$('#forCallerList')
$('#forCallerList').trigger('create');
+ // change to remove mode if it was active before registering call
+ if (this.removeMode) {
+ this.removeMode = !this.removeMode;
+ this.changeDetailsToRemoveState();
+ // check previous checked entries
+ this.checkedLogs.forEach(function(logUid){
+ var checkbox = $('#forCallerList li.call[data-uid="' + logUid + '"]')
+ .find(':checkbox');
+ checkbox.attr('checked', true)
+ .data('checkboxradio')
+ .refresh();
+ });
+ this.checkedLogs = [];
+ }
this.addEventsForCallerListCheckboxes();
},
scrollView.css("-webkit-transform", "translate3d(0px, -" + scrollView.height() + "px, 0px)");
},
+ onVisibilityChange: function () {
+ var self = this;
+ document.addEventListener('webkitvisibilitychange', function () {
+ if (document.webkitVisibilityState === 'hidden') {
+ $('#forCallerList li.call').each(function () {
+ if ($(this).find('form label').hasClass('ui-checkbox-on')) {
+ var checkedEntry = $(this).data('entries')[0];
+ self.checkedLogs.push(checkedEntry.uid);
+ }
+ });
+ }
+ });
+ },
+
/**
* WORKAROUND;
* Patch for UI, bad refresh scrollView
};
scrollView.hide();
setTimeout(show, 0);
+ },
+
+ removedLastLog: function () {
+ this.hideCheckboxes();
+ $(".ui-popup").popup('close');
+ $.mobile.changePage('#callView');
}
};