I'm writing an IME that I want always to be in full screen mode, and
by full screen, I mean no status bar or anything:  I want every last
square mm (parenthetically I'm not interested in dealing with the
extract-editor API either since I display the result text in my own
special way).  My first basic attempt at this was to extend
InputMethodService in the usual way and implement

public void onConfigureWindow(Window win, boolean isFullscreen,
boolean isCandidatesOnly) {
    int flags = WindowManager.LayoutParams.FLAG_FULLSCREEN;
    win.setFlags(flags, flags);
    }

but this didn't do it.  I've since done all manner of things,
including downloading the source for InputMethodService and
SoftInputWindow, rewriting it and stripping it down so that I could
understand what was going on.  The result is code containing the
following snippets.

public class MyInputMethodService extends Service {
    // ...
    public class InputMethodImpl extends AbstractInputMethodImpl {
        // ...
        public void showSoftInput(int flags, ResultReceiver
resultReceiver) {
           // ...
           showWindow();
           // ...
        }
     }

     showWindow() {
            // ...
            WindowManager.LayoutParams lp = new
WindowManager.LayoutParams();
            lp.type = WindowManager.LayoutParams.TYPE_INPUT_METHOD;
            lp.token = mToken;
            lp.setTitle(null);
            lp.gravity = Gravity.FILL;
            lp.width = lp.height = -1;
            lp.screenOrientation =
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
            lp.flags =
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN  |
WindowManager.LayoutParams.FLAG_FULLSCREEN |
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
            mWindowManager.addView(mInputFrame, lp);
            mInputFrame.setVisibility(View.VISIBLE);
            // ...
       }
}

The result of all this work is an IME that works as well as it did
when I derived from InputMethodService, but still doesn't let me
control the status bar.  Having grown resigned to the status bar, I
decided I could tolerate it as long as it was along the shorter edge
of the screen, not the longer, which required me to control the screen
orientation:  hence the lp.screenOrientation = ... statement above.
But even this is far from reliable.  Certain client apps cause the
request for portrait mode to be ignored;  others behave in a goofy
way, flipping between portrait and landscape mode after I exit the IME
and even restarting the IME automatically.

Apparently there's some code in some WindowManager class (haven't
hunted it down as yet) that likes to override my requests when it sees
that I need a TYPE_INPUT_METHOD window.  I haven't found that code,
but would really like to see it changed.  I don't see why all IME
writers must have the appearance of their screen dictated (in a none-
too-predictable way) by the client app.

Any feedback would be much appreciated.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to