mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-13 07:29:26 +01:00
fix(twitch/settings): add missing classes (#226)
This commit is contained in:
parent
bca96cc8b4
commit
35aa4f92c6
@ -0,0 +1,9 @@
|
||||
package app.revanced.twitch.patches;
|
||||
|
||||
import app.revanced.twitch.settings.SettingsEnum;
|
||||
|
||||
public class AudioAdsPatch {
|
||||
public static boolean shouldBlockAudioAds() {
|
||||
return SettingsEnum.BLOCK_AUDIO_ADS.getBoolean();
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package app.revanced.twitch.patches;
|
||||
|
||||
|
||||
import app.revanced.twitch.settings.SettingsEnum;
|
||||
|
||||
public class DebugModePatch {
|
||||
public static boolean isDebugModeEnabled() {
|
||||
return SettingsEnum.DEBUG_MODE.getBoolean();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package app.revanced.twitch.patches;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.SpannedString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StrikethroughSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import app.revanced.twitch.settings.SettingsEnum;
|
||||
import app.revanced.twitch.utils.ReVancedUtils;
|
||||
import tv.twitch.android.shared.chat.util.ClickableUsernameSpan;
|
||||
|
||||
public class ShowDeletedMessagesPatch {
|
||||
public static boolean shouldUseSpoiler() {
|
||||
return Objects.equals(SettingsEnum.SHOW_DELETED_MESSAGES.getString(), "spoiler");
|
||||
}
|
||||
|
||||
public static boolean shouldCrossOut() {
|
||||
return Objects.equals(SettingsEnum.SHOW_DELETED_MESSAGES.getString(), "cross-out");
|
||||
}
|
||||
|
||||
public static Spanned reformatDeletedMessage(Spanned original) {
|
||||
if (!shouldCrossOut())
|
||||
return null;
|
||||
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder(original);
|
||||
ssb.setSpan(new StrikethroughSpan(), 0, original.length(), 0);
|
||||
ssb.append(" (").append(ReVancedUtils.getString("revanced_deleted_msg")).append(")");
|
||||
ssb.setSpan(new StyleSpan(Typeface.ITALIC), original.length(), ssb.length(), 0);
|
||||
|
||||
// Gray-out username
|
||||
ClickableUsernameSpan[] usernameSpans = original.getSpans(0, original.length(), ClickableUsernameSpan.class);
|
||||
if (usernameSpans.length > 0) {
|
||||
ssb.setSpan(new ForegroundColorSpan(Color.parseColor("#ADADB8")), 0, original.getSpanEnd(usernameSpans[0]), 0);
|
||||
}
|
||||
|
||||
return new SpannedString(ssb);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package app.revanced.twitch.patches;
|
||||
|
||||
import app.revanced.twitch.settings.SettingsEnum;
|
||||
|
||||
public class VideoAdsPatch {
|
||||
public static boolean shouldBlockVideoAds() {
|
||||
return SettingsEnum.BLOCK_VIDEO_ADS.getBoolean();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user