-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for Dark Mode #51
Conversation
- Supports selecting a dark mode color for the status bar and the navigation bar.
Can you do the same for SPLASH_SCREEN_BACKGROUND_COLOR? |
I think this one requires a change beyond this library. @PEConn can confirm. |
So while things like navbar theme colours need to be passed over to the browser, the splash screen colour is used to create a splash screen (in the TWA) and then handed over to the browser. Luckily however, the splashscreen is only relevant for a short amount of time so we could just add logic like this in LauncherActivity (around line 131):
|
@PEConn is right. We may be able to override the colour using qualified resources on Android. Will check if it's possible and update. |
So what's about splash screen color? |
I added dark mode to a PWA bundled with bubblewrap, including splash screen. The changes were quite simple - but took some time to get into it. Sharing here the key changes I did - probably it helps somebody else:
+import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Build;
@@ -30,6 +31,10 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
+ // workaround for this bug: https://github.com/GoogleChrome/android-browser-helper/issues/461
+ SharedPreferences splashImagePrefs = this.getApplicationContext().getApplicationContext().getSharedPreferences("splashImagePrefs", 0);
+ splashImagePrefs.edit().remove("lastUpdateTime").apply();
+
super.onCreate(savedInstanceState); |
@uwolfer this is so cool! Do you considered to contribute into bubblewrap with this fix? |
@khmyznikov IMO my change is not really a fix, but more an ugly workaround, which prevents caching of the splash screen. I would like to get this properly fixed in android-browser-helper: #461 |
@uwolfer how bad is caching prevention for splash? Is it leading to what? |
navigation bar.
Closes #50