Fix crash on theme editing

This commit resolves the issue where saving or previewing a theme crashed the app.

Closes #282
This commit is contained in:
Bazsalanszky 2024-08-29 10:52:20 +02:00
parent 0c8e3e3ea5
commit e8b199a74a
2 changed files with 60 additions and 65 deletions

View File

@ -263,69 +263,64 @@ public class CustomTheme {
customTheme.readPostFilledCardViewBackgroundColor = customThemeSettingsItems.get(23).colorValue;
customTheme.commentBackgroundColor = customThemeSettingsItems.get(24).colorValue;
customTheme.fullyCollapsedCommentBackgroundColor = customThemeSettingsItems.get(25).colorValue;
customTheme.awardedCommentBackgroundColor = customThemeSettingsItems.get(26).colorValue;
customTheme.receivedMessageBackgroundColor = customThemeSettingsItems.get(27).colorValue;
customTheme.sentMessageBackgroundColor = customThemeSettingsItems.get(28).colorValue;
customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(29).colorValue;
customTheme.primaryIconColor = customThemeSettingsItems.get(30).colorValue;
customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(31).colorValue;
customTheme.postIconAndInfoColor = customThemeSettingsItems.get(32).colorValue;
customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(33).colorValue;
customTheme.fabIconColor = customThemeSettingsItems.get(34).colorValue;
customTheme.sendMessageIconColor = customThemeSettingsItems.get(35).colorValue;
customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(36).colorValue;
customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(37).colorValue;
customTheme.circularProgressBarBackground = customThemeSettingsItems.get(38).colorValue;
customTheme.mediaIndicatorIconColor = customThemeSettingsItems.get(39).colorValue;
customTheme.mediaIndicatorBackgroundColor = customThemeSettingsItems.get(40).colorValue;
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(41).colorValue;
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(42).colorValue;
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(43).colorValue;
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(44).colorValue;
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(45).colorValue;
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(46).colorValue;
customTheme.upvoted = customThemeSettingsItems.get(47).colorValue;
customTheme.downvoted = customThemeSettingsItems.get(48).colorValue;
customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(49).colorValue;
customTheme.postTypeTextColor = customThemeSettingsItems.get(50).colorValue;
customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(51).colorValue;
customTheme.spoilerTextColor = customThemeSettingsItems.get(52).colorValue;
customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(53).colorValue;
customTheme.nsfwTextColor = customThemeSettingsItems.get(54).colorValue;
customTheme.flairBackgroundColor = customThemeSettingsItems.get(55).colorValue;
customTheme.flairTextColor = customThemeSettingsItems.get(56).colorValue;
customTheme.awardsBackgroundColor = customThemeSettingsItems.get(57).colorValue;
customTheme.awardsTextColor = customThemeSettingsItems.get(58).colorValue;
customTheme.archivedTint = customThemeSettingsItems.get(59).colorValue;
customTheme.lockedIconTint = customThemeSettingsItems.get(60).colorValue;
customTheme.crosspostIconTint = customThemeSettingsItems.get(61).colorValue;
customTheme.upvoteRatioIconTint = customThemeSettingsItems.get(62).colorValue;
customTheme.stickiedPostIconTint = customThemeSettingsItems.get(63).colorValue;
customTheme.noPreviewPostTypeIconTint = customThemeSettingsItems.get(64).colorValue;
customTheme.subscribed = customThemeSettingsItems.get(65).colorValue;
customTheme.unsubscribed = customThemeSettingsItems.get(66).colorValue;
customTheme.username = customThemeSettingsItems.get(67).colorValue;
customTheme.subreddit = customThemeSettingsItems.get(68).colorValue;
customTheme.authorFlairTextColor = customThemeSettingsItems.get(69).colorValue;
customTheme.submitter = customThemeSettingsItems.get(70).colorValue;
customTheme.moderator = customThemeSettingsItems.get(71).colorValue;
customTheme.currentUser = customThemeSettingsItems.get(72).colorValue;
customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(73).colorValue;
customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(74).colorValue;
customTheme.dividerColor = customThemeSettingsItems.get(75).colorValue;
customTheme.noPreviewPostTypeBackgroundColor = customThemeSettingsItems.get(76).colorValue;
customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(77).colorValue;
customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(78).colorValue;
customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(79).colorValue;
customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(80).colorValue;
customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(81).colorValue;
customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(82).colorValue;
customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(83).colorValue;
customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(84).colorValue;
customTheme.navBarColor = customThemeSettingsItems.get(85).colorValue;
customTheme.isLightStatusBar = customThemeSettingsItems.get(86).isEnabled;
customTheme.isLightNavBar = customThemeSettingsItems.get(87).isEnabled;
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(88).isEnabled;
customTheme.receivedMessageBackgroundColor = customThemeSettingsItems.get(26).colorValue;
customTheme.sentMessageBackgroundColor = customThemeSettingsItems.get(27).colorValue;
customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(28).colorValue;
customTheme.primaryIconColor = customThemeSettingsItems.get(29).colorValue;
customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(30).colorValue;
customTheme.postIconAndInfoColor = customThemeSettingsItems.get(31).colorValue;
customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(32).colorValue;
customTheme.fabIconColor = customThemeSettingsItems.get(33).colorValue;
customTheme.sendMessageIconColor = customThemeSettingsItems.get(34).colorValue;
customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(35).colorValue;
customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(36).colorValue;
customTheme.circularProgressBarBackground = customThemeSettingsItems.get(37).colorValue;
customTheme.mediaIndicatorIconColor = customThemeSettingsItems.get(38).colorValue;
customTheme.mediaIndicatorBackgroundColor = customThemeSettingsItems.get(39).colorValue;
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(40).colorValue;
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(41).colorValue;
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(42).colorValue;
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(43).colorValue;
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(44).colorValue;
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(45).colorValue;
customTheme.upvoted = customThemeSettingsItems.get(46).colorValue;
customTheme.downvoted = customThemeSettingsItems.get(47).colorValue;
customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(48).colorValue;
customTheme.postTypeTextColor = customThemeSettingsItems.get(49).colorValue;
customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(50).colorValue;
customTheme.spoilerTextColor = customThemeSettingsItems.get(51).colorValue;
customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(52).colorValue;
customTheme.nsfwTextColor = customThemeSettingsItems.get(53).colorValue;
customTheme.archivedTint = customThemeSettingsItems.get(54).colorValue;
customTheme.lockedIconTint = customThemeSettingsItems.get(55).colorValue;
customTheme.crosspostIconTint = customThemeSettingsItems.get(56).colorValue;
customTheme.upvoteRatioIconTint = customThemeSettingsItems.get(57).colorValue;
customTheme.stickiedPostIconTint = customThemeSettingsItems.get(58).colorValue;
customTheme.noPreviewPostTypeIconTint = customThemeSettingsItems.get(59).colorValue;
customTheme.subscribed = customThemeSettingsItems.get(60).colorValue;
customTheme.unsubscribed = customThemeSettingsItems.get(61).colorValue;
customTheme.username = customThemeSettingsItems.get(62).colorValue;
customTheme.subreddit = customThemeSettingsItems.get(63).colorValue;
customTheme.submitter = customThemeSettingsItems.get(64).colorValue;
customTheme.moderator = customThemeSettingsItems.get(65).colorValue;
customTheme.currentUser = customThemeSettingsItems.get(66).colorValue;
customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(67).colorValue;
customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(68).colorValue;
customTheme.dividerColor = customThemeSettingsItems.get(69).colorValue;
customTheme.noPreviewPostTypeBackgroundColor = customThemeSettingsItems.get(70).colorValue;
customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(71).colorValue;
customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(72).colorValue;
customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(73).colorValue;
customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(74).colorValue;
customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(75).colorValue;
customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(76).colorValue;
customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(77).colorValue;
customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(78).colorValue;
customTheme.navBarColor = customThemeSettingsItems.get(79).colorValue;
customTheme.isLightStatusBar = customThemeSettingsItems.get(80).isEnabled;
customTheme.isLightNavBar = customThemeSettingsItems.get(81).isEnabled;
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(82).isEnabled;
return customTheme;
}

