* called when the current profile has changed
*/
private void onProfileChanged(@Nullable Profile newProfile) {
- if (this.profile == null) {
- if (newProfile == null)
- return;
- }
- else {
+ if (this.profile != null) {
if (this.profile.equals(newProfile))
return;
}
else
setTitle(R.string.app_name);
- int newProfileTheme = haveProfile ? newProfile.getTheme() : -1;
+ int newProfileTheme = haveProfile ? newProfile.getTheme() : Colors.DEFAULT_HUE_DEG;
if (newProfileTheme != Colors.profileThemeId) {
Logger.debug("profiles",
String.format(Locale.ENGLISH, "profile theme %d → %d", Colors.profileThemeId,
Data.observeProfile(this, profile -> {
if (profile == null) {
Logger.debug(TAG, "No current profile, leaving");
- finish();
return;
}
profile = dao.getAnySync();
}
- Logger.debug(TAG, String.format(Locale.ROOT, "Profile %d loaded. posting", profileId));
+ if (profile == null)
+ Logger.debug(TAG, "No profile could be loaded");
+ else
+ Logger.debug(TAG, String.format(Locale.ROOT, "Profile %d loaded. posting", profileId));
Data.postCurrentProfile(profile);
}
}