Add Dracula theme

This commit is contained in:
Thomas 2022-12-07 12:46:34 +01:00
parent 6cfe8b7b95
commit b6f74cb297
10 changed files with 188 additions and 9 deletions

View File

@ -83,6 +83,10 @@ public class BaseActivity extends AppCompatActivity {
setTheme(R.style.BlackAppTheme);
currentThemeId = R.style.BlackAppTheme;
break;
case "DRACULA":
setTheme(R.style.DraculaAppTheme);
currentThemeId = R.style.DraculaAppTheme;
break;
}
break;
}
@ -113,6 +117,11 @@ public class BaseActivity extends AppCompatActivity {
setTheme(R.style.BlackAppTheme);
currentThemeId = R.style.BlackAppTheme;
break;
case "DRACULA":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.DraculaAppTheme);
currentThemeId = R.style.DraculaAppTheme;
break;
}
}
super.onCreate(savedInstanceState);

View File

@ -76,6 +76,9 @@ public class BaseAlertDialogActivity extends AppCompatActivity {
case "BLACK":
setTheme(R.style.BlackAlertDialog);
break;
case "DRACULA":
setTheme(R.style.DraculaAlertDialog);
break;
}
break;
}
@ -101,6 +104,10 @@ public class BaseAlertDialogActivity extends AppCompatActivity {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.BlackAlertDialog);
break;
case "DRACULA":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.DraculaAlertDialog);
break;
}
}
super.onCreate(savedInstanceState);

View File

@ -75,6 +75,9 @@ public class BaseBarActivity extends AppCompatActivity {
case "BLACK":
setTheme(R.style.BlackAppThemeBar);
break;
case "DRACULA":
setTheme(R.style.DraculaAppThemeBar);
break;
}
break;
}
@ -101,6 +104,10 @@ public class BaseBarActivity extends AppCompatActivity {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.BlackAppThemeBar);
break;
case "DRACULA":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.DraculaAppThemeBar);
break;
}
}
super.onCreate(savedInstanceState);

View File

@ -75,6 +75,9 @@ public class BaseTransparentActivity extends AppCompatActivity {
case "BLACK":
setTheme(R.style.TransparentBlack);
break;
case "DRACULA":
setTheme(R.style.TransparentDracula);
break;
}
break;
}
@ -101,6 +104,10 @@ public class BaseTransparentActivity extends AppCompatActivity {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.TransparentBlack);
break;
case "DRACULA":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.TransparentDracula);
break;
}
}
super.onCreate(savedInstanceState);

View File

@ -1918,6 +1918,8 @@ public class Helper {
return R.style.SolarizedAlertDialog;
} else if (R.style.BlackAppThemeBar == currentThemeId || R.style.BlackAppTheme == currentThemeId) {
return R.style.BlackAlertDialog;
} else if (R.style.DraculaAppThemeBar == currentThemeId || R.style.DraculaAppTheme == currentThemeId) {
return R.style.DraculaAlertDialog;
}
return R.style.AppTheme;
}

View File

@ -439,6 +439,12 @@ public class SpannableHelper {
}
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ThemeHelper.getAttColor(context, R.attr.linkColor));
}
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
}
@ -661,6 +667,7 @@ public class SpannableHelper {
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(ThemeHelper.getAttColor(context, R.attr.linkColor));
}
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
@ -694,6 +701,7 @@ public class SpannableHelper {
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(ThemeHelper.getAttColor(context, R.attr.linkColor));
}
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
@ -730,6 +738,7 @@ public class SpannableHelper {
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(ThemeHelper.getAttColor(context, R.attr.linkColor));
}
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
@ -877,6 +886,7 @@ public class SpannableHelper {
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(ThemeHelper.getAttColor(context, R.attr.linkColor));
}
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
@ -1024,6 +1034,8 @@ public class SpannableHelper {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(ThemeHelper.getAttColor(context, R.attr.linkColor));
}
},
startPosition, endPosition,

