Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c04339c authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Change NavigationBar invisible if the input view is not shown.

The opaque navigation bar guard view does not make much sense when the
IME does not show software keyboard at all.  LatinIME does not show
any UI when the hardware keyboard is connected.

With Iea77915ecc55eedaf19899e72c44f704ba9d852c, input method can change
the navigation bar visibility.  This CL changes navigation bar invisible
when the hardware keyboard is connected.

Bug:22564251
Change-Id: I14d9490e00caa852035a05830e76114cbe6af8f2
parent 5765a98b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.inputmethodservice.InputMethodService;
import android.media.AudioManager;
import android.os.Debug;
@@ -967,6 +968,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
        if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
    }

    @Override
    public void onWindowShown() {
        super.onWindowShown();
        setNavigationBarVisibility(isInputViewShown());
    }

    @Override
    public void onWindowHidden() {
        super.onWindowHidden();
@@ -974,6 +981,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
        if (mainKeyboardView != null) {
            mainKeyboardView.closing();
        }
        setNavigationBarVisibility(false);
    }

    void onFinishInputInternal() {
@@ -1865,4 +1873,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
        }
        return mRichImm.shouldOfferSwitchingToNextInputMethod(token, fallbackValue);
    }

    private void setNavigationBarVisibility(final boolean visible) {
        // Color.BLACK is ignored and default IME navigation bar color is used.
        getWindow().getWindow().setNavigationBarColor(visible ? Color.BLACK : Color.TRANSPARENT);
    }
}