mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-08 11:05:49 +01:00
feat: Move strings to resources for localization (#420)
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
e455262725
commit
7ae10be507
@ -10,6 +10,8 @@ import android.net.ConnectivityManager;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceGroup;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
@ -26,6 +28,8 @@ import androidx.annotation.Nullable;
|
|||||||
import java.text.Bidi;
|
import java.text.Bidi;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.SortedMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.SynchronousQueue;
|
import java.util.concurrent.SynchronousQueue;
|
||||||
@ -33,6 +37,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import app.revanced.integrations.shared.settings.BooleanSetting;
|
import app.revanced.integrations.shared.settings.BooleanSetting;
|
||||||
|
import kotlin.text.Regex;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
@ -388,6 +393,45 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Regex punctuationRegex = new Regex("\\p{P}+");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the preferences by title and ignore the casing.
|
||||||
|
*
|
||||||
|
* Android Preferences are automatically sorted by title,
|
||||||
|
* but if using a localized string key it sorts on the key and not the actual title text that's used at runtime.
|
||||||
|
*
|
||||||
|
* @param menuDepthToSort Maximum menu depth to sort. Menus deeper than this value
|
||||||
|
* will show preferences in the order created in patches.
|
||||||
|
*/
|
||||||
|
public static void sortPreferenceGroupByTitle(PreferenceGroup group, int menuDepthToSort) {
|
||||||
|
if (menuDepthToSort == 0) return;
|
||||||
|
|
||||||
|
SortedMap<String, Preference> preferences = new TreeMap<>();
|
||||||
|
for (int i = 0, prefCount = group.getPreferenceCount(); i < prefCount; i++) {
|
||||||
|
Preference preference = group.getPreference(i);
|
||||||
|
if (preference instanceof PreferenceGroup) {
|
||||||
|
sortPreferenceGroupByTitle((PreferenceGroup) preference, menuDepthToSort - 1);
|
||||||
|
}
|
||||||
|
preferences.put(removePunctuationConvertToLowercase(preference.getTitle()), preference);
|
||||||
|
}
|
||||||
|
|
||||||
|
int prefIndex = 0;
|
||||||
|
for (Preference pref : preferences.values()) {
|
||||||
|
int indexToSet = prefIndex++;
|
||||||
|
if (pref instanceof PreferenceGroup || pref.getIntent() != null) {
|
||||||
|
// Place preference groups last.
|
||||||
|
// Use an offset to push the group to the end.
|
||||||
|
indexToSet += 1000;
|
||||||
|
}
|
||||||
|
pref.setOrder(indexToSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String removePunctuationConvertToLowercase(CharSequence original) {
|
||||||
|
return punctuationRegex.replace(original, "").toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
public enum NetworkType {
|
public enum NetworkType {
|
||||||
NONE,
|
NONE,
|
||||||
MOBILE,
|
MOBILE,
|
||||||
|
@ -76,6 +76,7 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
if (identifier == 0) return;
|
if (identifier == 0) return;
|
||||||
addPreferencesFromResource(identifier);
|
addPreferencesFromResource(identifier);
|
||||||
|
Utils.sortPreferenceGroupByTitle(getPreferenceScreen(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSettingUserDialogConfirmation(SwitchPreference switchPref, BooleanSetting setting) {
|
private void showSettingUserDialogConfirmation(SwitchPreference switchPref, BooleanSetting setting) {
|
||||||
|
@ -18,6 +18,10 @@ import tv.twitch.android.shared.chat.util.ClickableUsernameSpan;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class ShowDeletedMessagesPatch {
|
public class ShowDeletedMessagesPatch {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injection point.
|
||||||
|
*/
|
||||||
public static boolean shouldUseSpoiler() {
|
public static boolean shouldUseSpoiler() {
|
||||||
return "spoiler".equals(Settings.SHOW_DELETED_MESSAGES.get());
|
return "spoiler".equals(Settings.SHOW_DELETED_MESSAGES.get());
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import app.revanced.integrations.shared.Logger;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public final class ChangeStartPagePatch {
|
public final class ChangeStartPagePatch {
|
||||||
public static void changeIntent(Intent intent) {
|
public static void changeIntent(final Intent intent) {
|
||||||
final var startPage = Settings.START_PAGE.get();
|
final var startPage = Settings.START_PAGE.get();
|
||||||
if (startPage.isEmpty()) return;
|
if (startPage.isEmpty()) return;
|
||||||
|
|
||||||
|
@ -46,14 +46,16 @@ public class GmsCoreSupport {
|
|||||||
Logger.printInfo(() -> "GmsCore was not found", exception);
|
Logger.printInfo(() -> "GmsCore was not found", exception);
|
||||||
search(context, getGmsCoreDownloadLink(), str("gms_core_not_installed_warning"));
|
search(context, getGmsCoreDownloadLink(), str("gms_core_not_installed_warning"));
|
||||||
|
|
||||||
// Gracefully exit the app, so it does not crash.
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
try (var client = context.getContentResolver().acquireContentProviderClient(GMS_CORE_PROVIDER)) {
|
try (var client = context.getContentResolver().acquireContentProviderClient(GMS_CORE_PROVIDER)) {
|
||||||
if (client != null) return;
|
if (client != null) return;
|
||||||
|
|
||||||
Logger.printInfo(() -> "GmsCore is not running in the background");
|
Logger.printInfo(() -> "GmsCore is not running in the background");
|
||||||
search(context, DONT_KILL_MY_APP_LINK, str("gms_core_not_running_warning"));
|
search(context, DONT_KILL_MY_APP_LINK, str("gms_core_not_running_warning"));
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,9 +18,11 @@ import java.io.IOException;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static android.text.Html.FROM_HTML_MODE_COMPACT;
|
import static android.text.Html.FROM_HTML_MODE_COMPACT;
|
||||||
|
import static app.revanced.integrations.shared.StringRef.str;
|
||||||
import static app.revanced.integrations.youtube.patches.announcements.requests.AnnouncementsRoutes.GET_LATEST_ANNOUNCEMENT;
|
import static app.revanced.integrations.youtube.patches.announcements.requests.AnnouncementsRoutes.GET_LATEST_ANNOUNCEMENT;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@ -39,9 +41,10 @@ public final class AnnouncementsPatch {
|
|||||||
|
|
||||||
Utils.runOnBackgroundThread(() -> {
|
Utils.runOnBackgroundThread(() -> {
|
||||||
try {
|
try {
|
||||||
HttpURLConnection connection = AnnouncementsRoutes.getAnnouncementsConnectionFromRoute(GET_LATEST_ANNOUNCEMENT, CONSUMER);
|
HttpURLConnection connection = AnnouncementsRoutes.getAnnouncementsConnectionFromRoute(
|
||||||
|
GET_LATEST_ANNOUNCEMENT, CONSUMER, Locale.getDefault().toLanguageTag());
|
||||||
|
|
||||||
Logger.printDebug(() -> "Get latest announcement route connection url: " + connection.getURL().toString());
|
Logger.printDebug(() -> "Get latest announcement route connection url: " + connection.getURL());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Do not show the announcement if the request failed.
|
// Do not show the announcement if the request failed.
|
||||||
@ -49,7 +52,7 @@ public final class AnnouncementsPatch {
|
|||||||
if (Settings.ANNOUNCEMENT_LAST_HASH.get().isEmpty()) return;
|
if (Settings.ANNOUNCEMENT_LAST_HASH.get().isEmpty()) return;
|
||||||
|
|
||||||
Settings.ANNOUNCEMENT_LAST_HASH.resetToDefault();
|
Settings.ANNOUNCEMENT_LAST_HASH.resetToDefault();
|
||||||
Utils.showToastLong("Failed to get announcement");
|
Utils.showToastLong(str("revanced_announcements_connection_failed"));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,10 @@ import static app.revanced.integrations.youtube.requests.Route.Method.GET;
|
|||||||
public class AnnouncementsRoutes {
|
public class AnnouncementsRoutes {
|
||||||
private static final String ANNOUNCEMENTS_PROVIDER = "https://api.revanced.app/v2";
|
private static final String ANNOUNCEMENTS_PROVIDER = "https://api.revanced.app/v2";
|
||||||
|
|
||||||
|
/**
|
||||||
public static final Route GET_LATEST_ANNOUNCEMENT = new Route(GET, "/announcements/youtube/latest?consumer={consumer}");
|
* 'language' parameter is IETF format (for USA it would be 'en-us').
|
||||||
|
*/
|
||||||
|
public static final Route GET_LATEST_ANNOUNCEMENT = new Route(GET, "/announcements/youtube/latest?consumer={consumer}&language={language}");
|
||||||
|
|
||||||
private AnnouncementsRoutes() {
|
private AnnouncementsRoutes() {
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import java.lang.reflect.Method;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static app.revanced.integrations.shared.StringRef.str;
|
||||||
import static app.revanced.integrations.shared.Utils.NetworkType;
|
import static app.revanced.integrations.shared.Utils.NetworkType;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@ -43,13 +44,13 @@ public class RememberVideoQualityPatch {
|
|||||||
String networkTypeMessage;
|
String networkTypeMessage;
|
||||||
if (Utils.getNetworkType() == NetworkType.MOBILE) {
|
if (Utils.getNetworkType() == NetworkType.MOBILE) {
|
||||||
mobileQualitySetting.save(defaultQuality);
|
mobileQualitySetting.save(defaultQuality);
|
||||||
networkTypeMessage = "mobile";
|
networkTypeMessage = str("revanced_remember_video_quality_mobile");
|
||||||
} else {
|
} else {
|
||||||
wifiQualitySetting.save(defaultQuality);
|
wifiQualitySetting.save(defaultQuality);
|
||||||
networkTypeMessage = "Wi-Fi";
|
networkTypeMessage = str("revanced_remember_video_quality_wifi");
|
||||||
}
|
}
|
||||||
Utils.showToastShort("Changed default " + networkTypeMessage
|
Utils.showToastShort(
|
||||||
+ " quality to: " + defaultQuality +"p");
|
str("revanced_remember_video_quality_toast", networkTypeMessage, (defaultQuality + "p")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package app.revanced.integrations.youtube.patches.playback.speed;
|
package app.revanced.integrations.youtube.patches.playback.speed;
|
||||||
|
|
||||||
|
import static app.revanced.integrations.shared.StringRef.str;
|
||||||
|
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -62,8 +64,7 @@ public class CustomPlaybackSpeedPatch {
|
|||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
if (speed >= MAXIMUM_PLAYBACK_SPEED) {
|
if (speed >= MAXIMUM_PLAYBACK_SPEED) {
|
||||||
resetCustomSpeeds("Custom speeds must be less than " + MAXIMUM_PLAYBACK_SPEED
|
resetCustomSpeeds(str("revanced_custom_playback_speeds_invalid", MAXIMUM_PLAYBACK_SPEED));
|
||||||
+ ". Using default values.");
|
|
||||||
loadCustomSpeeds();
|
loadCustomSpeeds();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ public class CustomPlaybackSpeedPatch {
|
|||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printInfo(() -> "parse error", ex);
|
Logger.printInfo(() -> "parse error", ex);
|
||||||
resetCustomSpeeds("Invalid custom playback speeds. Using default values.");
|
resetCustomSpeeds(str("revanced_custom_playback_speeds_parse_exception"));
|
||||||
loadCustomSpeeds();
|
loadCustomSpeeds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package app.revanced.integrations.youtube.patches.playback.speed;
|
package app.revanced.integrations.youtube.patches.playback.speed;
|
||||||
|
|
||||||
|
import static app.revanced.integrations.shared.StringRef.str;
|
||||||
|
|
||||||
import app.revanced.integrations.youtube.patches.VideoInformation;
|
import app.revanced.integrations.youtube.patches.VideoInformation;
|
||||||
import app.revanced.integrations.youtube.settings.Settings;
|
import app.revanced.integrations.youtube.settings.Settings;
|
||||||
import app.revanced.integrations.shared.Logger;
|
import app.revanced.integrations.shared.Logger;
|
||||||
@ -25,7 +27,7 @@ public final class RememberPlaybackSpeedPatch {
|
|||||||
public static void userSelectedPlaybackSpeed(float playbackSpeed) {
|
public static void userSelectedPlaybackSpeed(float playbackSpeed) {
|
||||||
if (Settings.REMEMBER_PLAYBACK_SPEED_LAST_SELECTED.get()) {
|
if (Settings.REMEMBER_PLAYBACK_SPEED_LAST_SELECTED.get()) {
|
||||||
Settings.PLAYBACK_SPEED_DEFAULT.save(playbackSpeed);
|
Settings.PLAYBACK_SPEED_DEFAULT.save(playbackSpeed);
|
||||||
Utils.showToastLong("Changed default speed to: " + playbackSpeed + "x");
|
Utils.showToastLong(str("revanced_remember_playback_speed_toast", (playbackSpeed + "x")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import java.net.SocketTimeoutException;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static app.revanced.integrations.shared.StringRef.str;
|
||||||
import static app.revanced.integrations.youtube.patches.spoof.requests.PlayerRoutes.*;
|
import static app.revanced.integrations.youtube.patches.spoof.requests.PlayerRoutes.*;
|
||||||
|
|
||||||
public class StoryboardRendererRequester {
|
public class StoryboardRendererRequester {
|
||||||
@ -62,14 +63,14 @@ public class StoryboardRendererRequester {
|
|||||||
if (responseCode == 200) return Requester.parseJSONObject(connection);
|
if (responseCode == 200) return Requester.parseJSONObject(connection);
|
||||||
|
|
||||||
// Always show a toast for this, as a non 200 response means something is broken.
|
// Always show a toast for this, as a non 200 response means something is broken.
|
||||||
|
// Not a normal code path and should not be reached, so no translations are needed.
|
||||||
handleConnectionError("Spoof storyboard not available: " + responseCode,
|
handleConnectionError("Spoof storyboard not available: " + responseCode,
|
||||||
null, showToastOnIOException || BaseSettings.DEBUG_TOAST_ON_ERROR.get());
|
null, showToastOnIOException || BaseSettings.DEBUG_TOAST_ON_ERROR.get());
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
} catch (SocketTimeoutException ex) {
|
} catch (SocketTimeoutException ex) {
|
||||||
handleConnectionError("Spoof storyboard temporarily not available (API timed out)",
|
handleConnectionError(str("revanced_spoof_storyboard_timeout"), ex, showToastOnIOException);
|
||||||
ex, showToastOnIOException);
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
handleConnectionError("Spoof storyboard temporarily not available: " + ex.getMessage(),
|
handleConnectionError(str("revanced_spoof_storyboard_io_exception", ex.getMessage()),
|
||||||
ex, showToastOnIOException);
|
ex, showToastOnIOException);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "Spoof storyboard fetch failed", ex); // Should never happen.
|
Logger.printException(() -> "Spoof storyboard fetch failed", ex); // Should never happen.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package app.revanced.integrations.youtube.patches.theme;
|
package app.revanced.integrations.youtube.patches.theme;
|
||||||
|
|
||||||
|
import static app.revanced.integrations.shared.StringRef.str;
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
|
||||||
import app.revanced.integrations.youtube.settings.Settings;
|
import app.revanced.integrations.youtube.settings.Settings;
|
||||||
@ -48,7 +50,7 @@ public final class SeekbarColorPatch {
|
|||||||
seekbarColor = Color.parseColor(Settings.SEEKBAR_CUSTOM_COLOR_VALUE.get());
|
seekbarColor = Color.parseColor(Settings.SEEKBAR_CUSTOM_COLOR_VALUE.get());
|
||||||
Color.colorToHSV(seekbarColor, customSeekbarColorHSV);
|
Color.colorToHSV(seekbarColor, customSeekbarColorHSV);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Utils.showToastShort("Invalid seekbar color value. Using default value.");
|
Utils.showToastShort(str("revanced_seekbar_custom_color_invalid"));
|
||||||
Settings.SEEKBAR_CUSTOM_COLOR_VALUE.resetToDefault();
|
Settings.SEEKBAR_CUSTOM_COLOR_VALUE.resetToDefault();
|
||||||
loadCustomSeekbarColor();
|
loadCustomSeekbarColor();
|
||||||
}
|
}
|
||||||
|
@ -41,15 +41,15 @@ public class LicenseActivityHook {
|
|||||||
String toolbarTitleResourceName;
|
String toolbarTitleResourceName;
|
||||||
String dataString = licenseActivity.getIntent().getDataString();
|
String dataString = licenseActivity.getIntent().getDataString();
|
||||||
switch (dataString) {
|
switch (dataString) {
|
||||||
case "sponsorblock_settings":
|
case "revanced_sb_settings_intent":
|
||||||
toolbarTitleResourceName = "revanced_sponsorblock_settings_title";
|
toolbarTitleResourceName = "revanced_sb_settings_title";
|
||||||
fragment = new SponsorBlockPreferenceFragment();
|
fragment = new SponsorBlockPreferenceFragment();
|
||||||
break;
|
break;
|
||||||
case "ryd_settings":
|
case "revanced_ryd_settings_intent":
|
||||||
toolbarTitleResourceName = "revanced_ryd_settings_title";
|
toolbarTitleResourceName = "revanced_ryd_settings_title";
|
||||||
fragment = new ReturnYouTubeDislikePreferenceFragment();
|
fragment = new ReturnYouTubeDislikePreferenceFragment();
|
||||||
break;
|
break;
|
||||||
case "revanced_settings":
|
case "revanced_settings_intent":
|
||||||
toolbarTitleResourceName = "revanced_settings_title";
|
toolbarTitleResourceName = "revanced_settings_title";
|
||||||
fragment = new ReVancedPreferenceFragment();
|
fragment = new ReVancedPreferenceFragment();
|
||||||
break;
|
break;
|
||||||
|
@ -120,9 +120,9 @@ public class ReturnYouTubeDislikePreferenceFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
toastOnRYDNotAvailable = new SwitchPreference(context);
|
toastOnRYDNotAvailable = new SwitchPreference(context);
|
||||||
toastOnRYDNotAvailable.setChecked(Settings.RYD_TOAST_ON_CONNECTION_ERROR.get());
|
toastOnRYDNotAvailable.setChecked(Settings.RYD_TOAST_ON_CONNECTION_ERROR.get());
|
||||||
toastOnRYDNotAvailable.setTitle(str("ryd_toast_on_connection_error_title"));
|
toastOnRYDNotAvailable.setTitle(str("revanced_ryd_toast_on_connection_error_title"));
|
||||||
toastOnRYDNotAvailable.setSummaryOn(str("ryd_toast_on_connection_error_summary_on"));
|
toastOnRYDNotAvailable.setSummaryOn(str("revanced_ryd_toast_on_connection_error_summary_on"));
|
||||||
toastOnRYDNotAvailable.setSummaryOff(str("ryd_toast_on_connection_error_summary_off"));
|
toastOnRYDNotAvailable.setSummaryOff(str("revanced_ryd_toast_on_connection_error_summary_off"));
|
||||||
toastOnRYDNotAvailable.setOnPreferenceChangeListener((pref, newValue) -> {
|
toastOnRYDNotAvailable.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||||
Settings.RYD_TOAST_ON_CONNECTION_ERROR.save((Boolean) newValue);
|
Settings.RYD_TOAST_ON_CONNECTION_ERROR.save((Boolean) newValue);
|
||||||
updateUIState();
|
updateUIState();
|
||||||
|
@ -101,9 +101,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
// If the user has a private user id, then include a subtext that mentions not to share it.
|
// If the user has a private user id, then include a subtext that mentions not to share it.
|
||||||
String exportSummarySubText = SponsorBlockSettings.userHasSBPrivateId()
|
String exportSummarySubText = SponsorBlockSettings.userHasSBPrivateId()
|
||||||
? str("sb_settings_ie_sum_warning")
|
? str("revanced_sb_settings_ie_sum_warning")
|
||||||
: "";
|
: "";
|
||||||
importExport.setSummary(str("sb_settings_ie_sum", exportSummarySubText));
|
importExport.setSummary(str("revanced_sb_settings_ie_sum", exportSummarySubText));
|
||||||
|
|
||||||
apiUrl.setEnabled(enabled);
|
apiUrl.setEnabled(enabled);
|
||||||
importExport.setEnabled(enabled);
|
importExport.setEnabled(enabled);
|
||||||
@ -127,8 +127,8 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
SponsorBlockSettings.initialize();
|
SponsorBlockSettings.initialize();
|
||||||
|
|
||||||
sbEnabled = new SwitchPreference(context);
|
sbEnabled = new SwitchPreference(context);
|
||||||
sbEnabled.setTitle(str("sb_enable_sb"));
|
sbEnabled.setTitle(str("revanced_sb_enable_sb"));
|
||||||
sbEnabled.setSummary(str("sb_enable_sb_sum"));
|
sbEnabled.setSummary(str("revanced_sb_enable_sb_sum"));
|
||||||
preferenceScreen.addPreference(sbEnabled);
|
preferenceScreen.addPreference(sbEnabled);
|
||||||
sbEnabled.setOnPreferenceChangeListener((preference1, newValue) -> {
|
sbEnabled.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_ENABLED.save((Boolean) newValue);
|
Settings.SB_ENABLED.save((Boolean) newValue);
|
||||||
@ -139,7 +139,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
addAppearanceCategory(context, preferenceScreen);
|
addAppearanceCategory(context, preferenceScreen);
|
||||||
|
|
||||||
segmentCategory = new PreferenceCategory(context);
|
segmentCategory = new PreferenceCategory(context);
|
||||||
segmentCategory.setTitle(str("sb_diff_segments"));
|
segmentCategory.setTitle(str("revanced_sb_diff_segments"));
|
||||||
preferenceScreen.addPreference(segmentCategory);
|
preferenceScreen.addPreference(segmentCategory);
|
||||||
updateSegmentCategories();
|
updateSegmentCategories();
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
addGeneralCategory(context, preferenceScreen);
|
addGeneralCategory(context, preferenceScreen);
|
||||||
|
|
||||||
statsCategory = new PreferenceCategory(context);
|
statsCategory = new PreferenceCategory(context);
|
||||||
statsCategory.setTitle(str("sb_stats"));
|
statsCategory.setTitle(str("revanced_sb_stats"));
|
||||||
preferenceScreen.addPreference(statsCategory);
|
preferenceScreen.addPreference(statsCategory);
|
||||||
fetchAndDisplayStats();
|
fetchAndDisplayStats();
|
||||||
|
|
||||||
@ -163,12 +163,12 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
private void addAppearanceCategory(Context context, PreferenceScreen screen) {
|
private void addAppearanceCategory(Context context, PreferenceScreen screen) {
|
||||||
PreferenceCategory category = new PreferenceCategory(context);
|
PreferenceCategory category = new PreferenceCategory(context);
|
||||||
screen.addPreference(category);
|
screen.addPreference(category);
|
||||||
category.setTitle(str("sb_appearance_category"));
|
category.setTitle(str("revanced_sb_appearance_category"));
|
||||||
|
|
||||||
votingEnabled = new SwitchPreference(context);
|
votingEnabled = new SwitchPreference(context);
|
||||||
votingEnabled.setTitle(str("sb_enable_voting"));
|
votingEnabled.setTitle(str("revanced_sb_enable_voting"));
|
||||||
votingEnabled.setSummaryOn(str("sb_enable_voting_sum_on"));
|
votingEnabled.setSummaryOn(str("revanced_sb_enable_voting_sum_on"));
|
||||||
votingEnabled.setSummaryOff(str("sb_enable_voting_sum_off"));
|
votingEnabled.setSummaryOff(str("revanced_sb_enable_voting_sum_off"));
|
||||||
category.addPreference(votingEnabled);
|
category.addPreference(votingEnabled);
|
||||||
votingEnabled.setOnPreferenceChangeListener((preference1, newValue) -> {
|
votingEnabled.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_VOTING_BUTTON.save((Boolean) newValue);
|
Settings.SB_VOTING_BUTTON.save((Boolean) newValue);
|
||||||
@ -177,9 +177,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
compactSkipButton = new SwitchPreference(context);
|
compactSkipButton = new SwitchPreference(context);
|
||||||
compactSkipButton.setTitle(str("sb_enable_compact_skip_button"));
|
compactSkipButton.setTitle(str("revanced_sb_enable_compact_skip_button"));
|
||||||
compactSkipButton.setSummaryOn(str("sb_enable_compact_skip_button_sum_on"));
|
compactSkipButton.setSummaryOn(str("revanced_sb_enable_compact_skip_button_sum_on"));
|
||||||
compactSkipButton.setSummaryOff(str("sb_enable_compact_skip_button_sum_off"));
|
compactSkipButton.setSummaryOff(str("revanced_sb_enable_compact_skip_button_sum_off"));
|
||||||
category.addPreference(compactSkipButton);
|
category.addPreference(compactSkipButton);
|
||||||
compactSkipButton.setOnPreferenceChangeListener((preference1, newValue) -> {
|
compactSkipButton.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_COMPACT_SKIP_BUTTON.save((Boolean) newValue);
|
Settings.SB_COMPACT_SKIP_BUTTON.save((Boolean) newValue);
|
||||||
@ -188,9 +188,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
autoHideSkipSegmentButton = new SwitchPreference(context);
|
autoHideSkipSegmentButton = new SwitchPreference(context);
|
||||||
autoHideSkipSegmentButton.setTitle(str("sb_enable_auto_hide_skip_segment_button"));
|
autoHideSkipSegmentButton.setTitle(str("revanced_sb_enable_auto_hide_skip_segment_button"));
|
||||||
autoHideSkipSegmentButton.setSummaryOn(str("sb_enable_auto_hide_skip_segment_button_sum_on"));
|
autoHideSkipSegmentButton.setSummaryOn(str("revanced_sb_enable_auto_hide_skip_segment_button_sum_on"));
|
||||||
autoHideSkipSegmentButton.setSummaryOff(str("sb_enable_auto_hide_skip_segment_button_sum_off"));
|
autoHideSkipSegmentButton.setSummaryOff(str("revanced_sb_enable_auto_hide_skip_segment_button_sum_off"));
|
||||||
category.addPreference(autoHideSkipSegmentButton);
|
category.addPreference(autoHideSkipSegmentButton);
|
||||||
autoHideSkipSegmentButton.setOnPreferenceChangeListener((preference1, newValue) -> {
|
autoHideSkipSegmentButton.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_AUTO_HIDE_SKIP_BUTTON.save((Boolean) newValue);
|
Settings.SB_AUTO_HIDE_SKIP_BUTTON.save((Boolean) newValue);
|
||||||
@ -199,11 +199,11 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
showSkipToast = new SwitchPreference(context);
|
showSkipToast = new SwitchPreference(context);
|
||||||
showSkipToast.setTitle(str("sb_general_skiptoast"));
|
showSkipToast.setTitle(str("revanced_sb_general_skiptoast"));
|
||||||
showSkipToast.setSummaryOn(str("sb_general_skiptoast_sum_on"));
|
showSkipToast.setSummaryOn(str("revanced_sb_general_skiptoast_sum_on"));
|
||||||
showSkipToast.setSummaryOff(str("sb_general_skiptoast_sum_off"));
|
showSkipToast.setSummaryOff(str("revanced_sb_general_skiptoast_sum_off"));
|
||||||
showSkipToast.setOnPreferenceClickListener(preference1 -> {
|
showSkipToast.setOnPreferenceClickListener(preference1 -> {
|
||||||
Utils.showToastShort(str("sb_skipped_sponsor"));
|
Utils.showToastShort(str("revanced_sb_skipped_sponsor"));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
showSkipToast.setOnPreferenceChangeListener((preference1, newValue) -> {
|
showSkipToast.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
@ -214,9 +214,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
category.addPreference(showSkipToast);
|
category.addPreference(showSkipToast);
|
||||||
|
|
||||||
showTimeWithoutSegments = new SwitchPreference(context);
|
showTimeWithoutSegments = new SwitchPreference(context);
|
||||||
showTimeWithoutSegments.setTitle(str("sb_general_time_without"));
|
showTimeWithoutSegments.setTitle(str("revanced_sb_general_time_without"));
|
||||||
showTimeWithoutSegments.setSummaryOn(str("sb_general_time_without_sum_on"));
|
showTimeWithoutSegments.setSummaryOn(str("revanced_sb_general_time_without_sum_on"));
|
||||||
showTimeWithoutSegments.setSummaryOff(str("sb_general_time_without_sum_off"));
|
showTimeWithoutSegments.setSummaryOff(str("revanced_sb_general_time_without_sum_off"));
|
||||||
showTimeWithoutSegments.setOnPreferenceChangeListener((preference1, newValue) -> {
|
showTimeWithoutSegments.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_VIDEO_LENGTH_WITHOUT_SEGMENTS.save((Boolean) newValue);
|
Settings.SB_VIDEO_LENGTH_WITHOUT_SEGMENTS.save((Boolean) newValue);
|
||||||
updateUI();
|
updateUI();
|
||||||
@ -228,21 +228,21 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
private void addCreateSegmentCategory(Context context, PreferenceScreen screen) {
|
private void addCreateSegmentCategory(Context context, PreferenceScreen screen) {
|
||||||
PreferenceCategory category = new PreferenceCategory(context);
|
PreferenceCategory category = new PreferenceCategory(context);
|
||||||
screen.addPreference(category);
|
screen.addPreference(category);
|
||||||
category.setTitle(str("sb_create_segment_category"));
|
category.setTitle(str("revanced_sb_create_segment_category"));
|
||||||
|
|
||||||
addNewSegment = new SwitchPreference(context);
|
addNewSegment = new SwitchPreference(context);
|
||||||
addNewSegment.setTitle(str("sb_enable_create_segment"));
|
addNewSegment.setTitle(str("revanced_sb_enable_create_segment"));
|
||||||
addNewSegment.setSummaryOn(str("sb_enable_create_segment_sum_on"));
|
addNewSegment.setSummaryOn(str("revanced_sb_enable_create_segment_sum_on"));
|
||||||
addNewSegment.setSummaryOff(str("sb_enable_create_segment_sum_off"));
|
addNewSegment.setSummaryOff(str("revanced_sb_enable_create_segment_sum_off"));
|
||||||
category.addPreference(addNewSegment);
|
category.addPreference(addNewSegment);
|
||||||
addNewSegment.setOnPreferenceChangeListener((preference1, o) -> {
|
addNewSegment.setOnPreferenceChangeListener((preference1, o) -> {
|
||||||
Boolean newValue = (Boolean) o;
|
Boolean newValue = (Boolean) o;
|
||||||
if (newValue && !Settings.SB_SEEN_GUIDELINES.get()) {
|
if (newValue && !Settings.SB_SEEN_GUIDELINES.get()) {
|
||||||
new AlertDialog.Builder(preference1.getContext())
|
new AlertDialog.Builder(preference1.getContext())
|
||||||
.setTitle(str("sb_guidelines_popup_title"))
|
.setTitle(str("revanced_sb_guidelines_popup_title"))
|
||||||
.setMessage(str("sb_guidelines_popup_content"))
|
.setMessage(str("revanced_sb_guidelines_popup_content"))
|
||||||
.setNegativeButton(str("sb_guidelines_popup_already_read"), null)
|
.setNegativeButton(str("revanced_sb_guidelines_popup_already_read"), null)
|
||||||
.setPositiveButton(str("sb_guidelines_popup_open"), (dialogInterface, i) -> openGuidelines())
|
.setPositiveButton(str("revanced_sb_guidelines_popup_open"), (dialogInterface, i) -> openGuidelines())
|
||||||
.setOnDismissListener(dialog -> Settings.SB_SEEN_GUIDELINES.save(true))
|
.setOnDismissListener(dialog -> Settings.SB_SEEN_GUIDELINES.save(true))
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.show();
|
.show();
|
||||||
@ -253,13 +253,13 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
newSegmentStep = new EditTextPreference(context);
|
newSegmentStep = new EditTextPreference(context);
|
||||||
newSegmentStep.setTitle(str("sb_general_adjusting"));
|
newSegmentStep.setTitle(str("revanced_sb_general_adjusting"));
|
||||||
newSegmentStep.setSummary(str("sb_general_adjusting_sum"));
|
newSegmentStep.setSummary(str("revanced_sb_general_adjusting_sum"));
|
||||||
newSegmentStep.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
|
newSegmentStep.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
newSegmentStep.setOnPreferenceChangeListener((preference1, newValue) -> {
|
newSegmentStep.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
final int newAdjustmentValue = Integer.parseInt(newValue.toString());
|
final int newAdjustmentValue = Integer.parseInt(newValue.toString());
|
||||||
if (newAdjustmentValue == 0) {
|
if (newAdjustmentValue == 0) {
|
||||||
Utils.showToastLong(str("sb_general_adjusting_invalid"));
|
Utils.showToastLong(str("revanced_sb_general_adjusting_invalid"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Settings.SB_CREATE_NEW_SEGMENT_STEP.save(newAdjustmentValue);
|
Settings.SB_CREATE_NEW_SEGMENT_STEP.save(newAdjustmentValue);
|
||||||
@ -268,8 +268,8 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
category.addPreference(newSegmentStep);
|
category.addPreference(newSegmentStep);
|
||||||
|
|
||||||
Preference guidelinePreferences = new Preference(context);
|
Preference guidelinePreferences = new Preference(context);
|
||||||
guidelinePreferences.setTitle(str("sb_guidelines_preference_title"));
|
guidelinePreferences.setTitle(str("revanced_sb_guidelines_preference_title"));
|
||||||
guidelinePreferences.setSummary(str("sb_guidelines_preference_sum"));
|
guidelinePreferences.setSummary(str("revanced_sb_guidelines_preference_sum"));
|
||||||
guidelinePreferences.setOnPreferenceClickListener(preference1 -> {
|
guidelinePreferences.setOnPreferenceClickListener(preference1 -> {
|
||||||
openGuidelines();
|
openGuidelines();
|
||||||
return true;
|
return true;
|
||||||
@ -280,12 +280,12 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
private void addGeneralCategory(final Context context, PreferenceScreen screen) {
|
private void addGeneralCategory(final Context context, PreferenceScreen screen) {
|
||||||
PreferenceCategory category = new PreferenceCategory(context);
|
PreferenceCategory category = new PreferenceCategory(context);
|
||||||
screen.addPreference(category);
|
screen.addPreference(category);
|
||||||
category.setTitle(str("sb_general"));
|
category.setTitle(str("revanced_sb_general"));
|
||||||
|
|
||||||
toastOnConnectionError = new SwitchPreference(context);
|
toastOnConnectionError = new SwitchPreference(context);
|
||||||
toastOnConnectionError.setTitle(str("sb_toast_on_connection_error_title"));
|
toastOnConnectionError.setTitle(str("revanced_sb_toast_on_connection_error_title"));
|
||||||
toastOnConnectionError.setSummaryOn(str("sb_toast_on_connection_error_summary_on"));
|
toastOnConnectionError.setSummaryOn(str("revanced_sb_toast_on_connection_error_summary_on"));
|
||||||
toastOnConnectionError.setSummaryOff(str("sb_toast_on_connection_error_summary_off"));
|
toastOnConnectionError.setSummaryOff(str("revanced_sb_toast_on_connection_error_summary_off"));
|
||||||
toastOnConnectionError.setOnPreferenceChangeListener((preference1, newValue) -> {
|
toastOnConnectionError.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_TOAST_ON_CONNECTION_ERROR.save((Boolean) newValue);
|
Settings.SB_TOAST_ON_CONNECTION_ERROR.save((Boolean) newValue);
|
||||||
updateUI();
|
updateUI();
|
||||||
@ -294,9 +294,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
category.addPreference(toastOnConnectionError);
|
category.addPreference(toastOnConnectionError);
|
||||||
|
|
||||||
trackSkips = new SwitchPreference(context);
|
trackSkips = new SwitchPreference(context);
|
||||||
trackSkips.setTitle(str("sb_general_skipcount"));
|
trackSkips.setTitle(str("revanced_sb_general_skipcount"));
|
||||||
trackSkips.setSummaryOn(str("sb_general_skipcount_sum_on"));
|
trackSkips.setSummaryOn(str("revanced_sb_general_skipcount_sum_on"));
|
||||||
trackSkips.setSummaryOff(str("sb_general_skipcount_sum_off"));
|
trackSkips.setSummaryOff(str("revanced_sb_general_skipcount_sum_off"));
|
||||||
trackSkips.setOnPreferenceChangeListener((preference1, newValue) -> {
|
trackSkips.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_TRACK_SKIP_COUNT.save((Boolean) newValue);
|
Settings.SB_TRACK_SKIP_COUNT.save((Boolean) newValue);
|
||||||
updateUI();
|
updateUI();
|
||||||
@ -305,8 +305,8 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
category.addPreference(trackSkips);
|
category.addPreference(trackSkips);
|
||||||
|
|
||||||
minSegmentDuration = new EditTextPreference(context);
|
minSegmentDuration = new EditTextPreference(context);
|
||||||
minSegmentDuration.setTitle(str("sb_general_min_duration"));
|
minSegmentDuration.setTitle(str("revanced_sb_general_min_duration"));
|
||||||
minSegmentDuration.setSummary(str("sb_general_min_duration_sum"));
|
minSegmentDuration.setSummary(str("revanced_sb_general_min_duration_sum"));
|
||||||
minSegmentDuration.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
minSegmentDuration.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||||
minSegmentDuration.setOnPreferenceChangeListener((preference1, newValue) -> {
|
minSegmentDuration.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
Settings.SB_SEGMENT_MIN_DURATION.save(Float.valueOf(newValue.toString()));
|
Settings.SB_SEGMENT_MIN_DURATION.save(Float.valueOf(newValue.toString()));
|
||||||
@ -315,12 +315,12 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
category.addPreference(minSegmentDuration);
|
category.addPreference(minSegmentDuration);
|
||||||
|
|
||||||
privateUserId = new EditTextPreference(context);
|
privateUserId = new EditTextPreference(context);
|
||||||
privateUserId.setTitle(str("sb_general_uuid"));
|
privateUserId.setTitle(str("revanced_sb_general_uuid"));
|
||||||
privateUserId.setSummary(str("sb_general_uuid_sum"));
|
privateUserId.setSummary(str("revanced_sb_general_uuid_sum"));
|
||||||
privateUserId.setOnPreferenceChangeListener((preference1, newValue) -> {
|
privateUserId.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
String newUUID = newValue.toString();
|
String newUUID = newValue.toString();
|
||||||
if (!SponsorBlockSettings.isValidSBUserId(newUUID)) {
|
if (!SponsorBlockSettings.isValidSBUserId(newUUID)) {
|
||||||
Utils.showToastLong(str("sb_general_uuid_invalid"));
|
Utils.showToastLong(str("revanced_sb_general_uuid_invalid"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Settings.SB_PRIVATE_USER_ID.save(newUUID);
|
Settings.SB_PRIVATE_USER_ID.save(newUUID);
|
||||||
@ -331,8 +331,8 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
category.addPreference(privateUserId);
|
category.addPreference(privateUserId);
|
||||||
|
|
||||||
apiUrl = new Preference(context);
|
apiUrl = new Preference(context);
|
||||||
apiUrl.setTitle(str("sb_general_api_url"));
|
apiUrl.setTitle(str("revanced_sb_general_api_url"));
|
||||||
apiUrl.setSummary(Html.fromHtml(str("sb_general_api_url_sum")));
|
apiUrl.setSummary(Html.fromHtml(str("revanced_sb_general_api_url_sum")));
|
||||||
apiUrl.setOnPreferenceClickListener(preference1 -> {
|
apiUrl.setOnPreferenceClickListener(preference1 -> {
|
||||||
EditText editText = new EditText(context);
|
EditText editText = new EditText(context);
|
||||||
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
|
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
|
||||||
@ -341,14 +341,14 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
DialogInterface.OnClickListener urlChangeListener = (dialog, buttonPressed) -> {
|
DialogInterface.OnClickListener urlChangeListener = (dialog, buttonPressed) -> {
|
||||||
if (buttonPressed == DialogInterface.BUTTON_NEUTRAL) {
|
if (buttonPressed == DialogInterface.BUTTON_NEUTRAL) {
|
||||||
Settings.SB_API_URL.resetToDefault();
|
Settings.SB_API_URL.resetToDefault();
|
||||||
Utils.showToastLong(str("sb_api_url_reset"));
|
Utils.showToastLong(str("revanced_sb_api_url_reset"));
|
||||||
} else if (buttonPressed == DialogInterface.BUTTON_POSITIVE) {
|
} else if (buttonPressed == DialogInterface.BUTTON_POSITIVE) {
|
||||||
String serverAddress = editText.getText().toString();
|
String serverAddress = editText.getText().toString();
|
||||||
if (!SponsorBlockSettings.isValidSBServerAddress(serverAddress)) {
|
if (!SponsorBlockSettings.isValidSBServerAddress(serverAddress)) {
|
||||||
Utils.showToastLong(str("sb_api_url_invalid"));
|
Utils.showToastLong(str("revanced_sb_api_url_invalid"));
|
||||||
} else if (!serverAddress.equals(Settings.SB_API_URL.get())) {
|
} else if (!serverAddress.equals(Settings.SB_API_URL.get())) {
|
||||||
Settings.SB_API_URL.save(serverAddress);
|
Settings.SB_API_URL.save(serverAddress);
|
||||||
Utils.showToastLong(str("sb_api_url_changed"));
|
Utils.showToastLong(str("revanced_sb_api_url_changed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -356,7 +356,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
.setTitle(apiUrl.getTitle())
|
.setTitle(apiUrl.getTitle())
|
||||||
.setView(editText)
|
.setView(editText)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setNeutralButton(str("sb_reset"), urlChangeListener)
|
.setNeutralButton(str("revanced_sb_reset"), urlChangeListener)
|
||||||
.setPositiveButton(android.R.string.ok, urlChangeListener)
|
.setPositiveButton(android.R.string.ok, urlChangeListener)
|
||||||
.show();
|
.show();
|
||||||
return true;
|
return true;
|
||||||
@ -365,12 +365,12 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
importExport = new EditTextPreference(context) {
|
importExport = new EditTextPreference(context) {
|
||||||
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
||||||
builder.setNeutralButton(str("sb_settings_copy"), (dialog, which) -> {
|
builder.setNeutralButton(str("revanced_sb_settings_copy"), (dialog, which) -> {
|
||||||
Utils.setClipboard(getEditText().getText().toString());
|
Utils.setClipboard(getEditText().getText().toString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
importExport.setTitle(str("sb_settings_ie"));
|
importExport.setTitle(str("revanced_sb_settings_ie"));
|
||||||
// Summary is set in updateUI()
|
// Summary is set in updateUI()
|
||||||
importExport.getEditText().setInputType(InputType.TYPE_CLASS_TEXT
|
importExport.getEditText().setInputType(InputType.TYPE_CLASS_TEXT
|
||||||
| InputType.TYPE_TEXT_FLAG_MULTI_LINE
|
| InputType.TYPE_TEXT_FLAG_MULTI_LINE
|
||||||
@ -409,13 +409,13 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
private void addAboutCategory(Context context, PreferenceScreen screen) {
|
private void addAboutCategory(Context context, PreferenceScreen screen) {
|
||||||
PreferenceCategory category = new PreferenceCategory(context);
|
PreferenceCategory category = new PreferenceCategory(context);
|
||||||
screen.addPreference(category);
|
screen.addPreference(category);
|
||||||
category.setTitle(str("sb_about"));
|
category.setTitle(str("revanced_sb_about"));
|
||||||
|
|
||||||
{
|
{
|
||||||
Preference preference = new Preference(context);
|
Preference preference = new Preference(context);
|
||||||
category.addPreference(preference);
|
category.addPreference(preference);
|
||||||
preference.setTitle(str("sb_about_api"));
|
preference.setTitle(str("revanced_sb_about_api"));
|
||||||
preference.setSummary(str("sb_about_api_sum"));
|
preference.setSummary(str("revanced_sb_about_api_sum"));
|
||||||
preference.setOnPreferenceClickListener(preference1 -> {
|
preference.setOnPreferenceClickListener(preference1 -> {
|
||||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
i.setData(Uri.parse("https://sponsor.ajay.app"));
|
i.setData(Uri.parse("https://sponsor.ajay.app"));
|
||||||
@ -444,7 +444,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
loadingPlaceholderPreference.setEnabled(false);
|
loadingPlaceholderPreference.setEnabled(false);
|
||||||
statsCategory.addPreference(loadingPlaceholderPreference);
|
statsCategory.addPreference(loadingPlaceholderPreference);
|
||||||
if (Settings.SB_ENABLED.get()) {
|
if (Settings.SB_ENABLED.get()) {
|
||||||
loadingPlaceholderPreference.setTitle(str("sb_stats_loading"));
|
loadingPlaceholderPreference.setTitle(str("revanced_sb_stats_loading"));
|
||||||
Utils.runOnBackgroundThread(() -> {
|
Utils.runOnBackgroundThread(() -> {
|
||||||
UserStats stats = SBRequester.retrieveUserStats();
|
UserStats stats = SBRequester.retrieveUserStats();
|
||||||
Utils.runOnMainThread(() -> { // get back on main thread to modify UI elements
|
Utils.runOnMainThread(() -> { // get back on main thread to modify UI elements
|
||||||
@ -453,7 +453,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
loadingPlaceholderPreference.setTitle(str("sb_stats_sb_disabled"));
|
loadingPlaceholderPreference.setTitle(str("revanced_sb_stats_sb_disabled"));
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "fetchAndDisplayStats failure", ex);
|
Logger.printException(() -> "fetchAndDisplayStats failure", ex);
|
||||||
@ -464,7 +464,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
Utils.verifyOnMainThread();
|
Utils.verifyOnMainThread();
|
||||||
try {
|
try {
|
||||||
if (stats == null) {
|
if (stats == null) {
|
||||||
loadingPlaceholder.setTitle(str("sb_stats_connection_failure"));
|
loadingPlaceholder.setTitle(str("revanced_sb_stats_connection_failure"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
statsCategory.removeAll();
|
statsCategory.removeAll();
|
||||||
@ -475,8 +475,8 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
EditTextPreference preference = new EditTextPreference(context);
|
EditTextPreference preference = new EditTextPreference(context);
|
||||||
statsCategory.addPreference(preference);
|
statsCategory.addPreference(preference);
|
||||||
String userName = stats.userName;
|
String userName = stats.userName;
|
||||||
preference.setTitle(fromHtml(str("sb_stats_username", userName)));
|
preference.setTitle(fromHtml(str("revanced_sb_stats_username", userName)));
|
||||||
preference.setSummary(str("sb_stats_username_change"));
|
preference.setSummary(str("revanced_sb_stats_username_change"));
|
||||||
preference.setText(userName);
|
preference.setText(userName);
|
||||||
preference.setOnPreferenceChangeListener((preference1, value) -> {
|
preference.setOnPreferenceChangeListener((preference1, value) -> {
|
||||||
Utils.runOnBackgroundThread(() -> {
|
Utils.runOnBackgroundThread(() -> {
|
||||||
@ -484,9 +484,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
String errorMessage = SBRequester.setUsername(newUserName);
|
String errorMessage = SBRequester.setUsername(newUserName);
|
||||||
Utils.runOnMainThread(() -> {
|
Utils.runOnMainThread(() -> {
|
||||||
if (errorMessage == null) {
|
if (errorMessage == null) {
|
||||||
preference.setTitle(fromHtml(str("sb_stats_username", newUserName)));
|
preference.setTitle(fromHtml(str("revanced_sb_stats_username", newUserName)));
|
||||||
preference.setText(newUserName);
|
preference.setText(newUserName);
|
||||||
Utils.showToastLong(str("sb_stats_username_changed"));
|
Utils.showToastLong(str("revanced_sb_stats_username_changed"));
|
||||||
} else {
|
} else {
|
||||||
preference.setText(userName); // revert to previous
|
preference.setText(userName); // revert to previous
|
||||||
Utils.showToastLong(errorMessage);
|
Utils.showToastLong(errorMessage);
|
||||||
@ -502,7 +502,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
Preference preference = new Preference(context);
|
Preference preference = new Preference(context);
|
||||||
statsCategory.addPreference(preference);
|
statsCategory.addPreference(preference);
|
||||||
String formatted = SponsorBlockUtils.getNumberOfSkipsString(stats.segmentCount);
|
String formatted = SponsorBlockUtils.getNumberOfSkipsString(stats.segmentCount);
|
||||||
preference.setTitle(fromHtml(str("sb_stats_submissions", formatted)));
|
preference.setTitle(fromHtml(str("revanced_sb_stats_submissions", formatted)));
|
||||||
if (stats.totalSegmentCountIncludingIgnored == 0) {
|
if (stats.totalSegmentCountIncludingIgnored == 0) {
|
||||||
preference.setSelectable(false);
|
preference.setSelectable(false);
|
||||||
} else {
|
} else {
|
||||||
@ -519,7 +519,7 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
// "user reputation". Usually not useful, since it appears most users have zero reputation.
|
// "user reputation". Usually not useful, since it appears most users have zero reputation.
|
||||||
// But if there is a reputation, then show it here
|
// But if there is a reputation, then show it here
|
||||||
Preference preference = new Preference(context);
|
Preference preference = new Preference(context);
|
||||||
preference.setTitle(fromHtml(str("sb_stats_reputation", stats.reputation)));
|
preference.setTitle(fromHtml(str("revanced_sb_stats_reputation", stats.reputation)));
|
||||||
preference.setSelectable(false);
|
preference.setSelectable(false);
|
||||||
if (stats.reputation != 0) {
|
if (stats.reputation != 0) {
|
||||||
statsCategory.addPreference(preference);
|
statsCategory.addPreference(preference);
|
||||||
@ -534,12 +534,12 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
String stats_saved;
|
String stats_saved;
|
||||||
String stats_saved_sum;
|
String stats_saved_sum;
|
||||||
if (stats.totalSegmentCountIncludingIgnored == 0) {
|
if (stats.totalSegmentCountIncludingIgnored == 0) {
|
||||||
stats_saved = str("sb_stats_saved_zero");
|
stats_saved = str("revanced_sb_stats_saved_zero");
|
||||||
stats_saved_sum = str("sb_stats_saved_sum_zero");
|
stats_saved_sum = str("revanced_sb_stats_saved_sum_zero");
|
||||||
} else {
|
} else {
|
||||||
stats_saved = str("sb_stats_saved",
|
stats_saved = str("revanced_sb_stats_saved",
|
||||||
SponsorBlockUtils.getNumberOfSkipsString(stats.viewCount));
|
SponsorBlockUtils.getNumberOfSkipsString(stats.viewCount));
|
||||||
stats_saved_sum = str("sb_stats_saved_sum", SponsorBlockUtils.getTimeSavedString((long) (60 * stats.minutesSaved)));
|
stats_saved_sum = str("revanced_sb_stats_saved_sum", SponsorBlockUtils.getTimeSavedString((long) (60 * stats.minutesSaved)));
|
||||||
}
|
}
|
||||||
preference.setTitle(fromHtml(stats_saved));
|
preference.setTitle(fromHtml(stats_saved));
|
||||||
preference.setSummary(fromHtml(stats_saved_sum));
|
preference.setSummary(fromHtml(stats_saved_sum));
|
||||||
@ -562,14 +562,14 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
Runnable updateStatsSelfSaved = () -> {
|
Runnable updateStatsSelfSaved = () -> {
|
||||||
String formatted = SponsorBlockUtils.getNumberOfSkipsString(Settings.SB_LOCAL_TIME_SAVED_NUMBER_SEGMENTS.get());
|
String formatted = SponsorBlockUtils.getNumberOfSkipsString(Settings.SB_LOCAL_TIME_SAVED_NUMBER_SEGMENTS.get());
|
||||||
preference.setTitle(fromHtml(str("sb_stats_self_saved", formatted)));
|
preference.setTitle(fromHtml(str("revanced_sb_stats_self_saved", formatted)));
|
||||||
String formattedSaved = SponsorBlockUtils.getTimeSavedString(Settings.SB_LOCAL_TIME_SAVED_MILLISECONDS.get() / 1000);
|
String formattedSaved = SponsorBlockUtils.getTimeSavedString(Settings.SB_LOCAL_TIME_SAVED_MILLISECONDS.get() / 1000);
|
||||||
preference.setSummary(fromHtml(str("sb_stats_self_saved_sum", formattedSaved)));
|
preference.setSummary(fromHtml(str("revanced_sb_stats_self_saved_sum", formattedSaved)));
|
||||||
};
|
};
|
||||||
updateStatsSelfSaved.run();
|
updateStatsSelfSaved.run();
|
||||||
preference.setOnPreferenceClickListener(preference1 -> {
|
preference.setOnPreferenceClickListener(preference1 -> {
|
||||||
new AlertDialog.Builder(preference1.getContext())
|
new AlertDialog.Builder(preference1.getContext())
|
||||||
.setTitle(str("sb_stats_self_saved_reset_title"))
|
.setTitle(str("revanced_sb_stats_self_saved_reset_title"))
|
||||||
.setPositiveButton(android.R.string.yes, (dialog, whichButton) -> {
|
.setPositiveButton(android.R.string.yes, (dialog, whichButton) -> {
|
||||||
Settings.SB_LOCAL_TIME_SAVED_NUMBER_SEGMENTS.resetToDefault();
|
Settings.SB_LOCAL_TIME_SAVED_NUMBER_SEGMENTS.resetToDefault();
|
||||||
Settings.SB_LOCAL_TIME_SAVED_MILLISECONDS.resetToDefault();
|
Settings.SB_LOCAL_TIME_SAVED_MILLISECONDS.resetToDefault();
|
||||||
|
@ -602,7 +602,7 @@ public class SegmentPlaybackController {
|
|||||||
}
|
}
|
||||||
Utils.showToastShort(toastNumberOfSegmentsSkipped == 1
|
Utils.showToastShort(toastNumberOfSegmentsSkipped == 1
|
||||||
? toastSegmentSkipped.getSkippedToastText()
|
? toastSegmentSkipped.getSkippedToastText()
|
||||||
: str("sb_skipped_multiple_segments"));
|
: str("revanced_sb_skipped_multiple_segments"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "showSkippedSegmentToast failure", ex);
|
Logger.printException(() -> "showSkippedSegmentToast failure", ex);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -55,7 +55,7 @@ public class SponsorBlockSettings {
|
|||||||
final int desktopValue = categorySelectionObject.getInt("option");
|
final int desktopValue = categorySelectionObject.getInt("option");
|
||||||
CategoryBehaviour behaviour = CategoryBehaviour.byDesktopKeyValue(desktopValue);
|
CategoryBehaviour behaviour = CategoryBehaviour.byDesktopKeyValue(desktopValue);
|
||||||
if (behaviour == null) {
|
if (behaviour == null) {
|
||||||
Utils.showToastLong(categoryKey + " unknown desktop behavior value: " + desktopValue);
|
Utils.showToastLong(categoryKey + " unknown behavior key: " + categoryKey);
|
||||||
} else if (category == SegmentCategory.HIGHLIGHT && behaviour == CategoryBehaviour.SKIP_AUTOMATICALLY_ONCE) {
|
} else if (category == SegmentCategory.HIGHLIGHT && behaviour == CategoryBehaviour.SKIP_AUTOMATICALLY_ONCE) {
|
||||||
Utils.showToastLong("Skip-once behavior not allowed for " + category.keyValue);
|
Utils.showToastLong("Skip-once behavior not allowed for " + category.keyValue);
|
||||||
category.setBehaviour(CategoryBehaviour.SKIP_AUTOMATICALLY); // use closest match
|
category.setBehaviour(CategoryBehaviour.SKIP_AUTOMATICALLY); // use closest match
|
||||||
@ -104,10 +104,10 @@ public class SponsorBlockSettings {
|
|||||||
Settings.SB_LOCAL_TIME_SAVED_MILLISECONDS.save((long) (minutesSaved * 60 * 1000));
|
Settings.SB_LOCAL_TIME_SAVED_MILLISECONDS.save((long) (minutesSaved * 60 * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.showToastLong(str("sb_settings_import_successful"));
|
Utils.showToastLong(str("revanced_sb_settings_import_successful"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printInfo(() -> "failed to import settings", ex); // use info level, as we are showing our own toast
|
Logger.printInfo(() -> "failed to import settings", ex); // use info level, as we are showing our own toast
|
||||||
Utils.showToastLong(str("sb_settings_import_failed", ex.getMessage()));
|
Utils.showToastLong(str("revanced_sb_settings_import_failed", ex.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public class SponsorBlockSettings {
|
|||||||
return json.toString(2);
|
return json.toString(2);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printInfo(() -> "failed to export settings", ex); // use info level, as we are showing our own toast
|
Logger.printInfo(() -> "failed to export settings", ex); // use info level, as we are showing our own toast
|
||||||
Utils.showToastLong(str("sb_settings_export_failed", ex));
|
Utils.showToastLong(str("revanced_sb_settings_export_failed", ex));
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,8 +169,8 @@ public class SponsorBlockSettings {
|
|||||||
if (dialogContext != null && SponsorBlockSettings.userHasSBPrivateId()
|
if (dialogContext != null && SponsorBlockSettings.userHasSBPrivateId()
|
||||||
&& !Settings.SB_HIDE_EXPORT_WARNING.get()) {
|
&& !Settings.SB_HIDE_EXPORT_WARNING.get()) {
|
||||||
new AlertDialog.Builder(dialogContext)
|
new AlertDialog.Builder(dialogContext)
|
||||||
.setMessage(str("sb_settings_revanced_export_user_id_warning"))
|
.setMessage(str("revanced_sb_settings_revanced_export_user_id_warning"))
|
||||||
.setNeutralButton(str("sb_settings_revanced_export_user_id_warning_dismiss"),
|
.setNeutralButton(str("revanced_sb_settings_revanced_export_user_id_warning_dismiss"),
|
||||||
(dialog, which) -> Settings.SB_HIDE_EXPORT_WARNING.save(true))
|
(dialog, which) -> Settings.SB_HIDE_EXPORT_WARNING.save(true))
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
|
@ -76,7 +76,7 @@ public class SponsorBlockUtils {
|
|||||||
SegmentCategory category = SegmentCategory.categoriesWithoutHighlights()[which];
|
SegmentCategory category = SegmentCategory.categoriesWithoutHighlights()[which];
|
||||||
final boolean enableButton;
|
final boolean enableButton;
|
||||||
if (category.behaviour == CategoryBehaviour.IGNORE) {
|
if (category.behaviour == CategoryBehaviour.IGNORE) {
|
||||||
Utils.showToastLong(str("sb_new_segment_disabled_category"));
|
Utils.showToastLong(str("revanced_sb_new_segment_disabled_category"));
|
||||||
enableButton = false;
|
enableButton = false;
|
||||||
} else {
|
} else {
|
||||||
newUserCreatedSegmentCategory = category;
|
newUserCreatedSegmentCategory = category;
|
||||||
@ -107,7 +107,7 @@ public class SponsorBlockUtils {
|
|||||||
|
|
||||||
newUserCreatedSegmentCategory = null;
|
newUserCreatedSegmentCategory = null;
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(context)
|
||||||
.setTitle(str("sb_new_segment_choose_category"))
|
.setTitle(str("revanced_sb_new_segment_choose_category"))
|
||||||
.setSingleChoiceItems(titles, -1, segmentTypeListener)
|
.setSingleChoiceItems(titles, -1, segmentTypeListener)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setPositiveButton(android.R.string.ok, segmentCategorySelectedDialogListener)
|
.setPositiveButton(android.R.string.ok, segmentCategorySelectedDialogListener)
|
||||||
@ -143,10 +143,10 @@ public class SponsorBlockUtils {
|
|||||||
editByHandSaveDialogListener.settingStart = isStart;
|
editByHandSaveDialogListener.settingStart = isStart;
|
||||||
editByHandSaveDialogListener.editText = new WeakReference<>(textView);
|
editByHandSaveDialogListener.editText = new WeakReference<>(textView);
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(context)
|
||||||
.setTitle(str(isStart ? "sb_new_segment_time_start" : "sb_new_segment_time_end"))
|
.setTitle(str(isStart ? "revanced_sb_new_segment_time_start" : "revanced_sb_new_segment_time_end"))
|
||||||
.setView(textView)
|
.setView(textView)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setNeutralButton(str("sb_new_segment_now"), editByHandSaveDialogListener)
|
.setNeutralButton(str("revanced_sb_new_segment_now"), editByHandSaveDialogListener)
|
||||||
.setPositiveButton(android.R.string.ok, editByHandSaveDialogListener)
|
.setPositiveButton(android.R.string.ok, editByHandSaveDialogListener)
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
@ -241,14 +241,14 @@ public class SponsorBlockUtils {
|
|||||||
newSponsorSegmentDialogShownMillis = VideoInformation.getVideoTime();
|
newSponsorSegmentDialogShownMillis = VideoInformation.getVideoTime();
|
||||||
|
|
||||||
new AlertDialog.Builder(SponsorBlockViewController.getOverLaysViewGroupContext())
|
new AlertDialog.Builder(SponsorBlockViewController.getOverLaysViewGroupContext())
|
||||||
.setTitle(str("sb_new_segment_title"))
|
.setTitle(str("revanced_sb_new_segment_title"))
|
||||||
.setMessage(str("sb_new_segment_mark_time_as_question",
|
.setMessage(str("revanced_sb_new_segment_mark_time_as_question",
|
||||||
newSponsorSegmentDialogShownMillis / 60000,
|
newSponsorSegmentDialogShownMillis / 60000,
|
||||||
newSponsorSegmentDialogShownMillis / 1000 % 60,
|
newSponsorSegmentDialogShownMillis / 1000 % 60,
|
||||||
newSponsorSegmentDialogShownMillis % 1000))
|
newSponsorSegmentDialogShownMillis % 1000))
|
||||||
.setNeutralButton(android.R.string.cancel, null)
|
.setNeutralButton(android.R.string.cancel, null)
|
||||||
.setNegativeButton(str("sb_new_segment_mark_start"), newSponsorSegmentDialogListener)
|
.setNegativeButton(str("revanced_sb_new_segment_mark_start"), newSponsorSegmentDialogListener)
|
||||||
.setPositiveButton(str("sb_new_segment_mark_end"), newSponsorSegmentDialogListener)
|
.setPositiveButton(str("revanced_sb_new_segment_mark_end"), newSponsorSegmentDialogListener)
|
||||||
.show();
|
.show();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "onMarkLocationClicked failure", ex);
|
Logger.printException(() -> "onMarkLocationClicked failure", ex);
|
||||||
@ -259,18 +259,18 @@ public class SponsorBlockUtils {
|
|||||||
try {
|
try {
|
||||||
Utils.verifyOnMainThread();
|
Utils.verifyOnMainThread();
|
||||||
if (newSponsorSegmentStartMillis < 0 || newSponsorSegmentEndMillis < 0) {
|
if (newSponsorSegmentStartMillis < 0 || newSponsorSegmentEndMillis < 0) {
|
||||||
Utils.showToastShort(str("sb_new_segment_mark_locations_first"));
|
Utils.showToastShort(str("revanced_sb_new_segment_mark_locations_first"));
|
||||||
} else if (newSponsorSegmentStartMillis >= newSponsorSegmentEndMillis) {
|
} else if (newSponsorSegmentStartMillis >= newSponsorSegmentEndMillis) {
|
||||||
Utils.showToastShort(str("sb_new_segment_start_is_before_end"));
|
Utils.showToastShort(str("revanced_sb_new_segment_start_is_before_end"));
|
||||||
} else if (!newSponsorSegmentPreviewed && newSponsorSegmentStartMillis != 0) {
|
} else if (!newSponsorSegmentPreviewed && newSponsorSegmentStartMillis != 0) {
|
||||||
Utils.showToastLong(str("sb_new_segment_preview_segment_first"));
|
Utils.showToastLong(str("revanced_sb_new_segment_preview_segment_first"));
|
||||||
} else {
|
} else {
|
||||||
long length = (newSponsorSegmentEndMillis - newSponsorSegmentStartMillis) / 1000;
|
long length = (newSponsorSegmentEndMillis - newSponsorSegmentStartMillis) / 1000;
|
||||||
long start = (newSponsorSegmentStartMillis) / 1000;
|
long start = (newSponsorSegmentStartMillis) / 1000;
|
||||||
long end = (newSponsorSegmentEndMillis) / 1000;
|
long end = (newSponsorSegmentEndMillis) / 1000;
|
||||||
new AlertDialog.Builder(SponsorBlockViewController.getOverLaysViewGroupContext())
|
new AlertDialog.Builder(SponsorBlockViewController.getOverLaysViewGroupContext())
|
||||||
.setTitle(str("sb_new_segment_confirm_title"))
|
.setTitle(str("revanced_sb_new_segment_confirm_title"))
|
||||||
.setMessage(str("sb_new_segment_confirm_content",
|
.setMessage(str("revanced_sb_new_segment_confirm_content",
|
||||||
start / 60, start % 60,
|
start / 60, start % 60,
|
||||||
end / 60, end % 60,
|
end / 60, end % 60,
|
||||||
length / 60, length % 60))
|
length / 60, length % 60))
|
||||||
@ -291,7 +291,7 @@ public class SponsorBlockUtils {
|
|||||||
// Button is hidden if no segments exist.
|
// Button is hidden if no segments exist.
|
||||||
// But if prior video had segments, and current video does not,
|
// But if prior video had segments, and current video does not,
|
||||||
// then the button persists until the overlay fades out (this is intentional, as abruptly hiding the button is jarring).
|
// then the button persists until the overlay fades out (this is intentional, as abruptly hiding the button is jarring).
|
||||||
Utils.showToastShort(str("sb_vote_no_segments"));
|
Utils.showToastShort(str("revanced_sb_vote_no_segments"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ public class SponsorBlockUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(context)
|
||||||
.setTitle(str("sb_new_segment_choose_category"))
|
.setTitle(str("revanced_sb_new_segment_choose_category"))
|
||||||
.setItems(titles, (dialog, which) -> SBRequester.voteToChangeCategoryOnBackgroundThread(segment, values[which]))
|
.setItems(titles, (dialog, which) -> SBRequester.voteToChangeCategoryOnBackgroundThread(segment, values[which]))
|
||||||
.show();
|
.show();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@ -359,9 +359,9 @@ public class SponsorBlockUtils {
|
|||||||
try {
|
try {
|
||||||
Utils.verifyOnMainThread();
|
Utils.verifyOnMainThread();
|
||||||
if (newSponsorSegmentStartMillis < 0 || newSponsorSegmentEndMillis < 0) {
|
if (newSponsorSegmentStartMillis < 0 || newSponsorSegmentEndMillis < 0) {
|
||||||
Utils.showToastShort(str("sb_new_segment_mark_locations_first"));
|
Utils.showToastShort(str("revanced_sb_new_segment_mark_locations_first"));
|
||||||
} else if (newSponsorSegmentStartMillis >= newSponsorSegmentEndMillis) {
|
} else if (newSponsorSegmentStartMillis >= newSponsorSegmentEndMillis) {
|
||||||
Utils.showToastShort(str("sb_new_segment_start_is_before_end"));
|
Utils.showToastShort(str("revanced_sb_new_segment_start_is_before_end"));
|
||||||
} else {
|
} else {
|
||||||
SegmentPlaybackController.removeUnsubmittedSegments(); // If user hits preview more than once before playing.
|
SegmentPlaybackController.removeUnsubmittedSegments(); // If user hits preview more than once before playing.
|
||||||
SegmentPlaybackController.addUnsubmittedSegment(
|
SegmentPlaybackController.addUnsubmittedSegment(
|
||||||
@ -393,11 +393,11 @@ public class SponsorBlockUtils {
|
|||||||
try {
|
try {
|
||||||
Utils.verifyOnMainThread();
|
Utils.verifyOnMainThread();
|
||||||
new AlertDialog.Builder(SponsorBlockViewController.getOverLaysViewGroupContext())
|
new AlertDialog.Builder(SponsorBlockViewController.getOverLaysViewGroupContext())
|
||||||
.setTitle(str("sb_new_segment_edit_by_hand_title"))
|
.setTitle(str("revanced_sb_new_segment_edit_by_hand_title"))
|
||||||
.setMessage(str("sb_new_segment_edit_by_hand_content"))
|
.setMessage(str("revanced_sb_new_segment_edit_by_hand_content"))
|
||||||
.setNeutralButton(android.R.string.cancel, null)
|
.setNeutralButton(android.R.string.cancel, null)
|
||||||
.setNegativeButton(str("sb_new_segment_mark_start"), editByHandDialogListener)
|
.setNegativeButton(str("revanced_sb_new_segment_mark_start"), editByHandDialogListener)
|
||||||
.setPositiveButton(str("sb_new_segment_mark_end"), editByHandDialogListener)
|
.setPositiveButton(str("revanced_sb_new_segment_mark_end"), editByHandDialogListener)
|
||||||
.show();
|
.show();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "onEditByHandClicked failure", ex);
|
Logger.printException(() -> "onEditByHandClicked failure", ex);
|
||||||
@ -417,14 +417,14 @@ public class SponsorBlockUtils {
|
|||||||
String minutesFormatted = statsNumberFormatter.format(minutes);
|
String minutesFormatted = statsNumberFormatter.format(minutes);
|
||||||
if (hours > 0) {
|
if (hours > 0) {
|
||||||
String hoursFormatted = statsNumberFormatter.format(hours);
|
String hoursFormatted = statsNumberFormatter.format(hours);
|
||||||
return str("sb_stats_saved_hour_format", hoursFormatted, minutesFormatted);
|
return str("revanced_sb_stats_saved_hour_format", hoursFormatted, minutesFormatted);
|
||||||
}
|
}
|
||||||
final long seconds = duration.getSeconds() % 60;
|
final long seconds = duration.getSeconds() % 60;
|
||||||
String secondsFormatted = statsNumberFormatter.format(seconds);
|
String secondsFormatted = statsNumberFormatter.format(seconds);
|
||||||
if (minutes > 0) {
|
if (minutes > 0) {
|
||||||
return str("sb_stats_saved_minute_format", minutesFormatted, secondsFormatted);
|
return str("revanced_sb_stats_saved_minute_format", minutesFormatted, secondsFormatted);
|
||||||
}
|
}
|
||||||
return str("sb_stats_saved_second_format", secondsFormatted);
|
return str("revanced_sb_stats_saved_second_format", secondsFormatted);
|
||||||
}
|
}
|
||||||
return "error"; // will never be reached. YouTube requires Android O or greater
|
return "error"; // will never be reached. YouTube requires Android O or greater
|
||||||
}
|
}
|
||||||
@ -453,7 +453,7 @@ public class SponsorBlockUtils {
|
|||||||
DialogInterface.BUTTON_NEGATIVE :
|
DialogInterface.BUTTON_NEGATIVE :
|
||||||
DialogInterface.BUTTON_POSITIVE);
|
DialogInterface.BUTTON_POSITIVE);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
Utils.showToastLong(str("sb_new_segment_edit_by_hand_parse_error"));
|
Utils.showToastLong(str("revanced_sb_new_segment_edit_by_hand_parse_error"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "EditByHandSaveDialogListener failure", ex);
|
Logger.printException(() -> "EditByHandSaveDialogListener failure", ex);
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ import app.revanced.integrations.shared.Utils;
|
|||||||
import app.revanced.integrations.shared.StringRef;
|
import app.revanced.integrations.shared.StringRef;
|
||||||
|
|
||||||
public enum CategoryBehaviour {
|
public enum CategoryBehaviour {
|
||||||
SKIP_AUTOMATICALLY("skip", 2, true, sf("sb_skip_automatically")),
|
SKIP_AUTOMATICALLY("skip", 2, true, sf("revanced_sb_skip_automatically")),
|
||||||
// desktop does not have skip-once behavior. Key is unique to ReVanced
|
// desktop does not have skip-once behavior. Key is unique to ReVanced
|
||||||
SKIP_AUTOMATICALLY_ONCE("skip-once", 3, true, sf("sb_skip_automatically_once")),
|
SKIP_AUTOMATICALLY_ONCE("skip-once", 3, true, sf("revanced_sb_skip_automatically_once")),
|
||||||
MANUAL_SKIP("manual-skip", 1, false, sf("sb_skip_showbutton")),
|
MANUAL_SKIP("manual-skip", 1, false, sf("revanced_sb_skip_showbutton")),
|
||||||
SHOW_IN_SEEKBAR("seekbar-only", 0, false, sf("sb_skip_seekbaronly")),
|
SHOW_IN_SEEKBAR("seekbar-only", 0, false, sf("revanced_sb_skip_seekbaronly")),
|
||||||
// ignored categories are not exported to json, and ignore is the default behavior when importing
|
// ignored categories are not exported to json, and ignore is the default behavior when importing
|
||||||
IGNORE("ignore", -1, false, sf("sb_skip_ignore"));
|
IGNORE("ignore", -1, false, sf("revanced_sb_skip_ignore"));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReVanced specific value.
|
* ReVanced specific value.
|
||||||
|
@ -25,36 +25,36 @@ import app.revanced.integrations.shared.Logger;
|
|||||||
import app.revanced.integrations.shared.StringRef;
|
import app.revanced.integrations.shared.StringRef;
|
||||||
|
|
||||||
public enum SegmentCategory {
|
public enum SegmentCategory {
|
||||||
SPONSOR("sponsor", sf("sb_segments_sponsor"), sf("sb_segments_sponsor_sum"), sf("sb_skip_button_sponsor"), sf("sb_skipped_sponsor"),
|
SPONSOR("sponsor", sf("revanced_sb_segments_sponsor"), sf("revanced_sb_segments_sponsor_sum"), sf("revanced_sb_skip_button_sponsor"), sf("revanced_sb_skipped_sponsor"),
|
||||||
SB_CATEGORY_SPONSOR, SB_CATEGORY_SPONSOR_COLOR),
|
SB_CATEGORY_SPONSOR, SB_CATEGORY_SPONSOR_COLOR),
|
||||||
SELF_PROMO("selfpromo", sf("sb_segments_selfpromo"), sf("sb_segments_selfpromo_sum"), sf("sb_skip_button_selfpromo"), sf("sb_skipped_selfpromo"),
|
SELF_PROMO("selfpromo", sf("revanced_sb_segments_selfpromo"), sf("revanced_sb_segments_selfpromo_sum"), sf("revanced_sb_skip_button_selfpromo"), sf("revanced_sb_skipped_selfpromo"),
|
||||||
SB_CATEGORY_SELF_PROMO, SB_CATEGORY_SELF_PROMO_COLOR),
|
SB_CATEGORY_SELF_PROMO, SB_CATEGORY_SELF_PROMO_COLOR),
|
||||||
INTERACTION("interaction", sf("sb_segments_interaction"), sf("sb_segments_interaction_sum"), sf("sb_skip_button_interaction"), sf("sb_skipped_interaction"),
|
INTERACTION("interaction", sf("revanced_sb_segments_interaction"), sf("revanced_sb_segments_interaction_sum"), sf("revanced_sb_skip_button_interaction"), sf("revanced_sb_skipped_interaction"),
|
||||||
SB_CATEGORY_INTERACTION, SB_CATEGORY_INTERACTION_COLOR),
|
SB_CATEGORY_INTERACTION, SB_CATEGORY_INTERACTION_COLOR),
|
||||||
/**
|
/**
|
||||||
* Unique category that is treated differently than the rest.
|
* Unique category that is treated differently than the rest.
|
||||||
*/
|
*/
|
||||||
HIGHLIGHT("poi_highlight", sf("sb_segments_highlight"), sf("sb_segments_highlight_sum"), sf("sb_skip_button_highlight"), sf("sb_skipped_highlight"),
|
HIGHLIGHT("poi_highlight", sf("revanced_sb_segments_highlight"), sf("revanced_sb_segments_highlight_sum"), sf("revanced_sb_skip_button_highlight"), sf("revanced_sb_skipped_highlight"),
|
||||||
SB_CATEGORY_HIGHLIGHT, SB_CATEGORY_HIGHLIGHT_COLOR),
|
SB_CATEGORY_HIGHLIGHT, SB_CATEGORY_HIGHLIGHT_COLOR),
|
||||||
INTRO("intro", sf("sb_segments_intro"), sf("sb_segments_intro_sum"),
|
INTRO("intro", sf("revanced_sb_segments_intro"), sf("revanced_sb_segments_intro_sum"),
|
||||||
sf("sb_skip_button_intro_beginning"), sf("sb_skip_button_intro_middle"), sf("sb_skip_button_intro_end"),
|
sf("revanced_sb_skip_button_intro_beginning"), sf("revanced_sb_skip_button_intro_middle"), sf("revanced_sb_skip_button_intro_end"),
|
||||||
sf("sb_skipped_intro_beginning"), sf("sb_skipped_intro_middle"), sf("sb_skipped_intro_end"),
|
sf("revanced_sb_skipped_intro_beginning"), sf("revanced_sb_skipped_intro_middle"), sf("revanced_sb_skipped_intro_end"),
|
||||||
SB_CATEGORY_INTRO, SB_CATEGORY_INTRO_COLOR),
|
SB_CATEGORY_INTRO, SB_CATEGORY_INTRO_COLOR),
|
||||||
OUTRO("outro", sf("sb_segments_outro"), sf("sb_segments_outro_sum"), sf("sb_skip_button_outro"), sf("sb_skipped_outro"),
|
OUTRO("outro", sf("revanced_sb_segments_outro"), sf("revanced_sb_segments_outro_sum"), sf("revanced_sb_skip_button_outro"), sf("revanced_sb_skipped_outro"),
|
||||||
SB_CATEGORY_OUTRO, SB_CATEGORY_OUTRO_COLOR),
|
SB_CATEGORY_OUTRO, SB_CATEGORY_OUTRO_COLOR),
|
||||||
PREVIEW("preview", sf("sb_segments_preview"), sf("sb_segments_preview_sum"),
|
PREVIEW("preview", sf("revanced_sb_segments_preview"), sf("revanced_sb_segments_preview_sum"),
|
||||||
sf("sb_skip_button_preview_beginning"), sf("sb_skip_button_preview_middle"), sf("sb_skip_button_preview_end"),
|
sf("revanced_sb_skip_button_preview_beginning"), sf("revanced_sb_skip_button_preview_middle"), sf("revanced_sb_skip_button_preview_end"),
|
||||||
sf("sb_skipped_preview_beginning"), sf("sb_skipped_preview_middle"), sf("sb_skipped_preview_end"),
|
sf("revanced_sb_skipped_preview_beginning"), sf("revanced_sb_skipped_preview_middle"), sf("revanced_sb_skipped_preview_end"),
|
||||||
SB_CATEGORY_PREVIEW, SB_CATEGORY_PREVIEW_COLOR),
|
SB_CATEGORY_PREVIEW, SB_CATEGORY_PREVIEW_COLOR),
|
||||||
FILLER("filler", sf("sb_segments_filler"), sf("sb_segments_filler_sum"), sf("sb_skip_button_filler"), sf("sb_skipped_filler"),
|
FILLER("filler", sf("revanced_sb_segments_filler"), sf("revanced_sb_segments_filler_sum"), sf("revanced_sb_skip_button_filler"), sf("revanced_sb_skipped_filler"),
|
||||||
SB_CATEGORY_FILLER, SB_CATEGORY_FILLER_COLOR),
|
SB_CATEGORY_FILLER, SB_CATEGORY_FILLER_COLOR),
|
||||||
MUSIC_OFFTOPIC("music_offtopic", sf("sb_segments_nomusic"), sf("sb_segments_nomusic_sum"), sf("sb_skip_button_nomusic"), sf("sb_skipped_nomusic"),
|
MUSIC_OFFTOPIC("music_offtopic", sf("revanced_sb_segments_nomusic"), sf("revanced_sb_segments_nomusic_sum"), sf("revanced_sb_skip_button_nomusic"), sf("revanced_sb_skipped_nomusic"),
|
||||||
SB_CATEGORY_MUSIC_OFFTOPIC, SB_CATEGORY_MUSIC_OFFTOPIC_COLOR),
|
SB_CATEGORY_MUSIC_OFFTOPIC, SB_CATEGORY_MUSIC_OFFTOPIC_COLOR),
|
||||||
UNSUBMITTED("unsubmitted", StringRef.empty, StringRef.empty, sf("sb_skip_button_unsubmitted"), sf("sb_skipped_unsubmitted"),
|
UNSUBMITTED("unsubmitted", StringRef.empty, StringRef.empty, sf("revanced_sb_skip_button_unsubmitted"), sf("revanced_sb_skipped_unsubmitted"),
|
||||||
SB_CATEGORY_UNSUBMITTED, SB_CATEGORY_UNSUBMITTED_COLOR),;
|
SB_CATEGORY_UNSUBMITTED, SB_CATEGORY_UNSUBMITTED_COLOR),;
|
||||||
|
|
||||||
private static final StringRef skipSponsorTextCompact = sf("sb_skip_button_compact");
|
private static final StringRef skipSponsorTextCompact = sf("revanced_sb_skip_button_compact");
|
||||||
private static final StringRef skipSponsorTextCompactHighlight = sf("sb_skip_button_compact_highlight");
|
private static final StringRef skipSponsorTextCompactHighlight = sf("revanced_sb_skip_button_compact_highlight");
|
||||||
|
|
||||||
private static final SegmentCategory[] categoriesWithoutHighlights = new SegmentCategory[]{
|
private static final SegmentCategory[] categoriesWithoutHighlights = new SegmentCategory[]{
|
||||||
SPONSOR,
|
SPONSOR,
|
||||||
|
@ -53,7 +53,7 @@ public class SegmentCategoryListPreference extends ListPreference {
|
|||||||
TableRow row = new TableRow(context);
|
TableRow row = new TableRow(context);
|
||||||
|
|
||||||
TextView colorTextLabel = new TextView(context);
|
TextView colorTextLabel = new TextView(context);
|
||||||
colorTextLabel.setText(str("sb_color_dot_label"));
|
colorTextLabel.setText(str("revanced_sb_color_dot_label"));
|
||||||
row.addView(colorTextLabel);
|
row.addView(colorTextLabel);
|
||||||
|
|
||||||
TextView colorDotView = new TextView(context);
|
TextView colorDotView = new TextView(context);
|
||||||
@ -102,11 +102,11 @@ public class SegmentCategoryListPreference extends ListPreference {
|
|||||||
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||||
onClick(dialog, DialogInterface.BUTTON_POSITIVE);
|
onClick(dialog, DialogInterface.BUTTON_POSITIVE);
|
||||||
});
|
});
|
||||||
builder.setNeutralButton(str("sb_reset_color"), (dialog, which) -> {
|
builder.setNeutralButton(str("revanced_sb_reset_color"), (dialog, which) -> {
|
||||||
try {
|
try {
|
||||||
category.resetColor();
|
category.resetColor();
|
||||||
updateTitle();
|
updateTitle();
|
||||||
Utils.showToastShort(str("sb_color_reset"));
|
Utils.showToastShort(str("revanced_sb_color_reset"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "setNeutralButton failure", ex);
|
Logger.printException(() -> "setNeutralButton failure", ex);
|
||||||
}
|
}
|
||||||
@ -134,10 +134,10 @@ public class SegmentCategoryListPreference extends ListPreference {
|
|||||||
try {
|
try {
|
||||||
if (!colorString.equals(category.colorString())) {
|
if (!colorString.equals(category.colorString())) {
|
||||||
category.setColor(colorString);
|
category.setColor(colorString);
|
||||||
Utils.showToastShort(str("sb_color_changed"));
|
Utils.showToastShort(str("revanced_sb_color_changed"));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
Utils.showToastShort(str("sb_color_invalid"));
|
Utils.showToastShort(str("revanced_sb_color_invalid"));
|
||||||
}
|
}
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ import static app.revanced.integrations.shared.StringRef.sf;
|
|||||||
|
|
||||||
public class SponsorSegment implements Comparable<SponsorSegment> {
|
public class SponsorSegment implements Comparable<SponsorSegment> {
|
||||||
public enum SegmentVote {
|
public enum SegmentVote {
|
||||||
UPVOTE(sf("sb_vote_upvote"), 1,false),
|
UPVOTE(sf("revanced_sb_vote_upvote"), 1,false),
|
||||||
DOWNVOTE(sf("sb_vote_downvote"), 0, true),
|
DOWNVOTE(sf("revanced_sb_vote_downvote"), 0, true),
|
||||||
CATEGORY_CHANGE(sf("sb_vote_category"), -1, true); // apiVoteType is not used for category change
|
CATEGORY_CHANGE(sf("revanced_sb_vote_category"), -1, true); // apiVoteType is not used for category change
|
||||||
|
|
||||||
public static final SegmentVote[] voteTypesWithoutCategoryChange = {
|
public static final SegmentVote[] voteTypesWithoutCategoryChange = {
|
||||||
UPVOTE,
|
UPVOTE,
|
||||||
|
@ -97,13 +97,13 @@ public class SBRequester {
|
|||||||
// no segments are found. a normal response
|
// no segments are found. a normal response
|
||||||
Logger.printDebug(() -> "No segments found for video: " + videoId);
|
Logger.printDebug(() -> "No segments found for video: " + videoId);
|
||||||
} else {
|
} else {
|
||||||
handleConnectionError(str("sb_sponsorblock_connection_failure_status", responseCode), null);
|
handleConnectionError(str("revanced_sb_sponsorblock_connection_failure_status", responseCode), null);
|
||||||
connection.disconnect(); // something went wrong, might as well disconnect
|
connection.disconnect(); // something went wrong, might as well disconnect
|
||||||
}
|
}
|
||||||
} catch (SocketTimeoutException ex) {
|
} catch (SocketTimeoutException ex) {
|
||||||
handleConnectionError(str("sb_sponsorblock_connection_failure_timeout"), ex);
|
handleConnectionError(str("revanced_sb_sponsorblock_connection_failure_timeout"), ex);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
handleConnectionError(str("sb_sponsorblock_connection_failure_generic"), ex);
|
handleConnectionError(str("revanced_sb_sponsorblock_connection_failure_generic"), ex);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// Should never happen
|
// Should never happen
|
||||||
Logger.printException(() -> "getSegments failure", ex);
|
Logger.printException(() -> "getSegments failure", ex);
|
||||||
@ -153,30 +153,30 @@ public class SBRequester {
|
|||||||
final String messageToToast;
|
final String messageToToast;
|
||||||
switch (responseCode) {
|
switch (responseCode) {
|
||||||
case HTTP_STATUS_CODE_SUCCESS:
|
case HTTP_STATUS_CODE_SUCCESS:
|
||||||
messageToToast = str("sb_submit_succeeded");
|
messageToToast = str("revanced_sb_submit_succeeded");
|
||||||
break;
|
break;
|
||||||
case 409:
|
case 409:
|
||||||
messageToToast = str("sb_submit_failed_duplicate");
|
messageToToast = str("revanced_sb_submit_failed_duplicate");
|
||||||
break;
|
break;
|
||||||
case 403:
|
case 403:
|
||||||
messageToToast = str("sb_submit_failed_forbidden", Requester.parseErrorJsonAndDisconnect(connection));
|
messageToToast = str("revanced_sb_submit_failed_forbidden", Requester.parseErrorJsonAndDisconnect(connection));
|
||||||
break;
|
break;
|
||||||
case 429:
|
case 429:
|
||||||
messageToToast = str("sb_submit_failed_rate_limit");
|
messageToToast = str("revanced_sb_submit_failed_rate_limit");
|
||||||
break;
|
break;
|
||||||
case 400:
|
case 400:
|
||||||
messageToToast = str("sb_submit_failed_invalid", Requester.parseErrorJsonAndDisconnect(connection));
|
messageToToast = str("revanced_sb_submit_failed_invalid", Requester.parseErrorJsonAndDisconnect(connection));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
messageToToast = str("sb_submit_failed_unknown_error", responseCode, connection.getResponseMessage());
|
messageToToast = str("revanced_sb_submit_failed_unknown_error", responseCode, connection.getResponseMessage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Utils.showToastLong(messageToToast);
|
Utils.showToastLong(messageToToast);
|
||||||
} catch (SocketTimeoutException ex) {
|
} catch (SocketTimeoutException ex) {
|
||||||
// Always show, even if show connection toasts is turned off
|
// Always show, even if show connection toasts is turned off
|
||||||
Utils.showToastLong(str("sb_submit_failed_timeout"));
|
Utils.showToastLong(str("revanced_sb_submit_failed_timeout"));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Utils.showToastLong(str("sb_submit_failed_unknown_error", 0, ex.getMessage()));
|
Utils.showToastLong(str("revanced_sb_submit_failed_unknown_error", 0, ex.getMessage()));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "failed to submit segments", ex);
|
Logger.printException(() -> "failed to submit segments", ex);
|
||||||
}
|
}
|
||||||
@ -223,17 +223,17 @@ public class SBRequester {
|
|||||||
break;
|
break;
|
||||||
case 403:
|
case 403:
|
||||||
Utils.showToastLong(
|
Utils.showToastLong(
|
||||||
str("sb_vote_failed_forbidden", Requester.parseErrorJsonAndDisconnect(connection)));
|
str("revanced_sb_vote_failed_forbidden", Requester.parseErrorJsonAndDisconnect(connection)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Utils.showToastLong(
|
Utils.showToastLong(
|
||||||
str("sb_vote_failed_unknown_error", responseCode, connection.getResponseMessage()));
|
str("revanced_sb_vote_failed_unknown_error", responseCode, connection.getResponseMessage()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (SocketTimeoutException ex) {
|
} catch (SocketTimeoutException ex) {
|
||||||
Utils.showToastShort(str("sb_vote_failed_timeout"));
|
Utils.showToastShort(str("revanced_sb_vote_failed_timeout"));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Utils.showToastShort(str("sb_vote_failed_unknown_error", 0, ex.getMessage()));
|
Utils.showToastShort(str("revanced_sb_vote_failed_unknown_error", 0, ex.getMessage()));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.printException(() -> "failed to vote for segment", ex); // should never happen
|
Logger.printException(() -> "failed to vote for segment", ex); // should never happen
|
||||||
}
|
}
|
||||||
@ -271,10 +271,10 @@ public class SBRequester {
|
|||||||
if (responseCode == HTTP_STATUS_CODE_SUCCESS) {
|
if (responseCode == HTTP_STATUS_CODE_SUCCESS) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return str("sb_stats_username_change_unknown_error", responseCode, responseMessage);
|
return str("revanced_sb_stats_username_change_unknown_error", responseCode, responseMessage);
|
||||||
} catch (Exception ex) { // should never happen
|
} catch (Exception ex) { // should never happen
|
||||||
Logger.printInfo(() -> "failed to set username", ex); // do not toast
|
Logger.printInfo(() -> "failed to set username", ex); // do not toast
|
||||||
return str("sb_stats_username_change_unknown_error", 0, ex.getMessage());
|
return str("revanced_sb_stats_username_change_unknown_error", 0, ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class CreateSegmentButtonController {
|
|||||||
try {
|
try {
|
||||||
Logger.printDebug(() -> "initializing new segment button");
|
Logger.printDebug(() -> "initializing new segment button");
|
||||||
ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById(
|
ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById(
|
||||||
getResourceIdentifier("sb_sponsorblock_button", "id")));
|
getResourceIdentifier("revanced_sb_create_segment_button", "id")));
|
||||||
imageView.setVisibility(View.GONE);
|
imageView.setVisibility(View.GONE);
|
||||||
imageView.setOnClickListener(v -> {
|
imageView.setOnClickListener(v -> {
|
||||||
SponsorBlockViewController.toggleNewSegmentLayoutVisibility();
|
SponsorBlockViewController.toggleNewSegmentLayoutVisibility();
|
||||||
|
@ -44,7 +44,7 @@ public final class NewSegmentLayout extends FrameLayout {
|
|||||||
super(context, attributeSet, defStyleAttr, defStyleRes);
|
super(context, attributeSet, defStyleAttr, defStyleRes);
|
||||||
|
|
||||||
LayoutInflater.from(context).inflate(
|
LayoutInflater.from(context).inflate(
|
||||||
getResourceIdentifier(context, "new_segment", "layout"), this, true
|
getResourceIdentifier(context, "revanced_sb_new_segment", "layout"), this, true
|
||||||
);
|
);
|
||||||
|
|
||||||
TypedValue rippleEffect = new TypedValue();
|
TypedValue rippleEffect = new TypedValue();
|
||||||
@ -53,42 +53,42 @@ public final class NewSegmentLayout extends FrameLayout {
|
|||||||
|
|
||||||
initializeButton(
|
initializeButton(
|
||||||
context,
|
context,
|
||||||
"sb_new_segment_rewind",
|
"revanced_sb_new_segment_rewind",
|
||||||
() -> VideoInformation.seekToRelative(-Settings.SB_CREATE_NEW_SEGMENT_STEP.get()),
|
() -> VideoInformation.seekToRelative(-Settings.SB_CREATE_NEW_SEGMENT_STEP.get()),
|
||||||
"Rewind button clicked"
|
"Rewind button clicked"
|
||||||
);
|
);
|
||||||
|
|
||||||
initializeButton(
|
initializeButton(
|
||||||
context,
|
context,
|
||||||
"sb_new_segment_forward",
|
"revanced_sb_new_segment_forward",
|
||||||
() -> VideoInformation.seekToRelative(Settings.SB_CREATE_NEW_SEGMENT_STEP.get()),
|
() -> VideoInformation.seekToRelative(Settings.SB_CREATE_NEW_SEGMENT_STEP.get()),
|
||||||
"Forward button clicked"
|
"Forward button clicked"
|
||||||
);
|
);
|
||||||
|
|
||||||
initializeButton(
|
initializeButton(
|
||||||
context,
|
context,
|
||||||
"sb_new_segment_adjust",
|
"revanced_sb_new_segment_adjust",
|
||||||
SponsorBlockUtils::onMarkLocationClicked,
|
SponsorBlockUtils::onMarkLocationClicked,
|
||||||
"Adjust button clicked"
|
"Adjust button clicked"
|
||||||
);
|
);
|
||||||
|
|
||||||
initializeButton(
|
initializeButton(
|
||||||
context,
|
context,
|
||||||
"sb_new_segment_compare",
|
"revanced_sb_new_segment_compare",
|
||||||
SponsorBlockUtils::onPreviewClicked,
|
SponsorBlockUtils::onPreviewClicked,
|
||||||
"Compare button clicked"
|
"Compare button clicked"
|
||||||
);
|
);
|
||||||
|
|
||||||
initializeButton(
|
initializeButton(
|
||||||
context,
|
context,
|
||||||
"sb_new_segment_edit",
|
"revanced_sb_new_segment_edit",
|
||||||
SponsorBlockUtils::onEditByHandClicked,
|
SponsorBlockUtils::onEditByHandClicked,
|
||||||
"Edit button clicked"
|
"Edit button clicked"
|
||||||
);
|
);
|
||||||
|
|
||||||
initializeButton(
|
initializeButton(
|
||||||
context,
|
context,
|
||||||
"sb_new_segment_publish",
|
"revanced_sb_new_segment_publish",
|
||||||
SponsorBlockUtils::onPublishClicked,
|
SponsorBlockUtils::onPublishClicked,
|
||||||
"Publish button clicked"
|
"Publish button clicked"
|
||||||
);
|
);
|
||||||
|
@ -47,9 +47,9 @@ public class SkipSponsorButton extends FrameLayout {
|
|||||||
public SkipSponsorButton(Context context, AttributeSet attributeSet, int defStyleAttr, int defStyleRes) {
|
public SkipSponsorButton(Context context, AttributeSet attributeSet, int defStyleAttr, int defStyleRes) {
|
||||||
super(context, attributeSet, defStyleAttr, defStyleRes);
|
super(context, attributeSet, defStyleAttr, defStyleRes);
|
||||||
|
|
||||||
LayoutInflater.from(context).inflate(getResourceIdentifier(context, "skip_sponsor_button", "layout"), this, true); // layout:skip_ad_button
|
LayoutInflater.from(context).inflate(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button", "layout"), this, true); // layout:skip_ad_button
|
||||||
setMinimumHeight(getResourceDimensionPixelSize("ad_skip_ad_button_min_height")); // dimen:ad_skip_ad_button_min_height
|
setMinimumHeight(getResourceDimensionPixelSize("ad_skip_ad_button_min_height")); // dimen:ad_skip_ad_button_min_height
|
||||||
skipSponsorBtnContainer = Objects.requireNonNull((LinearLayout) findViewById(getResourceIdentifier(context, "sb_skip_sponsor_button_container", "id"))); // id:skip_ad_button_container
|
skipSponsorBtnContainer = Objects.requireNonNull((LinearLayout) findViewById(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button_container", "id"))); // id:skip_ad_button_container
|
||||||
background = new Paint();
|
background = new Paint();
|
||||||
background.setColor(getResourceColor("skip_ad_button_background_color")); // color:skip_ad_button_background_color);
|
background.setColor(getResourceColor("skip_ad_button_background_color")); // color:skip_ad_button_background_color);
|
||||||
background.setStyle(Paint.Style.FILL);
|
background.setStyle(Paint.Style.FILL);
|
||||||
@ -57,7 +57,7 @@ public class SkipSponsorButton extends FrameLayout {
|
|||||||
border.setColor(getResourceColor("skip_ad_button_border_color")); // color:skip_ad_button_border_color);
|
border.setColor(getResourceColor("skip_ad_button_border_color")); // color:skip_ad_button_border_color);
|
||||||
border.setStrokeWidth(getResourceDimension("ad_skip_ad_button_border_width")); // dimen:ad_skip_ad_button_border_width);
|
border.setStrokeWidth(getResourceDimension("ad_skip_ad_button_border_width")); // dimen:ad_skip_ad_button_border_width);
|
||||||
border.setStyle(Paint.Style.STROKE);
|
border.setStyle(Paint.Style.STROKE);
|
||||||
skipSponsorTextView = Objects.requireNonNull((TextView) findViewById(getResourceIdentifier(context, "sb_skip_sponsor_button_text", "id"))); // id:skip_ad_button_text;
|
skipSponsorTextView = Objects.requireNonNull((TextView) findViewById(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button_text", "id"))); // id:skip_ad_button_text;
|
||||||
defaultBottomMargin = getResourceDimensionPixelSize("skip_button_default_bottom_margin"); // dimen:skip_button_default_bottom_margin
|
defaultBottomMargin = getResourceDimensionPixelSize("skip_button_default_bottom_margin"); // dimen:skip_button_default_bottom_margin
|
||||||
ctaBottomMargin = getResourceDimensionPixelSize("skip_button_cta_bottom_margin"); // dimen:skip_button_cta_bottom_margin
|
ctaBottomMargin = getResourceDimensionPixelSize("skip_button_cta_bottom_margin"); // dimen:skip_button_cta_bottom_margin
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class SponsorBlockViewController {
|
|||||||
Context context = Utils.getContext();
|
Context context = Utils.getContext();
|
||||||
RelativeLayout layout = new RelativeLayout(context);
|
RelativeLayout layout = new RelativeLayout(context);
|
||||||
layout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT));
|
layout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT));
|
||||||
LayoutInflater.from(context).inflate(getResourceIdentifier("inline_sponsor_overlay", "layout"), layout);
|
LayoutInflater.from(context).inflate(getResourceIdentifier("revanced_sb_inline_sponsor_overlay", "layout"), layout);
|
||||||
inlineSponsorOverlayRef = new WeakReference<>(layout);
|
inlineSponsorOverlayRef = new WeakReference<>(layout);
|
||||||
|
|
||||||
viewGroup.addView(layout);
|
viewGroup.addView(layout);
|
||||||
@ -81,11 +81,11 @@ public class SponsorBlockViewController {
|
|||||||
youtubeOverlaysLayoutRef = new WeakReference<>(viewGroup);
|
youtubeOverlaysLayoutRef = new WeakReference<>(viewGroup);
|
||||||
|
|
||||||
skipHighlightButtonRef = new WeakReference<>(
|
skipHighlightButtonRef = new WeakReference<>(
|
||||||
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("sb_skip_highlight_button", "id"))));
|
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("revanced_sb_skip_highlight_button", "id"))));
|
||||||
skipSponsorButtonRef = new WeakReference<>(
|
skipSponsorButtonRef = new WeakReference<>(
|
||||||
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("sb_skip_sponsor_button", "id"))));
|
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("revanced_sb_skip_sponsor_button", "id"))));
|
||||||
newSegmentLayoutRef = new WeakReference<>(
|
newSegmentLayoutRef = new WeakReference<>(
|
||||||
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("sb_new_segment_view", "id"))));
|
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("revanced_sb_new_segment_view", "id"))));
|
||||||
|
|
||||||
newSegmentLayoutVisible = false;
|
newSegmentLayoutVisible = false;
|
||||||
skipHighlight = null;
|
skipHighlight = null;
|
||||||
|
@ -27,7 +27,7 @@ public class VotingButtonController {
|
|||||||
try {
|
try {
|
||||||
Logger.printDebug(() -> "initializing voting button");
|
Logger.printDebug(() -> "initializing voting button");
|
||||||
ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById(
|
ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById(
|
||||||
getResourceIdentifier("sb_voting_button", "id")));
|
getResourceIdentifier("revanced_sb_voting_button", "id")));
|
||||||
imageView.setVisibility(View.GONE);
|
imageView.setVisibility(View.GONE);
|
||||||
imageView.setOnClickListener(v -> {
|
imageView.setOnClickListener(v -> {
|
||||||
SponsorBlockUtils.onVotingClicked(v.getContext());
|
SponsorBlockUtils.onVotingClicked(v.getContext());
|
||||||
|
@ -82,10 +82,10 @@ class SwipeControlsOverlayLayout(
|
|||||||
|
|
||||||
// get icons scaled, assuming square icons
|
// get icons scaled, assuming square icons
|
||||||
val iconHeight = round(feedbackTextView.lineHeight * .8).toInt()
|
val iconHeight = round(feedbackTextView.lineHeight * .8).toInt()
|
||||||
autoBrightnessIcon = getDrawable("ic_sc_brightness_auto", iconHeight, iconHeight)
|
autoBrightnessIcon = getDrawable("revanced_ic_sc_brightness_auto", iconHeight, iconHeight)
|
||||||
manualBrightnessIcon = getDrawable("ic_sc_brightness_manual", iconHeight, iconHeight)
|
manualBrightnessIcon = getDrawable("revanced_ic_sc_brightness_manual", iconHeight, iconHeight)
|
||||||
mutedVolumeIcon = getDrawable("ic_sc_volume_mute", iconHeight, iconHeight)
|
mutedVolumeIcon = getDrawable("revanced_ic_sc_volume_mute", iconHeight, iconHeight)
|
||||||
normalVolumeIcon = getDrawable("ic_sc_volume_normal", iconHeight, iconHeight)
|
normalVolumeIcon = getDrawable("revanced_ic_sc_volume_normal", iconHeight, iconHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val feedbackHideHandler = Handler(Looper.getMainLooper())
|
private val feedbackHideHandler = Handler(Looper.getMainLooper())
|
||||||
|
@ -16,7 +16,7 @@ public class CopyVideoUrlButton extends BottomControlButton {
|
|||||||
public CopyVideoUrlButton(ViewGroup viewGroup) {
|
public CopyVideoUrlButton(ViewGroup viewGroup) {
|
||||||
super(
|
super(
|
||||||
viewGroup,
|
viewGroup,
|
||||||
"copy_video_url_button",
|
"revanced_copy_video_url_button",
|
||||||
Settings.COPY_VIDEO_URL,
|
Settings.COPY_VIDEO_URL,
|
||||||
view -> CopyVideoUrlPatch.copyUrl(false),
|
view -> CopyVideoUrlPatch.copyUrl(false),
|
||||||
view -> {
|
view -> {
|
||||||
|
@ -16,7 +16,7 @@ public class CopyVideoUrlTimestampButton extends BottomControlButton {
|
|||||||
public CopyVideoUrlTimestampButton(ViewGroup bottomControlsViewGroup) {
|
public CopyVideoUrlTimestampButton(ViewGroup bottomControlsViewGroup) {
|
||||||
super(
|
super(
|
||||||
bottomControlsViewGroup,
|
bottomControlsViewGroup,
|
||||||
"copy_video_url_timestamp_button",
|
"revanced_copy_video_url_timestamp_button",
|
||||||
Settings.COPY_VIDEO_URL_TIMESTAMP,
|
Settings.COPY_VIDEO_URL_TIMESTAMP,
|
||||||
view -> CopyVideoUrlPatch.copyUrl(true),
|
view -> CopyVideoUrlPatch.copyUrl(true),
|
||||||
view -> {
|
view -> {
|
||||||
|
@ -21,7 +21,7 @@ public class ExternalDownloadButton extends BottomControlButton {
|
|||||||
public ExternalDownloadButton(ViewGroup viewGroup) {
|
public ExternalDownloadButton(ViewGroup viewGroup) {
|
||||||
super(
|
super(
|
||||||
viewGroup,
|
viewGroup,
|
||||||
"external_download_button",
|
"revanced_external_download_button",
|
||||||
Settings.EXTERNAL_DOWNLOADER,
|
Settings.EXTERNAL_DOWNLOADER,
|
||||||
ExternalDownloadButton::onDownloadClick,
|
ExternalDownloadButton::onDownloadClick,
|
||||||
null
|
null
|
||||||
@ -62,7 +62,7 @@ public class ExternalDownloadButton extends BottomControlButton {
|
|||||||
|
|
||||||
// If the package is not installed, show the toast
|
// If the package is not installed, show the toast
|
||||||
if (!packageEnabled) {
|
if (!packageEnabled) {
|
||||||
Utils.showToastLong(downloaderPackageName + " " + StringRef.str("external_downloader_not_installed_warning"));
|
Utils.showToastLong(StringRef.str("revanced_external_downloader_not_installed_warning", downloaderPackageName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user