Skip to content

Instantly share code, notes, and snippets.

View hamzabasrai's full-sized avatar
👻
Making stuff

Hamza Basrai hamzabasrai

👻
Making stuff
View GitHub Profile
@hamzabasrai
hamzabasrai / docker-network.sh
Last active June 11, 2020 22:41
[Docker] List of common docker commands #docker
# List Docker networks
docker netowrk
# Creates a 'bridge' network by default
docker network create $NETWORK_NAME
@hamzabasrai
hamzabasrai / oxide.zsh-theme
Created February 3, 2021 15:03
My ZSH Theme - Oxide
# Oxide theme for Zsh
#
# Author: Diki Ananta <diki1aap@gmail.com>
# Repository: https://github.com/dikiaap/dotfiles
# License: MIT
# Prompt:
# %F => Color codes
# %f => Reset color
# %~ => Current path

Keybase proof

I hereby claim:

  • I am hamzabasrai on github.
  • I am hamzabasrai (https://keybase.io/hamzabasrai) on keybase.
  • I have a public key ASDIjX09oLlcGJObZAiz_nPPZT47BdiBDI4Ezf6V-L_yuwo

To claim this, I am signing this object:

@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
this.updateDarkMode(configuration);
}
private void updateDarkMode(Configuration configuration) {
// read the new night mode value
int currentNightMode = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
// Update webview theme
private void forceDarkMode(int mode) {
// This Dark Mode Strategy sets the css prefers-color-scheme property,
// instead of trying to automatically convert pages. (Consistent with iOS)
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) {
WebSettingsCompat.setForceDarkStrategy(this.bridge.getWebView().getSettings(), WebSettingsCompat.DARK_STRATEGY_WEB_THEME_DARKENING_ONLY);
}
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
WebSettingsCompat.setForceDark(this.bridge.getWebView().getSettings(), mode);
}
public void onResume() {
super.onResume();
this.updateDarkMode(this.getResources().getConfiguration());
}
<!-- res/values/styles.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="navigationBarColor">@android:color/white</color>
<color name="navigationIconColor">@android:color/black</color>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<!-- res/values-night/styles.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="navigationBarColor">@android:color/black</color>
<color name="navigationIconColor">@android:color/white</color>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:background">@null</item>
<!-- /ios/App/App/info.plist -->
<key>UIUserInterfaceStyle</key>
<string>Light</string>
html, body {
padding: 0;
margin: 0;
color: #273238;
}
/* Dark mode */
@media (prefers-color-scheme: dark) {
html, body {
background-color: black;