Fix TC-2267 - Calling history refresh too slow 11/32711/2 accepted/tizen/ivi/20141223.032814 submit/tizen_ivi/20141222.201953 submit/tizen_ivi/20141223.011051
authorJimmy Huang <jimmy.huang@intel.com>
Mon, 22 Dec 2014 20:02:57 +0000 (12:02 -0800)
committerJimmy Huang <jimmy.huang@intel.com>
Mon, 22 Dec 2014 20:08:11 +0000 (12:08 -0800)
Phone call history is not updated efficiently since everytime a call
entry is added, it removes all the existing entries and reload
all call history items and recreates all the html elements.  It's a
huge performance hit on the app performance as the history grow longer.
This patch will only append the new call history to the existing
call history list

Change-Id: I657379b5ef1f84221b478dcc9f6530ba026d9c26
Signed-off-by: Jimmy Huang <jimmy.huang@intel.com>
js/callhistorycarousel.js
js/main.js
packaging/modello-phone.changes

index 211cba0..b2b69b8 100644 (file)
@@ -131,6 +131,36 @@ Carousel.prototype.loadCallHistory = function(callHistory, index) {
        }
 };
 /**
+ * This method adds newest call history data up to the index given and reset position to start.
+ *
+ * @method addCallHistory
+ * @param  callHistory {Array} Call history array.
+ * @param  index {Integer} Index position of the last entry that needs to be added.
+ */
+Carousel.prototype.addCallHistory = function(callHistory, index) {
+        "use strict";
+        var carouselItem;
+        this.callHistory = callHistory;
+
+        if (!!this.swipe) {
+                this.swipe.trigger("removeItem", 0);
+
+                for (var i = index; i >= 0; i--) {
+                        carouselItem = this.createSwipeItem(this.callHistory[i], i);
+                        if (!!carouselItem && !!this.swipe) {
+                                this.swipe.trigger("insertItem", [ carouselItem, 0 ]);
+                        }
+                }
+
+                var html = "<li><div class='carouselEdgeBox'></div></li>";
+                this.swipe.trigger("insertItem", [ html, 0 ]);
+
+                this.swipe.trigger("slideTo", [ 0, 0, {
+                        duration : 0
+                } ]);
+        }
+};
+/**
  * This method creates one carousel item for swipe.
  *
  * @method createSwipeItem
index 02440c9..4111f4c 100644 (file)
@@ -701,8 +701,7 @@ $(document).ready(
                             tmpCallHistory.unshift(tmpContact[0]);
                             Phone.callHistory(tmpCallHistory);
 
-                            callHistoryCarousel.loadCallHistory(Phone.callHistory(), 0);
-
+                            callHistoryCarousel.addCallHistory(Phone.callHistory(), 0);
                         }
                     });
                     /* add listener to change call state */
index c82574b..cf9af27 100644 (file)
@@ -1,3 +1,6 @@
+* Mon Dec 22 2014 Jimmy Huang <jimmy.huang@intel.com> accepted/tizen/ivi/20141212.011920-1-gd50348c
+- Fix TC-2267 - Calling history refresh too slow
+
 * Thu Dec 11 2014 Jimmy Huang <jimmy.huang@intel.com> accepted/tizen/ivi/20141208.013020-1-gcd10124
 - Fix download history spinner sometimes not hiding correctly