fix(YouTube - SponsorBlock): Show correct segment behavior in settings UI after importing

This commit is contained in:
LisoUseInAIKyrios 2024-11-03 18:54:33 -04:00 committed by oSumAtrIX
parent c7d9ccd13c
commit e3f25a03cd
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 7 additions and 3 deletions

View File

@ -136,7 +136,7 @@ public enum SegmentCategory {
@NonNull @NonNull
public final String keyValue; public final String keyValue;
@NonNull @NonNull
private final StringSetting behaviorSetting; public final StringSetting behaviorSetting;
@NonNull @NonNull
private final StringSetting colorSetting; private final StringSetting colorSetting;

View File

@ -31,14 +31,18 @@ public class SegmentCategoryListPreference extends ListPreference {
super(context); super(context);
final boolean isHighlightCategory = category == SegmentCategory.HIGHLIGHT; final boolean isHighlightCategory = category == SegmentCategory.HIGHLIGHT;
this.category = Objects.requireNonNull(category); this.category = Objects.requireNonNull(category);
setKey(category.keyValue);
setDefaultValue(category.behaviour.reVancedKeyValue); // Edit: Using preferences to sync together multiple pieces
// of code together is messy and should be rethought.
setKey(category.behaviorSetting.key);
setDefaultValue(category.behaviorSetting.defaultValue);
setEntries(isHighlightCategory setEntries(isHighlightCategory
? CategoryBehaviour.getBehaviorDescriptionsWithoutSkipOnce() ? CategoryBehaviour.getBehaviorDescriptionsWithoutSkipOnce()
: CategoryBehaviour.getBehaviorDescriptions()); : CategoryBehaviour.getBehaviorDescriptions());
setEntryValues(isHighlightCategory setEntryValues(isHighlightCategory
? CategoryBehaviour.getBehaviorKeyValuesWithoutSkipOnce() ? CategoryBehaviour.getBehaviorKeyValuesWithoutSkipOnce()
: CategoryBehaviour.getBehaviorKeyValues()); : CategoryBehaviour.getBehaviorKeyValues());
setSummary(category.description.toString()); setSummary(category.description.toString());
updateTitle(); updateTitle();
} }