You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐛 Describe the bug
The issue arises in the ThemeManager class within the application. Specifically, there seems to be an error related to class casting in the getRelativeLeft and getRelativeTop methods.
⚠️ Current behavior
When certain conditions are met, the application crashes with a ClassCastException in the ThemeManager class.
Error:
java.lang.ClassCastException: android.view.ViewRootImpl cannot be cast to android.view.View
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getRelativeLeft(ThemeManager.kt:133)
at com.dolatkia.animatedThemeManager.ThemeManager.getViewCoordinates(ThemeManager.kt:127)
at com.dolatkia.animatedThemeManager.ThemeManager.changeTheme(ThemeManager.kt:48)
at .Fragments.Profile.FgProfileSettings.lambda$onViewCreated$3$....-Fragments-Profile-FgProfileSettings(FgProfileSettings.java:151)
at .Fragments.Profile.FgProfileSettings$$ExternalSyntheticLambda16.onCheckedChanged(D8$$SyntheticClass:0)
at android.widget.CompoundButton.setChecked(CompoundButton.java:222)
at androidx.appcompat.widget.SwitchCompat.setChecked(SwitchCompat.java:1179)
at androidx.appcompat.widget.SwitchCompat.toggle(SwitchCompat.java:1174)
at android.widget.CompoundButton.performClick(CompoundButton.java:144)
at android.view.View.performClickInternal(View.java:7519)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:29476)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7918)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
public interface ITheme extends AppTheme {
int setColor(@NotNull Context context, EnumColor color);
}
ThemeDay:
public class ThemesDay implements ITheme {
public int id() { // set unique iD for each theme
return 0;
}
@Override
public int setColor(@NotNull Context context, EnumColor color) {
return Color.parseColor(getColor(color));
}
private String getColor(EnumColor color){
switch (color){
case WHITE:
return "#FFFFFF";
default:
return "#FFFFFF";
}
}
}
ThemeNight
public class ThemesNight implements ITheme {
public int id() { // set unique iD for each theme
return 0;
}
@Override
public int setColor(@NotNull Context context, EnumColor color) {
return Color.parseColor(getColor(color));
}
private String getColor(EnumColor color){
switch (color){
case WHITE:
return "#181F2A";
default:
return "#181F2A";
}
}
}
The text was updated successfully, but these errors were encountered:
🐛 Describe the bug
The issue arises in the ThemeManager class within the application. Specifically, there seems to be an error related to class casting in the getRelativeLeft and getRelativeTop methods.
When certain conditions are met, the application crashes with a ClassCastException in the ThemeManager class.
Error:
Fragment:
Interface:
ThemeDay:
ThemeNight
The text was updated successfully, but these errors were encountered: