Skip to content

Commit 27d64ce

Browse files
authored
Merge pull request #816 from NWuensche/fixIconDarkThemes
Set white logo in dark themes programmatically
2 parents 302acfc + 6e7026a commit 27d64ce

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

app/src/main/java/fr/gaulupeau/apps/Poche/ui/MainActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import android.view.Menu;
2929
import android.view.MenuItem;
3030
import android.view.View;
31+
import android.widget.ImageView;
3132
import android.widget.ProgressBar;
3233
import android.widget.TextView;
3334
import android.widget.Toast;
@@ -134,6 +135,12 @@ protected void onCreate(Bundle savedInstanceState) {
134135
lastUpdateTimeView = (TextView)headerView.findViewById(R.id.lastUpdateTime);
135136
}
136137

138+
// Set white logo in the navigation bar in dark and dark (high contrast) theme
139+
if (headerView != null && Themes.getCurrentTheme() != null && Themes.getCurrentTheme().isDark()) {
140+
ImageView logo = headerView.findViewById(R.id.imageView);
141+
logo.setImageDrawable(getDrawable(R.drawable.welcome_white));
142+
}
143+
137144
// Set different colors for items in the navigation bar in dark (high contrast) theme
138145
if (Themes.getCurrentTheme() != null && Themes.getCurrentTheme() == Themes.Theme.DARK_CONTRAST) {
139146
@SuppressLint("ResourceType") XmlResourceParser parser = getResources().getXml(R.color.dark_contrast_menu_item);

app/src/main/java/fr/gaulupeau/apps/Poche/ui/Themes.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public enum Theme {
119119
return proxyResId;
120120
}
121121

122+
public boolean isDark() {
123+
return this == Themes.Theme.DARK || this == Themes.Theme.DARK_CONTRAST;
124+
}
125+
122126
}
123127

124128
}

0 commit comments

Comments
 (0)