mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-03-01 05:48:22 +03:00
fixed some inconsistencies related to the toggles in the SponsorBlockFragment
This commit is contained in:
parent
4268b1e13b
commit
6d8a846d4b
1 changed files with 32 additions and 0 deletions
|
@ -46,6 +46,8 @@ public class SponsorBlockFragment
|
||||||
private SponsorBlockDataManager sponsorBlockDataManager;
|
private SponsorBlockDataManager sponsorBlockDataManager;
|
||||||
private Disposable workerAddToWhitelisted;
|
private Disposable workerAddToWhitelisted;
|
||||||
private Disposable workerRemoveFromWhitelisted;
|
private Disposable workerRemoveFromWhitelisted;
|
||||||
|
private SponsorBlockMode currentSponsorBlockMode = null;
|
||||||
|
private boolean currentIsWhitelisted;
|
||||||
|
|
||||||
public SponsorBlockFragment() {
|
public SponsorBlockFragment() {
|
||||||
}
|
}
|
||||||
|
@ -110,6 +112,16 @@ public class SponsorBlockFragment
|
||||||
|
|
||||||
binding.segmentList.setAdapter(segmentListAdapter);
|
binding.segmentList.setAdapter(segmentListAdapter);
|
||||||
|
|
||||||
|
binding.skippingIsEnabledSwitch.setChecked(
|
||||||
|
currentSponsorBlockMode == SponsorBlockMode.ENABLED);
|
||||||
|
|
||||||
|
binding.channelIsWhitelistedSwitch.setChecked(currentIsWhitelisted);
|
||||||
|
|
||||||
|
if (currentIsWhitelisted) {
|
||||||
|
binding.skippingIsEnabledSwitch.setChecked(false);
|
||||||
|
binding.skippingIsEnabledSwitch.setEnabled(!currentIsWhitelisted);
|
||||||
|
}
|
||||||
|
|
||||||
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(this);
|
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(this);
|
||||||
binding.channelIsWhitelistedSwitch.setOnCheckedChangeListener(this);
|
binding.channelIsWhitelistedSwitch.setOnCheckedChangeListener(this);
|
||||||
|
|
||||||
|
@ -165,15 +177,35 @@ public class SponsorBlockFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSponsorBlockMode(@NonNull final SponsorBlockMode mode) {
|
public void setSponsorBlockMode(@NonNull final SponsorBlockMode mode) {
|
||||||
|
currentSponsorBlockMode = mode;
|
||||||
|
|
||||||
|
if (binding == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(null);
|
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(null);
|
||||||
binding.skippingIsEnabledSwitch.setChecked(mode == SponsorBlockMode.ENABLED);
|
binding.skippingIsEnabledSwitch.setChecked(mode == SponsorBlockMode.ENABLED);
|
||||||
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(this);
|
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsWhitelisted(final boolean value) {
|
public void setIsWhitelisted(final boolean value) {
|
||||||
|
currentIsWhitelisted = value;
|
||||||
|
|
||||||
|
if (binding == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
binding.channelIsWhitelistedSwitch.setOnCheckedChangeListener(null);
|
binding.channelIsWhitelistedSwitch.setOnCheckedChangeListener(null);
|
||||||
binding.channelIsWhitelistedSwitch.setChecked(value);
|
binding.channelIsWhitelistedSwitch.setChecked(value);
|
||||||
binding.channelIsWhitelistedSwitch.setOnCheckedChangeListener(this);
|
binding.channelIsWhitelistedSwitch.setOnCheckedChangeListener(this);
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(null);
|
||||||
|
binding.skippingIsEnabledSwitch.setChecked(false);
|
||||||
|
binding.skippingIsEnabledSwitch.setOnCheckedChangeListener(this);
|
||||||
|
|
||||||
|
binding.skippingIsEnabledSwitch.setEnabled(!currentIsWhitelisted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentProgress(final int progress) {
|
public void setCurrentProgress(final int progress) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue