diff --git a/res/values/themes.xml b/res/values/themes.xml
index 048d59e..8aa27d7 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -20,10 +20,20 @@
+
+
+
-
+
-
-
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 1b08cf3..9234366 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -1,15 +1,19 @@
package juloo.keyboard2;
import android.content.Context;
+import android.content.ContextWrapper;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
+import android.inputmethodservice.InputMethodService;
+import android.os.Build.VERSION;
import android.os.Vibrator;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.Window;
public class Keyboard2View extends View
implements View.OnTouchListener, Pointers.IPointerEventHandler
@@ -49,10 +53,35 @@ public class Keyboard2View extends View
_theme = new Theme(getContext(), attrs);
_config = Config.globalConfig();
_pointers = new Pointers(this, _config);
+ refresh_navigation_bar(context);
setOnTouchListener(this);
reset();
}
+ private Window getParentWindow(Context context)
+ {
+ if (context instanceof InputMethodService)
+ return ((InputMethodService)context).getWindow().getWindow();
+ if (context instanceof ContextWrapper)
+ return getParentWindow(((ContextWrapper)context).getBaseContext());
+ return null;
+ }
+
+ public void refresh_navigation_bar(Context context)
+ {
+ if (VERSION.SDK_INT < 21)
+ return;
+ // The intermediate Window is a [Dialog].
+ Window w = getParentWindow(context);
+ int uiFlags = getSystemUiVisibility();
+ if (_theme.isLightNavBar)
+ uiFlags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+ else
+ uiFlags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
+ w.setNavigationBarColor(_theme.colorNavBar);
+ setSystemUiVisibility(uiFlags);
+ }
+
public void setKeyboard(KeyboardData kw)
{
_keyboard = _config.modify_layout(kw);
diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java
index 548e291..1461389 100644
--- a/srcs/juloo.keyboard2/Theme.java
+++ b/srcs/juloo.keyboard2/Theme.java
@@ -18,6 +18,9 @@ public class Theme
public final float keyBorderRadius;
+ public final int colorNavBar;
+ public final boolean isLightNavBar;
+
private final Paint _keyLabelPaint;
private final Paint _specialKeyLabelPaint;
private final Paint _keySubLabelPaint;
@@ -29,6 +32,8 @@ public class Theme
keyBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKey, 0));
keyDownBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKeyActivated, 0));
// colorKeyboard = s.getColor(R.styleable.keyboard_colorKeyboard, 0);
+ colorNavBar = s.getColor(R.styleable.keyboard_navigationBarColor, 0);
+ isLightNavBar = s.getBoolean(R.styleable.keyboard_windowLightNavigationBar, false);
labelColor = s.getColor(R.styleable.keyboard_colorLabel, 0);
activatedColor = s.getColor(R.styleable.keyboard_colorLabelActivated, 0);
lockedColor = s.getColor(R.styleable.keyboard_colorLabelLocked, 0);