Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -10157,6 +10157,7 @@ package android.inputmethodservice { public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService { ctor public InputMethodService(); method public boolean enableHardwareAcceleration(); method public int getBackDisposition(); method public int getCandidatesHiddenVisibility(); method public android.view.inputmethod.InputBinding getCurrentInputBinding(); core/java/android/inputmethodservice/InputMethodService.java +26 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.inputmethodservice; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import android.app.ActivityManager; import android.app.Dialog; import android.content.Context; import android.content.res.Configuration; Loading @@ -38,6 +39,7 @@ import android.text.method.MovementMethod; import android.util.Log; import android.util.PrintWriterPrinter; import android.util.Printer; import android.view.Display; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.LayoutInflater; Loading Loading @@ -250,6 +252,7 @@ public class InputMethodService extends AbstractInputMethodService { InputMethodManager mImm; int mTheme = 0; boolean mHardwareAccelerated = false; LayoutInflater mInflater; TypedArray mThemeAttrs; Loading Loading @@ -614,6 +617,26 @@ public class InputMethodService extends AbstractInputMethodService { mTheme = theme; } /** * You can call this to try to enable hardware accelerated drawing for * your IME. This must be set before {@link #onCreate}, so you * will typically call it in your constructor. It is not always possible * to use hardware acclerated drawing in an IME (for example on low-end * devices that do not have the resources to support this), so the call * returns true if it succeeds otherwise false if you will need to draw * in software. You must be able to handle either case. */ public boolean enableHardwareAcceleration() { if (mWindow != null) { throw new IllegalStateException("Must be called before onCreate()"); } if (ActivityManager.isHighEndGfx(new Display(Display.DEFAULT_DISPLAY, null))) { mHardwareAccelerated = true; return true; } return false; } @Override public void onCreate() { mTheme = Resources.selectSystemTheme(mTheme, getApplicationInfo().targetSdkVersion, Loading @@ -626,6 +649,9 @@ public class InputMethodService extends AbstractInputMethodService { mInflater = (LayoutInflater)getSystemService( Context.LAYOUT_INFLATER_SERVICE); mWindow = new SoftInputWindow(this, mTheme, mDispatcherState); if (mHardwareAccelerated) { mWindow.getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); } initViews(); mWindow.getWindow().setLayout(MATCH_PARENT, WRAP_CONTENT); } Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -10157,6 +10157,7 @@ package android.inputmethodservice { public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService { ctor public InputMethodService(); method public boolean enableHardwareAcceleration(); method public int getBackDisposition(); method public int getCandidatesHiddenVisibility(); method public android.view.inputmethod.InputBinding getCurrentInputBinding();
core/java/android/inputmethodservice/InputMethodService.java +26 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.inputmethodservice; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import android.app.ActivityManager; import android.app.Dialog; import android.content.Context; import android.content.res.Configuration; Loading @@ -38,6 +39,7 @@ import android.text.method.MovementMethod; import android.util.Log; import android.util.PrintWriterPrinter; import android.util.Printer; import android.view.Display; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.LayoutInflater; Loading Loading @@ -250,6 +252,7 @@ public class InputMethodService extends AbstractInputMethodService { InputMethodManager mImm; int mTheme = 0; boolean mHardwareAccelerated = false; LayoutInflater mInflater; TypedArray mThemeAttrs; Loading Loading @@ -614,6 +617,26 @@ public class InputMethodService extends AbstractInputMethodService { mTheme = theme; } /** * You can call this to try to enable hardware accelerated drawing for * your IME. This must be set before {@link #onCreate}, so you * will typically call it in your constructor. It is not always possible * to use hardware acclerated drawing in an IME (for example on low-end * devices that do not have the resources to support this), so the call * returns true if it succeeds otherwise false if you will need to draw * in software. You must be able to handle either case. */ public boolean enableHardwareAcceleration() { if (mWindow != null) { throw new IllegalStateException("Must be called before onCreate()"); } if (ActivityManager.isHighEndGfx(new Display(Display.DEFAULT_DISPLAY, null))) { mHardwareAccelerated = true; return true; } return false; } @Override public void onCreate() { mTheme = Resources.selectSystemTheme(mTheme, getApplicationInfo().targetSdkVersion, Loading @@ -626,6 +649,9 @@ public class InputMethodService extends AbstractInputMethodService { mInflater = (LayoutInflater)getSystemService( Context.LAYOUT_INFLATER_SERVICE); mWindow = new SoftInputWindow(this, mTheme, mDispatcherState); if (mHardwareAccelerated) { mWindow.getWindow().addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); } initViews(); mWindow.getWindow().setLayout(MATCH_PARENT, WRAP_CONTENT); } Loading