Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 985853 - [Keyboard UX update][User Story] Hold shift to enter upp…
Browse files Browse the repository at this point in the history
…er case characters
  • Loading branch information
dxue committed Sep 28, 2014
1 parent 97748c8 commit 7b83f4d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/keyboard/js/keyboard/active_targets_manager.js
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions apps/keyboard/js/keyboard/target_handlers.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions apps/keyboard/js/keyboard/target_handlers_manager.js
Expand Up @@ -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();
};

Expand Down

0 comments on commit 7b83f4d

Please sign in to comment.