Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix activity background color on android

ammarahm-ed9111165a5b32
diff --git a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/RCTNNativeModule.java b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/RCTNNativeModule.java
index 43df807c2..ad980bd26 100644
--- a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/RCTNNativeModule.java
+++ b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/RCTNNativeModule.java
@@ -1,6 +1,7 @@
package com.streetwriters.notesnook;
+import android.graphics.Color;
import android.view.WindowManager;
import com.facebook.react.bridge.ReactContext;
@@ -25,6 +26,17 @@ public class RCTNNativeModule extends ReactContextBaseJavaModule {
}
+ @ReactMethod
+ public void setBackgroundColor(final String color) {
+
+ try {
+ getCurrentActivity().getWindow().getDecorView().setBackgroundColor(Color.parseColor(color));
+ } catch (Exception e) {
+
+ }
+ }
+
+
@ReactMethod
public void setSecureMode(final boolean mode) {
try {
@@ -46,4 +58,5 @@ public class RCTNNativeModule extends ReactContextBaseJavaModule {
}
+
}
diff --git a/apps/mobile/android/app/src/main/res/values/styles.xml b/apps/mobile/android/app/src/main/res/values/styles.xml
index c893ebe39..6d9af564e 100644
--- a/apps/mobile/android/app/src/main/res/values/styles.xml
+++ b/apps/mobile/android/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
<resources>
<!-- Base application theme. -->
- <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
+ <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<item name="android:windowDisablePreview">true</item>
@@ -14,7 +14,7 @@
<!-- Base application theme. -->
- <style name="AppThemeB" parent="Theme.AppCompat.Light.NoActionBar">
+ <style name="AppThemeB" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
diff --git a/apps/mobile/src/utils/Colors.js b/apps/mobile/src/utils/Colors.js
index 2fe6e3ed7..d5aab731a 100644
--- a/apps/mobile/src/utils/Colors.js
+++ b/apps/mobile/src/utils/Colors.js
@@ -1,6 +1,7 @@
import {eSendEvent} from '../services/EventManager';
import {eThemeUpdated} from './Events';
import {Platform, StatusBar} from 'react-native';
+import { AndroidModule } from '.';
export const ACCENT = {
color: '#0560FF',
@@ -40,7 +41,7 @@ const fixedColors = {
export var COLOR_SCHEME = {
...fixedColors,
night: false,
- bg: 'white',
+ bg: '#ffffff',
navbg: '#f7f7f7',
nav: '#f7f7f7',
pri: '#000000',
@@ -51,13 +52,13 @@ export var COLOR_SCHEME = {
export const COLOR_SCHEME_LIGHT = {
...fixedColors,
night: false,
- bg: 'white',
+ bg: '#ffffff',
navbg: '#f7f7f7',
nav: '#f7f7f7',
input: 'transparent',
heading: '#000000',
pri: '#24292e',
- sec: 'white',
+ sec: '#ffffff',
light: '#ffffff',
};
export const COLOR_SCHEME_DARK = {
@@ -85,6 +86,7 @@ export function setColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
COLOR_SCHEME.night ? 'light-content' : 'dark-content',
true,
);
+ AndroidModule.setBackgroundColor(COLOR_SCHEME.bg);
if (Platform.OS === 'android') {
StatusBar.setBackgroundColor('transparent', true);
StatusBar.setTranslucent(true,true);