Commit 12bda387 authored by sammiequon's avatar sammiequon Committed by Commit bot

Lock screen pin keyboard ui upgrades.

Changed the pin keyboard to match the specs at https://folio.googleplex.com/cros-core-ui/spec#%2F5.1%20-%20Start%20screen%20Pin%20lock%20pods.png%3Fz=width, minus the submit button on the normal pod and the errors on the pin keyboard.

BUG=627222
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2222583002
Cr-Commit-Position: refs/heads/master@{#414858}
parent 92c4a9fc
...@@ -13210,11 +13210,14 @@ Please check your email at <ph name="ACCOUNT_EMAIL">$2<ex>jane.doe@gmail.com</ex ...@@ -13210,11 +13210,14 @@ Please check your email at <ph name="ACCOUNT_EMAIL">$2<ex>jane.doe@gmail.com</ex
PIN PIN
</message> </message>
<message name="IDS_PIN_KEYBOARD_HINT_TEXT_PIN_PASSWORD" desc="Text to display in the pin field for user pod when no pin has been entered, and passwords are allowed."> <message name="IDS_PIN_KEYBOARD_HINT_TEXT_PIN_PASSWORD" desc="Text to display in the pin field for user pod when no pin has been entered, and passwords are allowed.">
Enter PIN or Password Pin or password
</message> </message>
<message name="IDS_PIN_KEYBOARD_CLEAR" desc="Text to display text of button on pin keyboard which deletes last character."> <message name="IDS_PIN_KEYBOARD_CLEAR" desc="Text to display text of button on pin keyboard which deletes last character.">
Clear Clear
</message> </message>
<message name="IDS_PIN_KEYBOARD_ERROR_MESSAGE" desc="Text to display the error message on the pin keyboard if the user has entered a wrong password or pin.">
Pin or password incorrect.
</message>
</if> </if>
<message name="IDS_LOGIN_ERROR_AUTHENTICATING" desc="Couldn't sign in because password is invalid"> <message name="IDS_LOGIN_ERROR_AUTHENTICATING" desc="Couldn't sign in because password is invalid">
Sorry, your password could not be verified. Please try again. Sorry, your password could not be verified. Please try again.
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html">
...@@ -17,7 +18,13 @@ ...@@ -17,7 +18,13 @@
Inlined from Polymer's iron-icons to avoid importing everything. Inlined from Polymer's iron-icons to avoid importing everything.
See http://goo.gl/Y1OdAq for instructions on adding additional icons. See http://goo.gl/Y1OdAq for instructions on adding additional icons.
--> -->
<g id="forward"><path d="M12 8V4l8 8-8 8v-4H4V8z"></path></g> <g id="arrow-forward">
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z">
</path>
</g>
<g id="backspace">
<path d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-3 12.59L17.59 17 14 13.41 10.41 17 9 15.59 12.59 12 9 8.41 10.41 7 14 10.59 17.59 7 19 8.41 15.41 12 19 15.59z">
</g>
</defs> </defs>
</svg> </svg>
</iron-iconset-svg> </iron-iconset-svg>
...@@ -30,10 +37,6 @@ ...@@ -30,10 +37,6 @@
display: flex; display: flex;
} }
.input-non-pin {
direction: rtl;
}
.row { .row {
display: flex; display: flex;
} }
...@@ -41,68 +44,60 @@ ...@@ -41,68 +44,60 @@
.digit-button { .digit-button {
align-items: center; align-items: center;
background: none; background: none;
border-radius: 20px; border-radius: 100px;
box-sizing: border-box; box-sizing: border-box;
color: var(--paper-blue-grey-700); color: #000;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-size: 32px; font-size: 18px;
height: 70px; height: 48px;
justify-content: center; justify-content: center;
margin: 0; margin: 0 6px;
min-height: 70px; min-height: 48px;
min-width: 70px; min-width: 48px;
padding: 15px 20px; opacity: 0.87;
width: 70px; padding: 15px;
width: 48px;
} }
.digit-button.clear-button { [hidden=true] {
display: block; display: none;
} }
.digit-button.center-button { .bottom-row {
margin: 0 30px; margin-bottom: 6px;
} }
.digit-button.submit-button { .top-row {
left: 20px; margin-top: 6px;
position: relative;
} }
.digit-button.submit-button.submit-button-hidden { .digit-button.backspace-button {
display: none; opacity: var(--dark-primary-opacity);
} }
.digit-button .icon-container { .digit-button.backspace-button[disabled] {
background: var(--paper-grey-400); color: #000;
border-radius: 100px; opacity: 0.26;
height: 24px; padding: 14px;
margin: auto;
width: 24px;
}
.digit-button .icon-container.ready-background {
background: var(--paper-blue-800);
} }
.digit-button .icon-container .icon { .digit-button.submit-button {
color: white; color: var(--google-blue-500);
display: block; height: 43px;
height: 16px; left: 137px;
left: 4px; margin: 0;
top: 4px; min-height: 43px;
width: 16px; min-width: 43px;
opacity: var(--light-primary-opacity);
padding: 11.5px 10px;
position: absolute;
width: 43px;
} }
.digit-button .icon-subheading { .digit-button.submit-button[disabled] {
color: var(--paper-grey-400); color: #000;
font-size: 10px; opacity: 0.26;
left: 0;
position: absolute;
text-align: center;
text-transform: capitalize;
top: 44px;
width: 100%;
} }
.digit-button inner-text { .digit-button inner-text {
...@@ -112,31 +107,44 @@ ...@@ -112,31 +107,44 @@
height: 52px; height: 52px;
} }
.first-row {
height: 64px;
min-height: 64px;
padding: 28px 15px 12px 15px;
}
#pin-input { #pin-input {
-webkit-text-security: disc; -webkit-text-security: disc;
background-color: white; background-color: white;
border: 0; border: 0;
box-sizing: border-box; box-sizing: border-box;
font-size: 18px; font-face: Roboto-Regular;
height: 64px; font-size: 13px;
left: 20px; height: 43px;
left: 10px;
opacity: var(--dark-secondary-opacity);
outline: 0; outline: 0;
padding: 28px 3px 12px 3px;
position: relative; position: relative;
width: 180px; text-color: #000;
width: 127px;
}
#pin-input[has-content] {
opacity: var(--dark-primary-opacity);
} }
#pin-input.submit-button-hidden { #pin-input[is-input-rtl] {
border-bottom: 2px; direction: rtl;
border-bottom-style: solid; }
:host(:not([enable-submit-button])) #pin-input {
left: 0;
text-align: center; text-align: center;
width: 230px; width: 180px;
}
hr {
border: 0;
border-bottom: 1px solid #000;
left: 10px;
margin: 0;
opacity: 0.14;
position: relative;
width: 160px;
} }
#pin-input[type=number]::-webkit-inner-spin-button, #pin-input[type=number]::-webkit-inner-spin-button,
...@@ -156,26 +164,25 @@ ...@@ -156,26 +164,25 @@
<div id="container-constrained-width"> <div id="container-constrained-width">
<div class="row"> <div class="row">
<input id="pin-input" type="[[getInputType_(enablePassword)]]" <input id="pin-input" type="[[getInputType_(enablePassword)]]"
class$="[[getInputClass_(value)]] is-input-rtl$="[[isInputRtl_(value)]]"
[[getSubmitHiddenClass_(enableSubmitButton)]]" has-content$="[[hasInput_(value)]]"
placeholder="[[getInputPlaceholder_(enablePassword)]]" placeholder="[[getInputPlaceholder_(enablePassword)]]"
value="{{value::input}}" value="{{value::input}}"
on-keydown="onInputKeyDown_"></input> on-keydown="onInputKeyDown_">
<paper-button class$="digit-button first-row submit-button </input>
[[getSubmitHiddenClass_(enableSubmitButton)]]" <paper-icon-button icon="pin-keyboard:arrow-forward"
on-tap="firePinSubmitEvent_"> class="digit-button submit-button"
<div class$="icon-container [[getSubmitClass_(value)]]"> disabled="[[!hasInput_(value)]]"
<iron-icon class="icon" icon="pin-keyboard:forward"><iron-icon> hidden="[[!enableSubmitButton]]"
</div> on-tap="firePinSubmitEvent_">
</paper-button> </paper-icon-button>
</div> </div>
<hr>
<div class="row keyboard"> <div class="row keyboard top-row">
<paper-button class="digit-button" on-tap="onNumberTap_" value="1"> <paper-button class="digit-button" on-tap="onNumberTap_" value="1">
<inner-text>$i18n{pinKeyboard1}</inner-text> <inner-text>$i18n{pinKeyboard1}</inner-text>
</paper-button> </paper-button>
<paper-button class="digit-button center-button" on-tap="onNumberTap_" <paper-button class="digit-button" on-tap="onNumberTap_" value="2">
value="2">
<inner-text>$i18n{pinKeyboard2}</inner-text> <inner-text>$i18n{pinKeyboard2}</inner-text>
</paper-button> </paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="3"> <paper-button class="digit-button" on-tap="onNumberTap_" value="3">
...@@ -186,8 +193,7 @@ ...@@ -186,8 +193,7 @@
<paper-button class="digit-button" on-tap="onNumberTap_" value="4"> <paper-button class="digit-button" on-tap="onNumberTap_" value="4">
<inner-text>$i18n{pinKeyboard4}</inner-text> <inner-text>$i18n{pinKeyboard4}</inner-text>
</paper-button> </paper-button>
<paper-button class="digit-button center-button" on-tap="onNumberTap_" <paper-button class="digit-button" on-tap="onNumberTap_" value="5">
value="5">
<inner-text>$i18n{pinKeyboard5}</inner-text> <inner-text>$i18n{pinKeyboard5}</inner-text>
</paper-button> </paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="6"> <paper-button class="digit-button" on-tap="onNumberTap_" value="6">
...@@ -198,28 +204,22 @@ ...@@ -198,28 +204,22 @@
<paper-button class="digit-button" on-tap="onNumberTap_" value="7"> <paper-button class="digit-button" on-tap="onNumberTap_" value="7">
<inner-text>$i18n{pinKeyboard7}</inner-text> <inner-text>$i18n{pinKeyboard7}</inner-text>
</paper-button> </paper-button>
<paper-button class="digit-button center-button" on-tap="onNumberTap_" <paper-button class="digit-button" on-tap="onNumberTap_" value="8">
value="8">
<inner-text>$i18n{pinKeyboard8}</inner-text> <inner-text>$i18n{pinKeyboard8}</inner-text>
</paper-button> </paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="9"> <paper-button class="digit-button" on-tap="onNumberTap_" value="9">
<inner-text>$i18n{pinKeyboard9}</inner-text> <inner-text>$i18n{pinKeyboard9}</inner-text>
</paper-button> </paper-button>
</div> </div>
<div class="row keyboard"> <div class="row keyboard bottom-row">
<div class="digit-button"></div> <div class="digit-button"></div>
<paper-button class="digit-button center-button" on-tap="onNumberTap_" <paper-button class="digit-button" on-tap="onNumberTap_" value="0">
value="0">
<inner-text>$i18n{pinKeyboard0}</inner-text> <inner-text>$i18n{pinKeyboard0}</inner-text>
</paper-button> </paper-button>
<paper-button class="digit-button clear-button" on-tap="onPinClear_"> <paper-icon-button class="digit-button backspace-button"
<div class="icon-container"> disabled="[[!hasInput_(value)]]"
<iron-icon class="icon" icon="cr:clear"><iron-icon> on-tap="onPinClear_" icon="pin-keyboard:backspace">
</div> </paper-icon-button>
<inner-text class="icon-subheading">
$i18n{pinKeyboardClear}
</inner-text>
</paper-button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -127,12 +127,12 @@ Polymer({ ...@@ -127,12 +127,12 @@ Polymer({
}, },
/** /**
* Changes the color of the submit button if PIN is ready. * Disables the submit and backspace button if nothing is entered.
* @param {string} value * @param {string} value
* @private * @private
*/ */
getSubmitClass_: function(value) { hasInput_: function(value) {
return value.length > 0 ? 'ready-background' : ''; return value.length > 0;
}, },
/** /**
...@@ -160,7 +160,7 @@ Polymer({ ...@@ -160,7 +160,7 @@ Polymer({
* @param {string} password * @param {string} password
* @private * @private
*/ */
getInputClass_: function(password) { isInputRtl_: function(password) {
// +password will convert a string to a number or to NaN if that's not // +password will convert a string to a number or to NaN if that's not
// possible. Number.isInteger will verify the value is not a NaN and that it // possible. Number.isInteger will verify the value is not a NaN and that it
// does not contain decimals. // does not contain decimals.
...@@ -169,16 +169,6 @@ Polymer({ ...@@ -169,16 +169,6 @@ Polymer({
// Since we still support users entering their passwords through the PIN // Since we still support users entering their passwords through the PIN
// keyboard, we swap the input box to rtl when we think it is a password // keyboard, we swap the input box to rtl when we think it is a password
// (just numbers), if the document direction is rtl. // (just numbers), if the document direction is rtl.
var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); return (document.dir == 'rtl') && !Number.isInteger(+password);
return enableRtl ? 'input-non-pin' : '';
}, },
/**
* Computes if the submit button is visible.
* @param {boolean} submitEnabled
* @private
*/
getSubmitHiddenClass_: function(submitEnabled) {
return submitEnabled ? '' : 'submit-button-hidden';
}
}); });
...@@ -46,22 +46,18 @@ pin-keyboard { ...@@ -46,22 +46,18 @@ pin-keyboard {
.pod.flying-pin-pod { .pod.flying-pin-pod {
transition: height 180ms ease-in-out, transition: height 180ms ease-in-out,
left 180ms ease-in-out, top 180ms ease-in-out;
top 180ms ease-in-out,
width 180ms ease-in-out;
} }
.pod.pin-enabled { .pod.pin-enabled {
height: 594px; height: 417px;
top: -200px !important; top: -87px !important;
width: 270px;
} }
.pod .pin-container { .pod .pin-container {
height: 344px; height: 204px;
position: absolute; position: absolute;
top: 250px; top: 170px;
width: 270px;
} }
.pod.faded { .pod.faded {
...@@ -98,23 +94,11 @@ podrow[ncolumns='6'] .pod { ...@@ -98,23 +94,11 @@ podrow[ncolumns='6'] .pod {
z-index: 3; z-index: 3;
} }
.user-image-pane.pin-enabled {
height: 230px;
left: 20px;
top: 20px;
width: 230px;
}
html[dir=rtl] .user-image-pane { html[dir=rtl] .user-image-pane {
left: auto; left: auto;
right: 10px; right: 10px;
} }
html[dir=rtl] .user-image-pane.pin-enabled {
left: auto;
right: 20px;
}
.user-image-container { .user-image-container {
align-items: center; align-items: center;
display: flex; display: flex;
...@@ -134,14 +118,6 @@ html:not([screen=login-add-user]) .pod .user-image { ...@@ -134,14 +118,6 @@ html:not([screen=login-add-user]) .pod .user-image {
max-width: 160px; max-width: 160px;
opacity: 0.7; opacity: 0.7;
position: absolute; position: absolute;
transition: max-height 180ms ease-in-out,
max-width 180ms ease-in-out,
top 180ms ease-in-out;
}
html:not([screen=login-add-user]) .pod .user-image.pin-enabled {
max-height: 230px;
max-width: 230px;
} }
html:not([screen=login-add-user]) .pod.focused .user-image { html:not([screen=login-add-user]) .pod.focused .user-image {
...@@ -164,18 +140,9 @@ html:not([screen=login-add-user]) .pod.focused .user-image { ...@@ -164,18 +140,9 @@ html:not([screen=login-add-user]) .pod.focused .user-image {
position: absolute; position: absolute;
text-align: center; text-align: center;
top: 0; top: 0;
transition: left 180ms ease-in-out,
top 180ms ease-in-out,
width 180ms ease-in-out;
width: 100%; width: 100%;
} }
.pod.signed-in .signed-in-indicator.pin-enabled {
left: 20px;
top: 20px;
width: 230px;
}
.main-pane { .main-pane {
left: 10px; left: 10px;
position: absolute; position: absolute;
......
...@@ -59,9 +59,7 @@ cr.define('login', function() { ...@@ -59,9 +59,7 @@ cr.define('login', function() {
var POD_ROW_PADDING = 10; var POD_ROW_PADDING = 10;
var DESKTOP_ROW_PADDING = 32; var DESKTOP_ROW_PADDING = 32;
var CUSTOM_ICON_CONTAINER_SIZE = 40; var CUSTOM_ICON_CONTAINER_SIZE = 40;
var CROS_PIN_POD_WIDTH = 270; var CROS_PIN_POD_HEIGHT = 417;
var CROS_PIN_POD_HEIGHT = 594;
var PIN_EXTRA_WIDTH = 90;
/** /**
* Minimal padding between user pod and virtual keyboard. * Minimal padding between user pod and virtual keyboard.
...@@ -1093,6 +1091,10 @@ cr.define('login', function() { ...@@ -1093,6 +1091,10 @@ cr.define('login', function() {
} }
}, },
isPinReady: function() {
return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0;
},
toggleTransitions: function(enable) { toggleTransitions: function(enable) {
this.classList.toggle('flying-pin-pod', enable); this.classList.toggle('flying-pin-pod', enable);
}, },
...@@ -3001,28 +3003,6 @@ cr.define('login', function() { ...@@ -3001,28 +3003,6 @@ cr.define('login', function() {
return {columns: columns, rows: rows}; return {columns: columns, rows: rows};
}, },
/**
* Calculates the row and column of the given |pod|.
* @param {UserPod} pod Pod we want the row and column of.
* @param {number} columns Columns in the podrow.
* @param {number} rows Rows in the podrow.
* @return {{columns: number, rows: number}}
* @private
*/
findPodLocation_: function(pod, columns, rows) {
var column = -1;
var row = -1;
var index = this.pods.indexOf(pod);
if (index >= 0) {
row = Math.floor(index / columns);
column = index % columns;
}
else {
console.error('Pod not found in pod row.');
}
return {column: column, row: row};
},
/** /**
* Places pods onto their positions onto pod grid. * Places pods onto their positions onto pod grid.
* @private * @private
...@@ -3058,23 +3038,16 @@ cr.define('login', function() { ...@@ -3058,23 +3038,16 @@ cr.define('login', function() {
console.error('Pod offsetHeight (' + pod.offsetHeight + console.error('Pod offsetHeight (' + pod.offsetHeight +
') and POD_HEIGHT (' + height + ') are not equal.'); ') and POD_HEIGHT (' + height + ') are not equal.');
} }
if (pod.offsetWidth != width && if (pod.offsetWidth != width) {
pod.offsetWidth != CROS_PIN_POD_WIDTH) {
console.error('Pod offsetWidth (' + pod.offsetWidth + console.error('Pod offsetWidth (' + pod.offsetWidth +
') and POD_WIDTH (' + width + ') are not equal.'); ') and POD_WIDTH (' + width + ') are not equal.');
} }
var column = index % columns; var column = index % columns;
var row = Math.floor(index / columns); var row = Math.floor(index / columns);
var offsetFromPin = 0;
if (row == pinPodLocation.row) {
offsetFromPin = PIN_EXTRA_WIDTH / 2;
if (column <= pinPodLocation.column)
offsetFromPin *= -1;
}
var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING : var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING :
POD_ROW_PADDING; POD_ROW_PADDING;
pod.left = rowPadding + column * (width + margin) + offsetFromPin; pod.left = rowPadding + column * (width + margin);
// On desktop, we want the rows to always be equally spaced. // On desktop, we want the rows to always be equally spaced.
pod.top = isDesktopUserManager ? row * (height + rowPadding) : pod.top = isDesktopUserManager ? row * (height + rowPadding) :
...@@ -3163,7 +3136,9 @@ cr.define('login', function() { ...@@ -3163,7 +3136,9 @@ cr.define('login', function() {
var hadFocus = !!this.focusedPod_; var hadFocus = !!this.focusedPod_;
this.focusedPod_ = podToFocus; this.focusedPod_ = podToFocus;
if (podToFocus) { if (podToFocus) {
this.setFocusedPodPinVisibility(true); // Only show the keyboard if it is fully loaded.
if (podToFocus.isPinReady())
podToFocus.setPinVisibility(true);
podToFocus.classList.remove('faded'); podToFocus.classList.remove('faded');
podToFocus.classList.add('focused'); podToFocus.classList.add('focused');
if (!podToFocus.multiProfilesPolicyApplied) { if (!podToFocus.multiProfilesPolicyApplied) {
...@@ -3186,7 +3161,6 @@ cr.define('login', function() { ...@@ -3186,7 +3161,6 @@ cr.define('login', function() {
this.scrollFocusedPodIntoView(); this.scrollFocusedPodIntoView();
} }
this.insideFocusPod_ = false; this.insideFocusPod_ = false;
this.placePods_();
}, },
/** /**
......
<div id="user-pod-template" class="pod disabled" hidden> <div id="user-pod-template" class="pod disabled" hidden>
<div class="user-image-pane pin-tag"> <div class="user-image-pane">
<div class="user-image-container"> <div class="user-image-container">
<img class="user-image pin-tag" alt> <img class="user-image" alt>
</div> </div>
<div class="signed-in-indicator" i18n-content="signedIn"></div> <div class="signed-in-indicator" i18n-content="signedIn"></div>
<div class="indicator-container"> <div class="indicator-container">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment