Add night theme

Similar to the dark theme, but dropping blue in favour of very dark shades of
grey.

Removed colorEdgeEffect to simplify the sharing of the style between dark and
night themes. It should default to colorPrimary anyway, so we're good.

Fixes #345.
This commit is contained in:
Daniel Martí 2015-10-03 17:42:05 -07:00
parent ff9871f86f
commit a052dc2ff1
8 changed files with 25 additions and 7 deletions

View File

@ -4,7 +4,6 @@
<style name="AppThemeDark" parent="AppBaseThemeDark">
<!-- customizations that are not API-level specific go here. -->
<item name="android:alertDialogTheme">@style/AlertDialogThemeDark</item>
<item name="android:colorEdgeEffect">@color/fdroid_blue</item>
<item name="android:colorControlActivated">@color/fdroid_green</item>
<item name="android:colorControlHighlight">@color/fdroid_green</item>
</style>

View File

@ -13,6 +13,7 @@
<string-array name="themeNames">
<item>@string/theme_light</item>
<item>@string/theme_dark</item>
<item>@string/theme_night</item>
</string-array>
</resources>

View File

@ -8,6 +8,8 @@
<color name="fdroid_blue">#ff1976d2</color>
<color name="fdroid_blue_dark">#ff0d47a1</color>
<color name="fdroid_green">#ff8ab000</color>
<color name="fdroid_night">#ff222222</color>
<color name="fdroid_night_dark">#ff111111</color>
<color name="swap_incompatible">#ff7900</color>
<color name="swap_light_blue">#27aae1</color>

View File

@ -20,6 +20,7 @@
<string-array name="themeValues">
<item>light</item>
<item>dark</item>
<item>night</item>
</string-array>
<string-array name="languageValues">

View File

@ -376,4 +376,5 @@
<string name="theme_light">Light</string>
<string name="theme_dark">Dark</string>
<string name="theme_night">Night</string>
</resources>

View File

@ -29,6 +29,13 @@
<!-- customizations that are not API-level specific go here. -->
</style>
<style name="AppThemeNight" parent="AppThemeDark">
<!-- customizations that are not API-level specific go here. -->
<item name="colorPrimary">@color/fdroid_night</item>
<item name="colorPrimaryDark">@color/fdroid_night_dark</item>
</style>
<style name="AlertDialogBaseThemeDark" parent="Theme.AppCompat.Dialog.Alert" />
<style name="AlertDialogThemeDark" parent="AlertDialogBaseThemeDark">
<item name="colorAccent">@color/fdroid_green</item>

View File

@ -86,8 +86,9 @@ public class FDroidApp extends Application {
}
public enum Theme {
dark,
light,
dark,
night,
lightWithDarkActionBar, // Obsolete
}
@ -109,10 +110,12 @@ public class FDroidApp extends Application {
public static int getCurThemeResId() {
switch (curTheme) {
case dark:
return R.style.AppThemeDark;
case light:
return R.style.AppThemeLight;
case dark:
return R.style.AppThemeDark;
case night:
return R.style.AppThemeNight;
default:
return R.style.AppThemeLight;
}

View File

@ -129,8 +129,12 @@ public class AvailableAppsFragment extends AppListFragment implements
private void styleSpinner(Spinner spinner) {
Drawable menuButton = getResources().getDrawable(android.R.drawable.btn_dropdown);
if (FDroidApp.getCurTheme() == FDroidApp.Theme.dark) {
switch (FDroidApp.getCurTheme()) {
case dark:
// fallthrough
case night:
menuButton.setAlpha(32); // make it darker via alpha
break;
}
if (Build.VERSION.SDK_INT >= 16) {
spinner.setBackground(menuButton);