Package org.robolectric.shadows
Class ShadowInputMethodManager
java.lang.Object
org.robolectric.shadows.ShadowInputMethodManager
@Implements(android.view.inputmethod.InputMethodManager.class) public class ShadowInputMethodManager extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ShadowInputMethodManager.PrivateCommandListener
Handler for receiving PrivateCommands.static interface
ShadowInputMethodManager.SoftInputVisibilityChangeHandler
Handler for receiving soft input visibility changed event. -
Constructor Summary
Constructors Constructor Description ShadowInputMethodManager()
-
Method Summary
Modifier and Type Method Description protected void
closeCurrentInput()
The framework implementation does a blocking call to system server.protected void
displayCompletions(View view, CompletionInfo[] completions)
protected void
focusIn(View view)
protected InputMethodSubtype
getCurrentInputMethodSubtype()
Returns theInputMethodSubtype
that is installed.protected List<InputMethodInfo>
getEnabledInputMethodList()
Returns the list ofInputMethodInfo
that are enabled.protected List<InputMethodInfo>
getInputMethodList()
Returns the list ofInputMethodInfo
that are installed.protected boolean
hideSoftInputFromWindow(IBinder windowToken, int flags)
protected boolean
hideSoftInputFromWindow(IBinder windowToken, int flags, ResultReceiver resultReceiver)
protected boolean
hideSoftInputFromWindow(IBinder windowToken, int flags, ResultReceiver resultReceiver, int ignoredReason)
protected boolean
isActive()
protected boolean
isActive(View view)
protected boolean
isFullscreenMode()
boolean
isSoftInputVisible()
protected void
onViewDetachedFromWindow(View view)
protected static InputMethodManager
peekInstance()
static void
reset()
protected void
restartInput(View view)
protected void
sendAppPrivateCommand(View view, String action, Bundle data)
void
setAppPrivateCommandListener(ShadowInputMethodManager.PrivateCommandListener listener)
void
setCurrentInputMethodSubtype(InputMethodSubtype inputMethodSubtype)
Sets the currentInputMethodSubtype
that will be returned bygetCurrentInputMethodSubtype()
.void
setEnabledInputMethodInfoList(List<InputMethodInfo> inputMethodInfoList)
Sets the list ofInputMethodInfo
that are marked as enabled.void
setInputMethodInfoList(List<InputMethodInfo> inputMethodInfoList)
Sets the list ofInputMethodInfo
that are marked as installed.void
setSoftInputVisibilityHandler(ShadowInputMethodManager.SoftInputVisibilityChangeHandler visibilityChangeHandler)
protected boolean
showSoftInput(View view, int flags)
protected boolean
showSoftInput(View view, int flags, ResultReceiver resultReceiver)
protected boolean
showSoftInput(View view, int flags, ResultReceiver resultReceiver, int ignoredReason)
protected boolean
startInputInner(int startInputReason, IBinder windowGainingFocus, int startInputFlags, int softInputMode, int windowFlags)
protected void
toggleSoftInput(int showFlags, int hideFlags)
-
Constructor Details
-
ShadowInputMethodManager
public ShadowInputMethodManager()
-
-
Method Details
-
showSoftInput
-
showSoftInput
@Implementation(maxSdk=30) protected boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver) -
showSoftInput
@Implementation(minSdk=31, maxSdk=33) protected boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver, int ignoredReason) -
hideSoftInputFromWindow
@Implementation(minSdk=31) protected boolean hideSoftInputFromWindow(IBinder windowToken, int flags, ResultReceiver resultReceiver, int ignoredReason) -
hideSoftInputFromWindow
@Implementation(maxSdk=30) protected boolean hideSoftInputFromWindow(IBinder windowToken, int flags) -
hideSoftInputFromWindow
@Implementation protected boolean hideSoftInputFromWindow(IBinder windowToken, int flags, ResultReceiver resultReceiver) -
toggleSoftInput
-
isSoftInputVisible
public boolean isSoftInputVisible() -
setSoftInputVisibilityHandler
public void setSoftInputVisibilityHandler(ShadowInputMethodManager.SoftInputVisibilityChangeHandler visibilityChangeHandler) -
closeCurrentInput
The framework implementation does a blocking call to system server. This will deadlock on Robolectric, so just stub out the method. -
getInputMethodList
Returns the list ofInputMethodInfo
that are installed.This method differs from Android implementation by allowing the list to be set using
setInputMethodInfoList(List)
. -
setInputMethodInfoList
Sets the list ofInputMethodInfo
that are marked as installed. SeegetInputMethodList()
. -
getCurrentInputMethodSubtype
Returns theInputMethodSubtype
that is installed.This method differs from Android implementation by allowing the list to be set using
setCurrentInputMethodSubtype(InputMethodSubtype)
. -
setCurrentInputMethodSubtype
Sets the currentInputMethodSubtype
that will be returned bygetCurrentInputMethodSubtype()
. -
getEnabledInputMethodList
Returns the list ofInputMethodInfo
that are enabled.This method differs from Android implementation by allowing the list to be set using
setEnabledInputMethodInfoList(List)
. -
setEnabledInputMethodInfoList
Sets the list ofInputMethodInfo
that are marked as enabled. SeegetEnabledInputMethodList()
. -
restartInput
-
isActive
-
isActive
-
isFullscreenMode
-
focusIn
-
onViewDetachedFromWindow
-
displayCompletions
-
peekInstance
-
startInputInner
@Implementation(minSdk=24) protected boolean startInputInner(int startInputReason, IBinder windowGainingFocus, int startInputFlags, int softInputMode, int windowFlags) -
sendAppPrivateCommand
@Implementation(minSdk=23) protected void sendAppPrivateCommand(View view, String action, Bundle data) -
setAppPrivateCommandListener
-
reset
-