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

Commit b29e50cc authored by Abhishek Aggarwal's avatar Abhishek Aggarwal Committed by Nishith Khanna
Browse files

LatinIME: Fix navbar on light theme

parent 8e026b71
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.inputmethod.latin;

import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
import static com.android.inputmethod.latin.common.Constants.ImeOption.FORCE_ASCII;
import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROPHONE;
import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROPHONE_COMPAT;
@@ -2008,11 +2009,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
    }

    private void setNavigationBarVisibility(final boolean visible) {
        if (BuildCompatUtils.EFFECTIVE_SDK_INT > Build.VERSION_CODES.M) {
        if (BuildCompatUtils.EFFECTIVE_SDK_INT > Build.VERSION_CODES.R) {
            // For N and later, IMEs can specify Color.TRANSPARENT to make the navigation bar
            // transparent.  For other colors the system uses the default color.
            getWindow().getWindow().setNavigationBarColor(
                    visible ? getColor(R.color.keyboard_navigation_bar) : Color.TRANSPARENT);

            if (visible) {
                final Configuration configuration = getResources().getConfiguration();
                final boolean isNightMode = (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK)
                        == Configuration.UI_MODE_NIGHT_YES;
                if (!isNightMode) {
                    getWindow().getWindow().getInsetsController().setSystemBarsAppearance(
                            APPEARANCE_LIGHT_NAVIGATION_BARS, APPEARANCE_LIGHT_NAVIGATION_BARS);
                } else {
                    getWindow().getWindow().getInsetsController().setSystemBarsAppearance(
                            0, APPEARANCE_LIGHT_NAVIGATION_BARS);
                }
            }
        }
    }
}