View File

@ -831,7 +831,7 @@ public class CustomThemeWrapper {
customTheme.colorPrimary = Color.parseColor("#FFFFFF");
customTheme.colorPrimaryDark = Color.parseColor("#FFFFFF");
customTheme.colorAccent = Color.parseColor("#000000");
customTheme.colorPrimaryLightTheme = Color.parseColor("#FFFFFF");
customTheme.colorPrimaryLightTheme = Color.parseColor("#000000");
customTheme.primaryTextColor = Color.parseColor("#000000");
customTheme.secondaryTextColor = Color.parseColor("#8A000000");
customTheme.postTitleColor = Color.parseColor("#000000");
@ -839,7 +839,7 @@ public class CustomThemeWrapper {
customTheme.readPostTitleColor = Color.parseColor("#9D9D9D");
customTheme.readPostContentColor = Color.parseColor("#9D9D9D");
customTheme.commentColor = Color.parseColor("#000000");
customTheme.buttonTextColor = Color.parseColor("#000000");
customTheme.buttonTextColor = Color.parseColor("#FFFFFF");
customTheme.backgroundColor = Color.parseColor("#FFFFFF");
customTheme.cardViewBackgroundColor = Color.parseColor("#FFFFFF");
customTheme.readPostCardViewBackgroundColor = Color.parseColor("#F5F5F5");