-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide keyboard on MainPage when the app start
- Loading branch information
Luis Alberto Pena Nunez
committed
Apr 12, 2016
1 parent
1af1af3
commit 93a1ef1
Showing
7 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using Core; | ||
using Android.Views.InputMethods; | ||
using Android.Content; | ||
using Android.Views; | ||
|
||
namespace Android | ||
{ | ||
public class KeyboardService : IKeyboardService | ||
{ | ||
InputMethodManager _inputMethodManager; | ||
|
||
IContextService _contextService; | ||
|
||
public KeyboardService (IContextService contextService) | ||
{ | ||
_contextService = contextService; | ||
|
||
_inputMethodManager = | ||
((Context)_contextService.GetContext ()).GetSystemService (Context.InputMethodService) as InputMethodManager; | ||
} | ||
|
||
public void ShowKeyboard (object focusOver) | ||
{ | ||
if(focusOver == null) | ||
throw new ArgumentNullException("focusOver"); | ||
|
||
var focus = (View) focusOver; | ||
|
||
_inputMethodManager.ShowSoftInput(focus, ShowFlags.Forced); | ||
|
||
_inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
|
||
namespace Core | ||
{ | ||
public interface IKeyboardService | ||
{ | ||
void ShowKeyboard(object toFocusOn); | ||
} | ||
} | ||
|