View File

@ -1,6 +1,10 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<attr name="linkColor" type="color" />
<style name="AppTheme" parent="Theme.Material3.Dark.NoActionBar">
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
@ -27,12 +31,10 @@
<item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface</item>
<item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_inversePrimary</item>
<item name="android:navigationBarColor">?android:colorBackground</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">false</item>
<item name="android:isLightTheme" tools:targetApi="q">false</item>
<item name="windowNoTitle">true</item>
<!-- specify enter and exit transitions -->
<item name="android:windowEnterTransition">@android:transition/explode</item>
@ -45,6 +47,7 @@
</style>
<style name="AppThemeBar" parent="Theme.Material3.Dark">
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
@ -79,6 +82,7 @@
<style name="AppThemeAlertDialog" parent="Theme.Material3.Dark.Dialog.Alert">
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
@ -109,7 +113,10 @@
</style>
<!-- SOLARIZED DARK -->
<style name="SolarizedAppTheme" parent="AppTheme">
<item name="linkColor">@color/solarized_md_theme_dark_onPrimaryContainer</item>
<item name="colorPrimary">@color/solarized_md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/solarized_md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/solarized_md_theme_dark_primaryContainer</item>
@ -143,6 +150,7 @@
</style>
<style name="SolarizedAppThemeBar" parent="AppThemeBar">
<item name="linkColor">@color/solarized_md_theme_dark_onPrimaryContainer</item>
<item name="colorPrimary">@color/solarized_md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/solarized_md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/solarized_md_theme_dark_primaryContainer</item>
@ -175,7 +183,6 @@
<item name="colorPrimaryInverse">@color/solarized_md_theme_dark_inversePrimary</item>
</style>
<style name="TransparentSolarized" parent="SolarizedAppThemeBar">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowContentOverlay">@null</item>
@ -185,6 +192,7 @@
</style>
<style name="SolarizedAlertDialog" parent="Theme.Material3.Dark.Dialog.Alert">
<item name="linkColor">@color/solarized_md_theme_dark_onPrimaryContainer</item>
<item name="colorPrimary">@color/solarized_md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/solarized_md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/solarized_md_theme_dark_primaryContainer</item>
@ -217,8 +225,11 @@
<item name="colorPrimaryInverse">@color/solarized_md_theme_dark_inversePrimary</item>
</style>
<!-- BLACK THEME -->
<style name="BlackAppTheme" parent="AppTheme">
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="colorPrimary">@color/black</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/white</item>
@ -247,7 +258,8 @@
</style>
<style name="BlackAppThemeBar" parent="AppThemeBar">
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="colorPrimary">@color/black</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/white</item>
@ -275,7 +287,6 @@
<item name="colorPrimaryInverse">@color/black</item>
</style>
<style name="TransparentBlack" parent="BlackAppThemeBar">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowContentOverlay">@null</item>
@ -285,7 +296,8 @@
</style>
<style name="BlackAlertDialog" parent="Theme.Material3.Dark.Dialog.Alert">
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="colorPrimary">@color/black</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/white</item>
@ -313,4 +325,106 @@
<item name="colorPrimaryInverse">@color/black</item>
</style>
<!-- DRACULA THEME -->
<style name="DraculaAppTheme" parent="AppTheme">
<item name="linkColor">@color/dracula_pink</item>
<item name="colorPrimary">@color/dracula_comment</item>
<item name="colorOnPrimary">@color/dracula_foreground</item>
<item name="colorPrimaryContainer">@color/dracula_green</item>
<item name="colorOnPrimaryContainer">@color/black</item>
<item name="colorSecondary">@color/dracula_orange</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorSecondaryContainer">@color/dracula_cyan</item>
<item name="colorOnSecondaryContainer">@color/black</item>
<item name="colorTertiary">@color/dracula_pink</item>
<item name="colorOnTertiary">@color/black</item>
<item name="colorTertiaryContainer">@color/dracula_orange</item>
<item name="colorOnTertiaryContainer">@color/black</item>
<item name="colorError">@color/solarized_md_theme_dark_error</item>
<item name="colorErrorContainer">@color/solarized_md_theme_dark_errorContainer</item>
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/dracula_background</item>
<item name="colorOnBackground">@color/dracula_foreground</item>
<item name="colorSurface">@color/dracula_background</item>
<item name="colorOnSurface">@color/dracula_foreground</item>
<item name="colorSurfaceVariant">@color/dracula_current_Line</item>
<item name="colorOnSurfaceVariant">@color/dracula_foreground</item>
<item name="colorOutline">@color/solarized_md_theme_dark_outline</item>
<item name="colorOnSurfaceInverse">@color/dracula_comment</item>
<item name="colorSurfaceInverse">@color/dracula_foreground</item>
<item name="colorPrimaryInverse">@color/dracula_comment</item>
</style>
<style name="DraculaAppThemeBar" parent="AppThemeBar">
<item name="linkColor">@color/dracula_pink</item>
<item name="colorPrimary">@color/dracula_comment</item>
<item name="colorOnPrimary">@color/dracula_foreground</item>
<item name="colorPrimaryContainer">@color/dracula_green</item>
<item name="colorOnPrimaryContainer">@color/black</item>
<item name="colorSecondary">@color/dracula_orange</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorSecondaryContainer">@color/dracula_cyan</item>
<item name="colorOnSecondaryContainer">@color/black</item>
<item name="colorTertiary">@color/dracula_pink</item>
<item name="colorOnTertiary">@color/black</item>
<item name="colorTertiaryContainer">@color/dracula_orange</item>
<item name="colorOnTertiaryContainer">@color/black</item>
<item name="colorError">@color/solarized_md_theme_dark_error</item>
<item name="colorErrorContainer">@color/solarized_md_theme_dark_errorContainer</item>
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/dracula_background</item>
<item name="colorOnBackground">@color/dracula_foreground</item>
<item name="colorSurface">@color/dracula_background</item>
<item name="colorOnSurface">@color/dracula_foreground</item>
<item name="colorSurfaceVariant">@color/dracula_current_Line</item>
<item name="colorOnSurfaceVariant">@color/dracula_foreground</item>
<item name="colorOutline">@color/solarized_md_theme_dark_outline</item>
<item name="colorOnSurfaceInverse">@color/dracula_comment</item>
<item name="colorSurfaceInverse">@color/dracula_foreground</item>
<item name="colorPrimaryInverse">@color/dracula_comment</item>
</style>
<style name="TransparentDracula" parent="DraculaAppThemeBar">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="DraculaAlertDialog" parent="Theme.Material3.Dark.Dialog.Alert">
<item name="linkColor">@color/dracula_pink</item>
<item name="colorPrimary">@color/dracula_comment</item>
<item name="colorOnPrimary">@color/dracula_foreground</item>
<item name="colorPrimaryContainer">@color/dracula_green</item>
<item name="colorOnPrimaryContainer">@color/black</item>
<item name="colorSecondary">@color/dracula_orange</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorSecondaryContainer">@color/dracula_cyan</item>
<item name="colorOnSecondaryContainer">@color/black</item>
<item name="colorTertiary">@color/dracula_pink</item>
<item name="colorOnTertiary">@color/black</item>
<item name="colorTertiaryContainer">@color/dracula_orange</item>
<item name="colorOnTertiaryContainer">@color/black</item>
<item name="colorError">@color/solarized_md_theme_dark_error</item>
<item name="colorErrorContainer">@color/solarized_md_theme_dark_errorContainer</item>
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/dracula_background</item>
<item name="colorOnBackground">@color/dracula_foreground</item>
<item name="colorSurface">@color/dracula_background</item>
<item name="colorOnSurface">@color/dracula_foreground</item>
<item name="colorSurfaceVariant">@color/dracula_current_Line</item>
<item name="colorOnSurfaceVariant">@color/dracula_foreground</item>
<item name="colorOutline">@color/solarized_md_theme_dark_outline</item>
<item name="colorOnSurfaceInverse">@color/dracula_comment</item>
<item name="colorSurfaceInverse">@color/dracula_foreground</item>
<item name="colorPrimaryInverse">@color/dracula_comment</item>
</style>
</resources>

