switch to alsa.omap3 module
[android_pandora.git] / apps / oi-filemanager / FileManager / src / org / openintents / filemanager / compatibility / SoftKeyboard.java
1 package org.openintents.filemanager.compatibility;\r
2 \r
3 import android.content.Context;\r
4 import android.os.IBinder;\r
5 import android.view.inputmethod.InputMethodManager;\r
6 \r
7 /*\r
8  * Wraper class for closing the software keyboard, which appeared in API 3.\r
9  */\r
10 \r
11 public class SoftKeyboard {\r
12     /* class initialization fails when this throws an exception */\r
13     static {\r
14             try {\r
15                     Class.forName("android.view.inputmethod.InputMethodManager");\r
16             } catch (Exception ex) {\r
17                     throw new RuntimeException(ex);\r
18             }\r
19     }\r
20 \r
21     /* calling here forces class initialization */\r
22     public static void checkAvailable() {}\r
23     \r
24     private InputMethodManager inputMethodManager;\r
25     \r
26     public SoftKeyboard(Context ctx){\r
27         inputMethodManager = (InputMethodManager) ctx.getSystemService(\r
28                         Context.INPUT_METHOD_SERVICE);\r
29     }\r
30     \r
31     public boolean hideSoftInputFromWindow(IBinder windowToken, int flags){\r
32         return inputMethodManager.hideSoftInputFromWindow(windowToken, flags);\r
33     }\r
34 }