mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-08-30 11:05:15 +02:00
fix: sponsorblock
settings not getting saved (#112)
This commit is contained in:
parent
6eaf9fee65
commit
256302e914
@ -96,8 +96,8 @@ public enum SettingsEnum {
|
|||||||
SB_ADJUST_NEW_SEGMENT_STEP("new-segment-step-accuracy", 150, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.INTEGER),
|
SB_ADJUST_NEW_SEGMENT_STEP("new-segment-step-accuracy", 150, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.INTEGER),
|
||||||
SB_MIN_DURATION("sb-min-duration", 0F, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.FLOAT),
|
SB_MIN_DURATION("sb-min-duration", 0F, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.FLOAT),
|
||||||
SB_SEEN_GUIDELINES("sb-seen-gl", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_SEEN_GUIDELINES("sb-seen-gl", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
SB_NEW_SEGMENT_ENABLED("sb-new-segment-enabled", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_NEW_SEGMENT_ENABLED("sb-new-segment-enabled", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
SB_VOTING_ENABLED("sb-voting-enabled", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_VOTING_ENABLED("sb-voting-enabled", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
SB_SKIPPED_SEGMENTS("sb-skipped-segments", 0, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.INTEGER),
|
SB_SKIPPED_SEGMENTS("sb-skipped-segments", 0, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.INTEGER),
|
||||||
SB_SKIPPED_SEGMENTS_TIME("sb-skipped-segments-time", 0L, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.LONG),
|
SB_SKIPPED_SEGMENTS_TIME("sb-skipped-segments-time", 0L, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.LONG),
|
||||||
SB_SHOW_TIME_WITHOUT_SEGMENTS("sb-length-without-segments", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_SHOW_TIME_WITHOUT_SEGMENTS("sb-length-without-segments", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
|
@ -28,14 +28,6 @@ public class ReVancedSettingActivity {
|
|||||||
public static void initializeSettings(LicenseActivity base) {
|
public static void initializeSettings(LicenseActivity base) {
|
||||||
base.setContentView(getIdentifier("xsettings_with_toolbar", "layout"));
|
base.setContentView(getIdentifier("xsettings_with_toolbar", "layout"));
|
||||||
|
|
||||||
try {
|
|
||||||
ImageButton imageButton = getImageButton(base.findViewById(getIdentifier("toolbar", "id")));
|
|
||||||
imageButton.setOnClickListener(view -> base.onBackPressed());
|
|
||||||
imageButton.setImageDrawable(base.getResources().getDrawable(getIdentifier(ThemeHelper.isDarkTheme() ? "quantum_ic_arrow_back_white_24" : "quantum_ic_arrow_back_grey600_24", "drawable"), null));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogHelper.printException(ReVancedSettingActivity.class, "Couldn't set Toolbar click handler", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
PreferenceFragment preferenceFragment;
|
PreferenceFragment preferenceFragment;
|
||||||
String preferenceIdentifier;
|
String preferenceIdentifier;
|
||||||
|
|
||||||
@ -50,14 +42,7 @@ public class ReVancedSettingActivity {
|
|||||||
preferenceIdentifier = "revanced_settings";
|
preferenceIdentifier = "revanced_settings";
|
||||||
preferenceFragment = new ReVancedSettingsFragment();
|
preferenceFragment = new ReVancedSettingsFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
var resourceIdentifier = getIdentifier(preferenceIdentifier, "string");
|
|
||||||
getTextView(base.findViewById(getIdentifier("toolbar", "id"))).setText(resourceIdentifier);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogHelper.printException(ReVancedSettingActivity.class, "Couldn't set Toolbar title", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
base.getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), preferenceFragment).commit();
|
base.getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), preferenceFragment).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
.setPositiveButton(str("sb_guidelines_popup_open"), (dialogInterface, i) -> openGuidelines())
|
.setPositiveButton(str("sb_guidelines_popup_open"), (dialogInterface, i) -> openGuidelines())
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
SettingsEnum.SB_NEW_SEGMENT_ENABLED.saveValue(value);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -103,6 +104,11 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setDefaultValue(SettingsEnum.SB_VOTING_ENABLED.getDefaultValue());
|
preference.setDefaultValue(SettingsEnum.SB_VOTING_ENABLED.getDefaultValue());
|
||||||
preference.setChecked(SettingsEnum.SB_VOTING_ENABLED.getBoolean());
|
preference.setChecked(SettingsEnum.SB_VOTING_ENABLED.getBoolean());
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
|
preference.setOnPreferenceChangeListener((preference12, o) -> {
|
||||||
|
final boolean value = (Boolean) o;
|
||||||
|
SettingsEnum.SB_VOTING_ENABLED.saveValue(value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addGeneralCategory(context, preferenceScreen);
|
addGeneralCategory(context, preferenceScreen);
|
||||||
|
Loading…
Reference in New Issue
Block a user