mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-10-29 11:49:33 +00:00
Fix for app not changing theme if system theme changes (#7772)
This commit is contained in:
parent
c2f7dabc8b
commit
0478bb1af9
@ -19,6 +19,7 @@ import androidx.activity.OnBackPressedCallback;
|
|||||||
import androidx.annotation.IdRes;
|
import androidx.annotation.IdRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.StyleRes;
|
||||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
@ -513,6 +514,11 @@ public class MainActivity extends CastEnabledActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void restartActivity() {
|
||||||
|
finish();
|
||||||
|
startActivity(new Intent(this, MainActivity.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
@ -520,6 +526,11 @@ public class MainActivity extends CastEnabledActivity {
|
|||||||
drawerToggle.onConfigurationChanged(newConfig);
|
drawerToggle.onConfigurationChanged(newConfig);
|
||||||
}
|
}
|
||||||
setNavDrawerSize();
|
setNavDrawerSize();
|
||||||
|
|
||||||
|
@StyleRes int requiredTheme = ThemeSwitcher.getNoTitleTheme(this);
|
||||||
|
if (requiredTheme != lastTheme) {
|
||||||
|
restartActivity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNavDrawerSize() {
|
private void setNavDrawerSize() {
|
||||||
@ -568,8 +579,7 @@ public class MainActivity extends CastEnabledActivity {
|
|||||||
boolean hasBottomNavigation = bottomNavigation != null;
|
boolean hasBottomNavigation = bottomNavigation != null;
|
||||||
if (lastTheme != ThemeSwitcher.getNoTitleTheme(this)
|
if (lastTheme != ThemeSwitcher.getNoTitleTheme(this)
|
||||||
|| hasBottomNavigation != UserPreferences.isBottomNavigationEnabled()) {
|
|| hasBottomNavigation != UserPreferences.isBottomNavigationEnabled()) {
|
||||||
finish();
|
restartActivity();
|
||||||
startActivity(new Intent(this, MainActivity.class));
|
|
||||||
}
|
}
|
||||||
if (UserPreferences.getHiddenDrawerItems().contains(NavDrawerFragment.getLastNavFragment(this))) {
|
if (UserPreferences.getHiddenDrawerItems().contains(NavDrawerFragment.getLastNavFragment(this))) {
|
||||||
loadFragment(UserPreferences.getDefaultPage(), null);
|
loadFragment(UserPreferences.getDefaultPage(), null);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user