Set sane colors for night and dark themes

This commit is contained in:
Christine Emrich 2017-08-30 21:37:12 +02:00 committed by Peter Serwylo
parent a5caea24e7
commit bd796136f7
5 changed files with 44 additions and 10 deletions

View File

@ -95,7 +95,7 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationB
bottomNavigation = (BottomNavigationBar) findViewById(R.id.bottom_navigation);
bottomNavigation.setTabSelectedListener(this)
.setBarBackgroundColor(R.color.fdroid_blue)
.setBarBackgroundColor(getBottomNavigationBackgroundColorResId())
.setInActiveColor(R.color.bottom_nav_items)
.setActiveColor(android.R.color.white)
.setMode(BottomNavigationBar.MODE_FIXED)
@ -336,6 +336,15 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationB
}
}
private int getBottomNavigationBackgroundColorResId() {
switch (FDroidApp.getCurThemeResId()) {
case R.style.AppThemeNight:
return R.color.fdroid_night;
default:
return R.color.fdroid_blue;
}
}
private static class NonScrollingHorizontalLayoutManager extends LinearLayoutManager {
NonScrollingHorizontalLayoutManager(Context context) {
super(context, LinearLayoutManager.HORIZONTAL, false);

View File

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<solid android:color="#303030" />
<solid android:color="#3c3c3e" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp" />
<solid android:color="#262627" />
</shape>

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppThemeNight" parent="AppBaseThemeNight">
<!-- set all card views a bit darker than default dark theme -->
<item name="android:colorBackgroundFloating">@color/fdroid_night</item>
<item name="appDetailsCardBackground">@color/fdroid_night</item>
</style>
<!-- see http://stackoverflow.com/questions/32169303/activity-did-not-call-finish-api-23 -->
<style name="AppThemeTransparent" parent="@android:style/Theme.Translucent.NoTitleBar" />

View File

@ -12,11 +12,11 @@
<item name="android:textViewStyle">@style/TextViewStyle</item>
<item name="actionBarTheme">@style/AppThemeLight.Toolbar</item>
<item name="actionBarPopupTheme">@style/AppThemeLight.Toolbar</item>
<item name="appDetailsBackground">#0c0c0c</item>
<item name="appDetailsCardBackground">#000000</item>
<item name="appDetailsBackground">?android:windowBackground</item>
<item name="appDetailsCardBackground">#424242</item>
<item name="categoryPreviewAppCardBackground">@drawable/category_preview_app_card_background_dark</item>
<item name="mainTabSwapBackground">#0a0a0a</item>
<item name="mainTabSwapSplashTint">#050505</item>
<item name="mainTabSwapBackground">?android:windowBackground</item>
<item name="mainTabSwapSplashTint">#2c2c2c</item>
<item name="categoryName">#ffffff</item>
<item name="installedApps">#ffffff</item>
<item name="detailPanel">@drawable/details_panel_donate_background_dark</item>
@ -49,6 +49,17 @@
<item name="antiFeaturesWarning">@drawable/ic_warning_black_24dp</item>
</style>
<style name="AppBaseThemeNight" parent="AppThemeDark">
<!-- backward-compatibility theme options go here -->
<item name="colorPrimary">@color/fdroid_night</item>
<item name="colorPrimaryDark">@color/fdroid_night_dark</item>
<item name="alertDialogTheme">@style/AlertDialogThemeNight</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="detailPanel">@drawable/details_panel_donate_background_night</item>
<item name="mainTabSwapSplashTint">#111111</item>
</style>
<!-- dark app theme with accent colors following roughly android design guidelines -->
<style name="AppThemeDark" parent="AppBaseThemeDark">
<!-- customizations that are not API-level specific go here. -->
@ -60,11 +71,8 @@
</style>
<!-- mostly deep black theme specialized for OLED screens -->
<style name="AppThemeNight" parent="AppThemeDark">
<style name="AppThemeNight" parent="AppBaseThemeNight">
<!-- 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" />
@ -77,6 +85,11 @@
<item name="colorAccent">@color/fdroid_green</item>
</style>
<style name="AlertDialogBaseThemeNight" parent="AlertDialogThemeDark" />
<style name="AlertDialogThemeNight" parent="AlertDialogBaseThemeNight">
<item name="android:windowBackground">@color/fdroid_night</item>
</style>
<style name="MinWithDialogBaseThemeDark" parent="Theme.AppCompat.Dialog.MinWidth">
<item name="colorAccent">@color/fdroid_green</item>