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
public final String keyValue;
@NonNull
private final StringSetting behaviorSetting;
public final StringSetting behaviorSetting;
@NonNull
private final StringSetting colorSetting;

View File

@ -31,14 +31,18 @@ public class SegmentCategoryListPreference extends ListPreference {
super(context);
final boolean isHighlightCategory = category == SegmentCategory.HIGHLIGHT;
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
? CategoryBehaviour.getBehaviorDescriptionsWithoutSkipOnce()
: CategoryBehaviour.getBehaviorDescriptions());
setEntryValues(isHighlightCategory
? CategoryBehaviour.getBehaviorKeyValuesWithoutSkipOnce()
: CategoryBehaviour.getBehaviorKeyValues());
setSummary(category.description.toString());
updateTitle();
}