diff --git a/app/src/main/java/fi/vanced/libraries/youtube/dialog/Dialogs.java b/app/src/main/java/fi/vanced/libraries/youtube/dialog/Dialogs.java
new file mode 100644
index 00000000..c22fc157
--- /dev/null
+++ b/app/src/main/java/fi/vanced/libraries/youtube/dialog/Dialogs.java
@@ -0,0 +1,139 @@
+package fi.vanced.libraries.youtube.dialog;
+
+import static fi.vanced.libraries.youtube.ryd.RYDSettings.PREFERENCES_KEY_RYD_ENABLED;
+import static fi.vanced.libraries.youtube.ryd.RYDSettings.PREFERENCES_KEY_RYD_HINT_SHOWN;
+import static fi.vanced.libraries.youtube.ryd.RYDSettings.PREFERENCES_NAME;
+import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED;
+import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN;
+import static pl.jakubweg.StringRef.str;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.LightingColorFilter;
+import android.net.Uri;
+import android.os.Build;
+
+import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
+
+import fi.vanced.utils.SharedPrefUtils;
+import fi.vanced.utils.VancedUtils;
+import pl.jakubweg.SponsorBlockSettings;
+
+public class Dialogs {
+ // Inject call from YT to this
+ public static void showDialogsAtStartup(Activity activity) {
+ rydFirstRun(activity);
+ sbFirstRun(activity);
+ }
+
+ private static void rydFirstRun(Activity activity) {
+ Context context = YouTubeTikTokRoot_Application.getAppContext();
+ boolean enabled = SharedPrefUtils.getBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_ENABLED, false);
+ boolean hintShown = SharedPrefUtils.getBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_HINT_SHOWN, false);
+
+ // If RYD is enabled or hint has been shown, exit
+ if (enabled || hintShown) {
+ // If RYD is enabled but hint hasn't been shown, mark it as shown
+ if (enabled && !hintShown) {
+ SharedPrefUtils.saveBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_HINT_SHOWN, true);
+ }
+ return;
+ }
+
+ AlertDialog.Builder builder;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
+ } else {
+ builder = new AlertDialog.Builder(activity);
+ }
+ builder.setTitle(str("vanced_ryd"));
+ builder.setIcon(VancedUtils.getIdentifier("reel_dislike_icon", "drawable"));
+ builder.setCancelable(false);
+ builder.setMessage(str("vanced_ryd_firstrun"));
+ builder.setPositiveButton(str("vanced_enable"),
+ (dialog, id) -> {
+ SharedPrefUtils.saveBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_HINT_SHOWN, true);
+ SharedPrefUtils.saveBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_ENABLED, true);
+ dialog.dismiss();
+ });
+
+ builder.setNegativeButton(str("vanced_disable"),
+ (dialog, id) -> {
+ SharedPrefUtils.saveBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_HINT_SHOWN, true);
+ SharedPrefUtils.saveBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_ENABLED, false);
+ dialog.dismiss();
+ });
+
+ builder.setNeutralButton(str("vanced_learnmore"), null);
+
+ AlertDialog dialog = builder.create();
+ dialog.show();
+
+ // Set black background
+ dialog.getWindow().getDecorView().getBackground().setColorFilter(new LightingColorFilter(0xFF000000, VancedUtils.getIdentifier("ytBrandBackgroundSolid", "color")));
+
+ // Set learn more action (set here so clicking it doesn't dismiss the dialog)
+ dialog.getButton(DialogInterface.BUTTON_NEUTRAL).setOnClickListener(v -> {
+ Uri uri = Uri.parse("https://www.returnyoutubedislike.com/");
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ activity.startActivity(intent);
+ });
+ }
+
+ private static void sbFirstRun(Activity activity) {
+ Context context = YouTubeTikTokRoot_Application.getAppContext();
+ boolean enabled = SharedPrefUtils.getBoolean(context, SponsorBlockSettings.PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED, false);
+ boolean hintShown = SharedPrefUtils.getBoolean(context, SponsorBlockSettings.PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN, false);
+
+ // If SB is enabled or hint has been shown, exit
+ if (enabled || hintShown) {
+ // If SB is enabled but hint hasn't been shown, mark it as shown
+ if (enabled && !hintShown) {
+ SharedPrefUtils.saveBoolean(context, SponsorBlockSettings.PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN, true);
+ }
+ return;
+ }
+
+ AlertDialog.Builder builder;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ builder = new AlertDialog.Builder(activity, android.R.style.Theme_Material_Dialog_Alert);
+ } else {
+ builder = new AlertDialog.Builder(activity);
+ }
+ builder.setTitle(str("vanced_sb"));
+ builder.setIcon(VancedUtils.getIdentifier("ic_sb_logo", "drawable"));
+ builder.setCancelable(false);
+ builder.setMessage(str("vanced_sb_firstrun"));
+ builder.setPositiveButton(str("vanced_enable"),
+ (dialog, id) -> {
+ SharedPrefUtils.saveBoolean(context, SponsorBlockSettings.PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN, true);
+ SharedPrefUtils.saveBoolean(context, SponsorBlockSettings.PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED, true);
+ dialog.dismiss();
+ });
+
+ builder.setNegativeButton(str("vanced_disable"),
+ (dialog, id) -> {
+ SharedPrefUtils.saveBoolean(context, SponsorBlockSettings.PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN, true);
+ SharedPrefUtils.saveBoolean(context, SponsorBlockSettings.PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED, false);
+ dialog.dismiss();
+ });
+
+ builder.setNeutralButton(str("vanced_learnmore"), null);
+
+ AlertDialog dialog = builder.create();
+ dialog.show();
+
+ // Set black background
+ dialog.getWindow().getDecorView().getBackground().setColorFilter(new LightingColorFilter(0xFF000000, VancedUtils.getIdentifier("ytBrandBackgroundSolid", "color")));
+
+ // Set learn more action (set here so clicking it doesn't dismiss the dialog)
+ dialog.getButton(DialogInterface.BUTTON_NEUTRAL).setOnClickListener(v -> {
+ Uri uri = Uri.parse("https://sponsor.ajay.app/");
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ activity.startActivity(intent);
+ });
+ }
+}
diff --git a/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDFragment.java b/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDFragment.java
index 93b1cc90..617e1c1a 100644
--- a/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDFragment.java
+++ b/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDFragment.java
@@ -1,6 +1,8 @@
package fi.vanced.libraries.youtube.ryd;
+import static fi.razerman.youtube.XGlobals.debug;
import static fi.vanced.libraries.youtube.ryd.RYDSettings.PREFERENCES_KEY_RYD_ENABLED;
+import static fi.vanced.libraries.youtube.ryd.RYDSettings.PREFERENCES_KEY_RYD_HINT_SHOWN;
import static fi.vanced.libraries.youtube.ryd.RYDSettings.PREFERENCES_NAME;
import static pl.jakubweg.StringRef.str;
@@ -44,6 +46,18 @@ public class RYDFragment extends PreferenceFragment {
});
}
+ // Clear hint
+ if (debug) {
+ SwitchPreference preference = new SwitchPreference(context);
+ preferenceScreen.addPreference(preference);
+ preference.setKey(PREFERENCES_KEY_RYD_HINT_SHOWN);
+ preference.setDefaultValue(false);
+ preference.setChecked(SharedPrefUtils.getBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_HINT_SHOWN));
+ preference.setTitle("Hint debug");
+ preference.setSummary("Debug toggle for clearing the hint shown preference");
+ preference.setOnPreferenceChangeListener((pref, newValue) -> true);
+ }
+
// About category
addAboutCategory(context, preferenceScreen);
}
diff --git a/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDSettings.java b/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDSettings.java
index fda4808e..aa436a09 100644
--- a/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDSettings.java
+++ b/app/src/main/java/fi/vanced/libraries/youtube/ryd/RYDSettings.java
@@ -4,4 +4,5 @@ public class RYDSettings {
public static final String PREFERENCES_NAME = "ryd";
public static final String PREFERENCES_KEY_USERID = "userId";
public static final String PREFERENCES_KEY_RYD_ENABLED = "ryd-enabled";
+ public static final String PREFERENCES_KEY_RYD_HINT_SHOWN = "ryd_hint_shown";
}
diff --git a/app/src/main/java/pl/jakubweg/SponsorBlockPreferenceFragment.java b/app/src/main/java/pl/jakubweg/SponsorBlockPreferenceFragment.java
index 8d504422..b88bfb7e 100644
--- a/app/src/main/java/pl/jakubweg/SponsorBlockPreferenceFragment.java
+++ b/app/src/main/java/pl/jakubweg/SponsorBlockPreferenceFragment.java
@@ -1,5 +1,6 @@
package pl.jakubweg;
+import static fi.razerman.youtube.XGlobals.debug;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_ADJUST_NEW_SEGMENT_STEP;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_COUNT_SKIPS;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_MIN_DURATION;
@@ -7,6 +8,7 @@ import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_NEW_SEGMENT_ENABL
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_SHOW_TIME_WITHOUT_SEGMENTS;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_SHOW_TOAST_WHEN_SKIP;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED;
+import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_UUID;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_KEY_VOTING_ENABLED;
import static pl.jakubweg.SponsorBlockSettings.PREFERENCES_NAME;
@@ -39,6 +41,7 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import fi.vanced.libraries.youtube.whitelisting.WhitelistType;
+import fi.vanced.utils.SharedPrefUtils;
import pl.jakubweg.objects.EditTextListPreference;
import pl.jakubweg.requests.SBRequester;
@@ -77,6 +80,18 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment implement
});
}
+ // Clear hint
+ if (debug) {
+ SwitchPreference preference = new SwitchPreference(context);
+ preferenceScreen.addPreference(preference);
+ preference.setKey(PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN);
+ preference.setDefaultValue(false);
+ preference.setChecked(SharedPrefUtils.getBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN));
+ preference.setTitle("Hint debug");
+ preference.setSummary("Debug toggle for clearing the hint shown preference");
+ preference.setOnPreferenceChangeListener((pref, newValue) -> true);
+ }
+
{
SwitchPreference preference = new SwitchPreference(context);
preferenceScreen.addPreference(preference);
diff --git a/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java b/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java
index 9bdd5f4b..9fb85016 100644
--- a/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java
+++ b/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java
@@ -24,6 +24,7 @@ public class SponsorBlockSettings {
public static final String PREFERENCES_KEY_ADJUST_NEW_SEGMENT_STEP = "new-segment-step-accuracy";
public static final String PREFERENCES_KEY_MIN_DURATION = "sb-min-duration";
public static final String PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED = "sb-enabled";
+ public static final String PREFERENCES_KEY_SPONSOR_BLOCK_HINT_SHOWN = "sb_hint_shown";
public static final String PREFERENCES_KEY_SEEN_GUIDELINES = "sb-seen-gl";
public static final String PREFERENCES_KEY_NEW_SEGMENT_ENABLED = "sb-new-segment-enabled";
public static final String PREFERENCES_KEY_VOTING_ENABLED = "sb-voting-enabled";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fc1677e8..5d1f3523 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -372,4 +372,12 @@
Tablet style
Tablet style is turned on. For example suggested videos are only partially working
Tablet style is turned off
+
+ Return YouTube Dislike
+ Want to enable Return YouTube Dislikes to see dislikes again? Your likes/dislikes will be sent to RYD API (anonymously) after enabling RYD integration. You can enable/disable this in the settings at any time.
+ SponsorBlock
+ Are you aware of the SponsorBlock integration in Vanced? With it you can skip sponsored segments in the videos. You can enable/disable this in the settings at any time.
+ Learn more
+ Disable
+ Enable