diff --git a/apps/keyboard/js/keyboard/active_targets_manager.js b/apps/keyboard/js/keyboard/active_targets_manager.js index f97d18232084..9ccaff4d16c5 100644 --- a/apps/keyboard/js/keyboard/active_targets_manager.js +++ b/apps/keyboard/js/keyboard/active_targets_manager.js @@ -33,6 +33,7 @@ ActiveTargetsManager.prototype.ontargetmovedin = null; ActiveTargetsManager.prototype.ontargetcommitted = null; ActiveTargetsManager.prototype.ontargetcancelled = null; ActiveTargetsManager.prototype.ontargetdoubletapped = null; +ActiveTargetsManager.prototype.onnewtargetwillactivate = null; // Show accent char menu (if there is one) or do other stuff // after LONG_PRESS_TIMEOUT @@ -90,10 +91,11 @@ ActiveTargetsManager.prototype._handlePressStart = function(press, id) { return; } - // All targets before the new touch need to be committed, - // according to UX requirement. + // Notify current targets about the new touch. this.activeTargets.forEach(function(target, id) { - this._handlePressEnd(press, id); + if (typeof this.onnewtargetwillactivate === 'function') { + this.onnewtargetwillactivate(target); + } }, this); var target = press.target; diff --git a/apps/keyboard/js/keyboard/target_handlers.js b/apps/keyboard/js/keyboard/target_handlers.js index 283cd4e10fbd..341cc17ab8b6 100644 --- a/apps/keyboard/js/keyboard/target_handlers.js +++ b/apps/keyboard/js/keyboard/target_handlers.js @@ -65,6 +65,10 @@ DefaultTargetHandler.prototype.cancel = function() { DefaultTargetHandler.prototype.doubleTap = function() { this.commit(); }; +DefaultTargetHandler.prototype.newTargetActivate = function() { + // Ignore any action when commit. + this.ignoreCommitActions = true; +}; var NullTargetHandler = function(target, app) { DefaultTargetHandler.apply(this, arguments); @@ -257,6 +261,14 @@ CapsLockTargetHandler.prototype.doubleTap = function() { }); this.app.visualHighlightManager.hide(this.target); }; +CapsLockTargetHandler.prototype.newTargetActivate = function() { + // Need a new state here, like isUpperCaseCombo, + // otherwise the UI is not correct ? + this.app.upperCaseStateManager.switchUpperCaseState({ + isUpperCase: true + }); + this.app.visualHighlightManager.hide(this.target); +}; var SwitchKeyboardTargetHandler = function(target, app) { DefaultTargetHandler.apply(this, arguments); diff --git a/apps/keyboard/js/keyboard/target_handlers_manager.js b/apps/keyboard/js/keyboard/target_handlers_manager.js index 3362651c3fd3..f21bf78154e4 100644 --- a/apps/keyboard/js/keyboard/target_handlers_manager.js +++ b/apps/keyboard/js/keyboard/target_handlers_manager.js @@ -37,6 +37,8 @@ TargetHandlersManager.prototype.start = function() { this._callTargetAction.bind(this, 'cancel', false, true); activeTargetsManager.ontargetdoubletapped = this._callTargetAction.bind(this, 'doubleTap', false, true); + activeTargetsManager.onnewtargetwillactivate = + this._callTargetAction.bind(this, 'newTargetActivate', false, true); activeTargetsManager.start(); };