View File

@ -65,6 +65,18 @@
<color name="md_theme_dark_scrim">#000000</color>
<color name="dracula_pink">#ff79c6</color>
<color name="dracula_green">#50fa7b</color>
<color name="dracula_foreground">#f8f8f2</color>
<color name="dracula_comment">#6272a4</color>
<color name="dracula_orange">#ffb86c</color>
<color name="dracula_yellow">#f1fa8c</color>
<color name="dracula_cyan">#8be9fd</color>
<color name="dracula_background">#282a36</color>
<color name="dracula_current_Line">#44475a</color>
<color name="dracula_purple">#bd93f9</color>
<color name="no_description">#FFEA00</color>
<color name="having_description">#42A5F5</color>

View File

@ -703,6 +703,7 @@
<item>Solarized (Light)</item>
<item>Solarized (Dark)</item>
<item>Black</item>
<item>Dracula</item>
</string-array>
<string-array name="SET_THEME_MODE_VALUE" translatable="false">
<item>LIGHT</item>
@ -711,6 +712,7 @@
<item>SOLARIZED_LIGHT</item>
<item>SOLARIZED_DARK</item>
<item>BLACK</item>
<item>DRACULA</item>
</string-array>

View File

@ -1,6 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<attr name="linkColor" type="color" />
<style name="AppTheme" parent="Theme.Material3.Light.NoActionBar">
<item name="linkColor">@color/md_theme_light_primary</item>
<item name="colorPrimary">@color/md_theme_light_primary</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
@ -43,6 +46,7 @@
</style>
<style name="AppThemeBar" parent="Theme.Material3.Light">
<item name="linkColor">@color/md_theme_light_primary</item>
<item name="colorPrimary">@color/md_theme_light_primary</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
@ -69,14 +73,12 @@
<item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
<item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_light_inversePrimary</item>
<item name="android:navigationBarColor">?android:colorBackground</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:isLightTheme" tools:targetApi="q">true</item>
</style>
<style name="Transparent" parent="AppThemeBar">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowContentOverlay">@null</item>
@ -86,6 +88,7 @@
</style>
<style name="AppThemeAlertDialog" parent="Theme.Material3.Light.Dialog.Alert">
<item name="linkColor">@color/md_theme_light_primary</item>
<item name="colorPrimary">@color/md_theme_light_primary</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
@ -115,7 +118,9 @@
<item name="android:navigationBarColor">?android:colorBackground</item>
</style>
<style name="SolarizedAppTheme" parent="AppTheme">
<item name="linkColor">@color/solarized_md_theme_light_primaryContainer</item>
<item name="colorPrimary">@color/solarized_md_theme_light_primary</item>
<item name="colorOnPrimary">@color/solarized_md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/solarized_md_theme_light_primaryContainer</item>
@ -158,6 +163,7 @@
</style>
<style name="SolarizedAlertDialog" parent="Theme.Material3.Light.Dialog.Alert">
<item name="linkColor">@color/solarized_md_theme_light_primaryContainer</item>
<item name="colorPrimary">@color/solarized_md_theme_light_primary</item>
<item name="colorOnPrimary">@color/solarized_md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/solarized_md_theme_light_primaryContainer</item>
@ -192,6 +198,7 @@
</style>
<style name="SolarizedAppThemeBar" parent="AppThemeBar">
<item name="linkColor">@color/solarized_md_theme_light_primaryContainer</item>
<item name="colorPrimary">@color/solarized_md_theme_light_primary</item>
<item name="colorOnPrimary">@color/solarized_md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/solarized_md_theme_light_primaryContainer</item>