1package com.xtremelabs.robolectric.shadows;
2
3import android.os.IBinder;
4import android.os.ResultReceiver;
5import android.view.View;
6import android.view.inputmethod.InputMethodManager;
7
8import com.xtremelabs.robolectric.internal.Implementation;
9import com.xtremelabs.robolectric.internal.Implements;
10
11@Implements(InputMethodManager.class)
12public class ShadowInputMethodManager {
13
14	private boolean softInputVisible;
15
16	@Implementation
17	public boolean showSoftInput(View view, int flags) {
18		return showSoftInput(view, flags, null);
19	}
20
21	@Implementation
22	public boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver) {
23		softInputVisible = true;
24		return true;
25	}
26
27	@Implementation
28	public boolean hideSoftInputFromWindow(IBinder windowToken, int flags) {
29		return hideSoftInputFromWindow(windowToken, flags, null);
30	}
31
32	@Implementation
33	public boolean hideSoftInputFromWindow(IBinder windowToken, int flags, ResultReceiver resultReceiver) {
34		softInputVisible = false;
35		return true;
36	}
37
38	public boolean isSoftInputVisible() {
39		return softInputVisible;
40	}
41}
42