Home | History | Annotate | Download | only in shadows
      1 package com.xtremelabs.robolectric.shadows;
      2 
      3 import android.os.IBinder;
      4 import android.os.ResultReceiver;
      5 import android.view.View;
      6 import android.view.inputmethod.InputMethodManager;
      7 
      8 import com.xtremelabs.robolectric.internal.Implementation;
      9 import com.xtremelabs.robolectric.internal.Implements;
     10 
     11 @Implements(InputMethodManager.class)
     12 public 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