File tree Expand file tree Collapse file tree 7 files changed +61
-4
lines changed Expand file tree Collapse file tree 7 files changed +61
-4
lines changed Original file line number Diff line number Diff line change 1818 <preference name =" BackupWebStorage" value =" none" />
1919 <preference name =" SplashScreen" value =" screen" />
2020 <preference name =" SplashScreenDelay" value =" 3000" />
21+ <preference name =" KeyboardDisplayRequiresUserAction" value =" false" />
2122 <feature name =" StatusBar" >
2223 <param name =" ios-package" value =" CDVStatusBar" onload =" true" />
2324 </feature >
Original file line number Diff line number Diff line change 33 < form class ="list ">
44 < label class ="item item-input ">
55 < i class ="icon ion-search placeholder-icon "> </ i >
6- < input type ="text " placeholder ="{{ 'mm.courses.search' | translate}} " ng-model ="searchText ">
6+ < input type ="text " placeholder ="{{ 'mm.courses.search' | translate}} " ng-model ="searchText " mm-auto-focus >
77 </ label >
88 < button class ="button button-block " ng-click ="search(searchText) " ng-disabled ="searchText.length < 3 ">
99 {{ 'mm.courses.search' | translate }}
Original file line number Diff line number Diff line change 55 < form >
66 < label class ="item item-input item-stacked-label ">
77 < span class ="input-label "> {{ 'mm.login.username' | translate }}</ span >
8- < input type ="text " placeholder ="{{ 'mm.login.username' | translate }} " ng-model ="credentials.username " autocapitalize ="off " autocorrect ="off ">
8+ < input type ="text " placeholder ="{{ 'mm.login.username' | translate }} " ng-model ="credentials.username " autocapitalize ="off " autocorrect ="off " mm-auto-focus >
99 </ label >
1010 < label class ="item item-input item-stacked-label ">
1111 < span class ="input-label "> {{ 'mm.login.password' | translate }}</ span >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ <h2>{{ 'mm.login.username' | translate }}</h2>
1313 < form >
1414 < label class ="item item-input item-stacked-label ">
1515 < span class ="input-label "> {{ 'mm.login.password' | translate }}</ span >
16- < input type ="password " placeholder ="{{ 'mm.login.password' | translate }} " ng-model ="credentials.password ">
16+ < input type ="password " placeholder ="{{ 'mm.login.password' | translate }} " ng-model ="credentials.password " mm-auto-focus >
1717 </ label >
1818 < div class ="item ">
1919 < button class ="button button-block " ng-click ="login() "> {{ 'mm.login.loginbutton' | translate }}</ button >
Original file line number Diff line number Diff line change 88 < form >
99 < label class ="item item-input item-stacked-label ">
1010 < span class ="input-label "> {{ 'mm.login.siteaddress' | translate }}</ span >
11- < input type ="url " placeholder ="moodle.org " ng-model ="siteurl " mm-no-input-validation ng-change ="validate(siteurl) " >
11+ < input type ="url " placeholder ="moodle.org " ng-model ="siteurl " mm-no-input-validation ng-change ="validate(siteurl) " mm-auto-focus >
1212 </ label >
1313 < div class ="item ">
1414 < button class ="button button-block " ng-click ="connect(siteurl) " ng-disabled ="isInvalidUrl "> {{ 'mm.login.connect' | translate }}</ button >
Original file line number Diff line number Diff line change 1+ // (C) Copyright 2015 Martin Dougiamas
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ angular . module ( 'mm.core' )
16+
17+ /**
18+ * Directive to auto focus an element when a view is loaded.
19+ *
20+ * @module mm.core
21+ * @ngdoc directive
22+ * @name mmAutoFocus
23+ */
24+ . directive ( 'mmAutoFocus' , function ( $mmApp ) {
25+ return {
26+ restrict : 'A' ,
27+ link : function ( scope , el ) {
28+ // Wait for transition to finish before auto-focus.
29+ var unregister = scope . $watch ( function ( ) {
30+ return ionic . transition . isActive ;
31+ } , function ( isActive ) {
32+ if ( ! isActive ) {
33+ el [ 0 ] . focus ( ) ;
34+ unregister ( ) ; // Stop watching.
35+ if ( ionic . Platform . isAndroid ( ) ) {
36+ // On some Android versions the keyboard doesn't open automatically.
37+ $mmApp . openKeyboard ( ) ;
38+ }
39+ }
40+ } ) ;
41+ }
42+ } ;
43+ } ) ;
Original file line number Diff line number Diff line change @@ -238,6 +238,19 @@ angular.module('mm.core')
238238 return promise . $$state . status === 1 ;
239239 } ;
240240
241+ /**
242+ * Open the keyboard if plugin is available.
243+ *
244+ * @return {Boolean } True if plugin is available, false otherwise.
245+ */
246+ self . openKeyboard = function ( ) {
247+ if ( typeof cordova != 'undefined' && cordova . plugins && cordova . plugins . Keyboard && cordova . plugins . Keyboard . show ) {
248+ cordova . plugins . Keyboard . show ( ) ;
249+ return true ;
250+ }
251+ return false ;
252+ } ;
253+
241254 /**
242255 * Resolves when the app is ready.
243256 *
You can’t perform that action at this time.
0 commit comments