You've already forked revanced-integrations
mirror of
https://github.com/revanced/revanced-integrations
synced 2025-11-21 18:35:37 +01:00
Compare commits
86 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5a93a0cd9 | ||
|
|
ac69b36773 | ||
|
|
81d3afd065 | ||
|
|
8b4bed8ab3 | ||
|
|
b13d692ef1 | ||
|
|
fb20ae19e8 | ||
|
|
889a7d8460 | ||
|
|
d28d65734e | ||
|
|
1c021b1a50 | ||
|
|
06bebd7017 | ||
|
|
d745e29395 | ||
|
|
69a585da6f | ||
|
|
7050cefe10 | ||
|
|
afa9d3cbb1 | ||
|
|
6762ea4178 | ||
|
|
a92c932a20 | ||
|
|
3698a502c3 | ||
|
|
5566cfdda9 | ||
|
|
97efc17da7 | ||
|
|
8fdde7046d | ||
|
|
74c96beb20 | ||
|
|
7014518673 | ||
|
|
ac3a835215 | ||
|
|
39450109ab | ||
|
|
db718242e7 | ||
|
|
59c2459353 | ||
|
|
f06935ddac | ||
|
|
8127f8b390 | ||
|
|
f4650b1139 | ||
|
|
0be0ffd42a | ||
|
|
a061614d86 | ||
|
|
486019802c | ||
|
|
0253fef2aa | ||
|
|
8483a225fb | ||
|
|
867645ea5b | ||
|
|
52a2073175 | ||
|
|
0e6a92fb33 | ||
|
|
658e11ac12 | ||
|
|
1755662a7a | ||
|
|
8bd84031d4 | ||
|
|
c5ca35e42c | ||
|
|
c266fdbf44 | ||
|
|
07acc4dc1f | ||
|
|
34a6829aaf | ||
|
|
c372e0e9bd | ||
|
|
f5a4e6f3bf | ||
|
|
576991a7df | ||
|
|
ab88a1f3d7 | ||
|
|
5ab26a427b | ||
|
|
9255fa30fa | ||
|
|
90f7392e1a | ||
|
|
fbaa361c00 | ||
|
|
bf82e0219f | ||
|
|
e78a8014bc | ||
|
|
72c7604160 | ||
|
|
199259cb95 | ||
|
|
d10c5462f4 | ||
|
|
b98e6fa169 | ||
|
|
26c208e9ed | ||
|
|
c548f1651a | ||
|
|
5add970f61 | ||
|
|
18a749f87d | ||
|
|
c3e302d224 | ||
|
|
1010eedbb2 | ||
|
|
c7756e1299 | ||
|
|
3022afc7c4 | ||
|
|
9bcb04de8e | ||
|
|
322e145f75 | ||
|
|
5a24e84868 | ||
|
|
c049dc3e8d | ||
|
|
149a90a2e8 | ||
|
|
2d001cfb1d | ||
|
|
8bb93a439b | ||
|
|
0fe4db9f28 | ||
|
|
4cc8a22c26 | ||
|
|
11fbf1a5b3 | ||
|
|
fa0ad3a57b | ||
|
|
73b40595c4 | ||
|
|
04bbe259cb | ||
|
|
8dde925b47 | ||
|
|
4ca1182485 | ||
|
|
4c72ac1cd5 | ||
|
|
cdca96224a | ||
|
|
868e99a619 | ||
|
|
f1e9aa30ba | ||
|
|
ae8d39a831 |
283
CHANGELOG.md
283
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -7,14 +7,14 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = 32
|
||||
buildToolsVersion = "32.0.0"
|
||||
compileSdk = 33
|
||||
buildToolsVersion = "33.0.0"
|
||||
namespace = "app.revanced.integrations"
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "app.revanced.integrations"
|
||||
minSdk = 23
|
||||
targetSdk = 32
|
||||
targetSdk = 33
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
multiDexEnabled = false
|
||||
@@ -29,7 +29,7 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
@@ -43,5 +43,6 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(mapOf("path" to ":dummy")))
|
||||
compileOnly("androidx.annotation:annotation:1.5.0")
|
||||
}
|
||||
|
||||
7
app/proguard-rules.pro
vendored
7
app/proguard-rules.pro
vendored
@@ -19,3 +19,10 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-dontobfuscate
|
||||
-keep class app.revanced.** {
|
||||
*;
|
||||
}
|
||||
-keep class com.google.** {
|
||||
*;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class DisableStartupShortsPlayerPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.startupshortsreset.patch.DisableShortsOnStartupPatch
|
||||
public static boolean disableStartupShortsPlayer() {
|
||||
return SettingsEnum.DISABLE_STARTUP_SHORTS_PLAYER.getBoolean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import java.util.Timer;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
public final class FixPlaybackPatch {
|
||||
private static Thread currentThread = null;
|
||||
public static void newVideoLoaded(final String _videoId) {
|
||||
if (!SettingsEnum.FIX_PLAYBACK.getBoolean()) return;
|
||||
|
||||
if (currentThread != null) {
|
||||
currentThread.interrupt();
|
||||
}
|
||||
|
||||
currentThread = new Thread(() -> {
|
||||
while (true) {
|
||||
var currentVideoLength = PlayerControllerPatch.getCurrentVideoLength();
|
||||
if (currentVideoLength > 1) {
|
||||
PlayerControllerPatch.seekTo(currentVideoLength);
|
||||
PlayerControllerPatch.seekTo(1);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
LogHelper.debug(FixPlaybackPatch.class, "Thread was interrupted");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
currentThread.start();
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GeneralBytecodeAdsPatch {
|
||||
|
||||
//Used by app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch
|
||||
public static boolean containsAd(String value, ByteBuffer buffer) {
|
||||
return containsLithoAd(value, buffer);
|
||||
}
|
||||
|
||||
private static boolean containsLithoAd(String value, ByteBuffer buffer) {
|
||||
boolean enabled = false;
|
||||
for (SettingsEnum setting : SettingsEnum.getAdRemovalSettings()) {
|
||||
if (setting.getBoolean()) {
|
||||
enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (value == null || value.isEmpty() || !enabled) return false;
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Searching for AD: " + value);
|
||||
|
||||
List<String> blockList = new ArrayList<>();
|
||||
List<String> bufferBlockList = new ArrayList<>();
|
||||
|
||||
if (SettingsEnum.ADREMOVER_AD_REMOVAL.getBoolean()) {
|
||||
blockList.add("_ad");
|
||||
blockList.add("ad_badge");
|
||||
blockList.add("ads_video_with_context");
|
||||
blockList.add("cell_divider");
|
||||
blockList.add("reels_player_overlay");
|
||||
blockList.add("shelf_header");
|
||||
blockList.add("text_search_ad_with_description_first");
|
||||
blockList.add("watch_metadata_app_promo");
|
||||
blockList.add("video_display_full_layout");
|
||||
|
||||
bufferBlockList.add("ad_cpn");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_SUGGESTED_FOR_YOU_REMOVAL.getBoolean()) {
|
||||
bufferBlockList.add("watch-vrecH");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_MOVIE_REMOVAL.getBoolean()) {
|
||||
blockList.add("browsy_bar");
|
||||
blockList.add("compact_movie");
|
||||
blockList.add("horizontal_movie_shelf");
|
||||
blockList.add("movie_and_show_upsell_card");
|
||||
|
||||
bufferBlockList.add("YouTube Movies");
|
||||
}
|
||||
if (containsAny(value, "home_video_with_context", "related_video_with_context") &&
|
||||
anyMatch(bufferBlockList, new String(buffer.array(), StandardCharsets.UTF_8)::contains)
|
||||
) return true;
|
||||
|
||||
if (SettingsEnum.ADREMOVER_COMMENTS_REMOVAL.getBoolean()) {
|
||||
blockList.add("comments_");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_COMMUNITY_GUIDELINES.getBoolean()) {
|
||||
blockList.add("community_guidelines");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_COMPACT_BANNER_REMOVAL.getBoolean()) {
|
||||
blockList.add("compact_banner");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_EMERGENCY_BOX_REMOVAL.getBoolean()) {
|
||||
blockList.add("emergency_onebox");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_FEED_SURVEY_REMOVAL.getBoolean()) {
|
||||
blockList.add("in_feed_survey");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_MEDICAL_PANEL_REMOVAL.getBoolean()) {
|
||||
blockList.add("medical_panel");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_PAID_CONTECT_REMOVAL.getBoolean()) {
|
||||
blockList.add("paid_content_overlay");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_COMMUNITY_POSTS_REMOVAL.getBoolean()) {
|
||||
blockList.add("post_base_wrapper");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_MERCHANDISE_REMOVAL.getBoolean()) {
|
||||
blockList.add("product_carousel");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_SHORTS_SHELF.getBoolean()) {
|
||||
blockList.add("shorts_shelf");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_INFO_PANEL_REMOVAL.getBoolean()) {
|
||||
blockList.add("publisher_transparency_panel");
|
||||
blockList.add("single_item_information_panel");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_HIDE_SUGGESTIONS.getBoolean()) {
|
||||
blockList.add("horizontal_video_shelf");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_HIDE_LATEST_POSTS.getBoolean()) {
|
||||
blockList.add("post_shelf");
|
||||
}
|
||||
if (SettingsEnum.ADREMOVER_HIDE_CHANNEL_GUIDELINES.getBoolean()) {
|
||||
blockList.add("channel_guidelines_entry_banner");
|
||||
}
|
||||
|
||||
if (containsAny(value,
|
||||
"home_video_with_context",
|
||||
"related_video_with_context",
|
||||
"search_video_with_context",
|
||||
"menu",
|
||||
"root",
|
||||
"-count",
|
||||
"-space",
|
||||
"-button"
|
||||
)) return false;
|
||||
|
||||
if (anyMatch(blockList, value::contains)) {
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, "Blocking ad: " + value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (SettingsEnum.DEBUG.getBoolean()) {
|
||||
if (value.contains("related_video_with_context")) {
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, value + " | " + bytesToHex(buffer.array()));
|
||||
return false;
|
||||
}
|
||||
LogHelper.debug(GeneralBytecodeAdsPatch.class, value + " returns false.");
|
||||
}
|
||||
return false;
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(GeneralBytecodeAdsPatch.class, ex.getMessage(), ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean containsAny(String value, String... targets) {
|
||||
for (String string : targets)
|
||||
if (value.contains(string)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String bytesToHex(byte[] bytes) {
|
||||
StringBuilder builder = new StringBuilder(bytes.length * 2);
|
||||
for (byte b : bytes)
|
||||
builder.append(String.format("%02x", b));
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private static <T> boolean anyMatch(List<T> value, APredicate<? super T> predicate) {
|
||||
for (T t : value) {
|
||||
if (predicate.test(t)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface APredicate<T> {
|
||||
boolean test(T t);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import app.revanced.integrations.adremover.AdRemoverAPI;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideAlbumCardsPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.hidealbumcards.patch.HideAlbumCardsPatch
|
||||
public static void hideAlbumCards(View view) {
|
||||
if (!SettingsEnum.HIDE_ALBUM_CARDS.getBoolean()) return;
|
||||
AdRemoverAPI.HideViewWithLayout1dp(view);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
public class HideCaptionsButtonPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.hidecaptionsbutton.patch.HideCaptionsButtonPatch
|
||||
public static void hideCaptionsButton(ImageView imageView) {
|
||||
imageView.setVisibility(SettingsEnum.HIDE_CAPTIONS_BUTTON.getBoolean() ? ImageView.GONE : ImageView.VISIBLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import app.revanced.integrations.adremover.AdRemoverAPI;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideCrowdfundingBoxPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.hidecrowdfundingbox.patch.HideCrowdfundingBoxPatch
|
||||
public static void hideCrowdfundingBox(View view) {
|
||||
if (!SettingsEnum.HIDE_CROWDFUNDING_BOX.getBoolean()) return;
|
||||
AdRemoverAPI.HideViewWithLayout1dp(view);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideEmailAddressPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.personalinformation.patch.HideEmailAddressPatch
|
||||
public static boolean hideEmailAddress() {
|
||||
return SettingsEnum.HIDE_EMAIL_ADDRESS.getBoolean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import app.revanced.integrations.adremover.AdRemoverAPI;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideMixPlaylistsPatch {
|
||||
|
||||
public static void hideMixPlaylists(View view) {
|
||||
if (!SettingsEnum.HIDE_MIX_PLAYLISTS.getBoolean()) return;
|
||||
AdRemoverAPI.HideViewWithLayout1dp(view);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideShortsCommentsButtonPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.comments.patch.CommentsPatch
|
||||
public static void hideShortsCommentsButton(View view) {
|
||||
if (!SettingsEnum.HIDE_SHORTS_COMMENTS_BUTTON.getBoolean()) return;
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public class HideWatchinVRPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.watchinvr.patch.HideWatchinVRPatch
|
||||
public static boolean hideWatchinVR() {
|
||||
return SettingsEnum.HIDE_WATCH_IN_VR.getBoolean();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import app.revanced.integrations.utils.ThemeHelper;
|
||||
|
||||
public class LithoThemePatch {
|
||||
// color constants used in relation with litho components
|
||||
private static final int[] WHITECONSTANTS = {
|
||||
-1, // comments chip background
|
||||
-394759, // music related results panel background
|
||||
-83886081, // video chapters list background
|
||||
};
|
||||
|
||||
private static final int[] DARKCONSTANTS = {
|
||||
-14606047, // comments chip background
|
||||
-15198184, // music related results panel background
|
||||
-15790321, // comments chip background (new layout)
|
||||
-98492127 // video chapters list background
|
||||
};
|
||||
|
||||
// Used by app.revanced.patches.youtube.layout.theme.patch.LithoThemePatch
|
||||
public static int applyLithoTheme(int originalValue) {
|
||||
var isDarkTheme = ThemeHelper.isDarkTheme();
|
||||
|
||||
if ((isDarkTheme && anyEquals(originalValue, DARKCONSTANTS)) || (!isDarkTheme && anyEquals(originalValue, WHITECONSTANTS)))
|
||||
return 0;
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
private static boolean anyEquals(int value, int... of) {
|
||||
for (int v : of) if (value == v) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import static app.revanced.integrations.sponsorblock.StringRef.str;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
|
||||
public class MicroGSupport {
|
||||
private static final String MICROG_VENDOR = "com.mgoogle";
|
||||
private static final String MICROG_PACKAGE_NAME = "com.mgoogle.android.gms";
|
||||
private static final String VANCED_MICROG_DOWNLOAD_LINK = "https://github.com/TeamVanced/VancedMicroG/releases/latest";
|
||||
|
||||
public static void checkAvailability() {
|
||||
var context = ReVancedUtils.getContext();
|
||||
assert context != null;
|
||||
try {
|
||||
context.getPackageManager().getPackageInfo(MICROG_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
|
||||
LogHelper.debug(ReVancedUtils.class, "MicroG is installed on the device");
|
||||
} catch (PackageManager.NameNotFoundException exception) {
|
||||
LogHelper.printException(ReVancedUtils.class, "MicroG was not found", exception);
|
||||
Toast.makeText(context, str("microg_not_installed_warning"), Toast.LENGTH_LONG).show();
|
||||
|
||||
var intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(VANCED_MICROG_DOWNLOAD_LINK));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
/**
|
||||
* Hooking class for the player controller.
|
||||
*/
|
||||
public final class PlayerControllerPatch {
|
||||
private static final String SEEK_METHOD_NAME = "seekTo";
|
||||
|
||||
private static WeakReference<Object> playerController;
|
||||
private static Method seekMethod;
|
||||
private static long videoLength = 1;
|
||||
|
||||
/**
|
||||
* Hook into PlayerController.onCreate() method.
|
||||
*
|
||||
* @param thisRef Reference to the player controller object.
|
||||
*/
|
||||
public static void playerController_onCreateHook(final Object thisRef) {
|
||||
playerController = new WeakReference<>(thisRef);
|
||||
videoLength = 1;
|
||||
|
||||
try {
|
||||
seekMethod = thisRef.getClass().getMethod(SEEK_METHOD_NAME, Long.TYPE);
|
||||
seekMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
LogHelper.debug(PlayerControllerPatch.class, "Failed to initialize: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current video length.
|
||||
*
|
||||
* @param length The length of the video in milliseconds.
|
||||
*/
|
||||
public static void setCurrentVideoLength(final long length) {
|
||||
LogHelper.debug(PlayerControllerPatch.class, "Setting current video length to " + length);
|
||||
|
||||
videoLength = length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seek on the current video.
|
||||
*
|
||||
* @param millisecond The millisecond to seek the video to.
|
||||
*/
|
||||
public static void seekTo(final long millisecond) {
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
if (seekMethod == null) {
|
||||
LogHelper.debug(PlayerControllerPatch.class, "seekMethod was null");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
LogHelper.debug(PlayerControllerPatch.class, "Seeking to " + millisecond);
|
||||
seekMethod.invoke(playerController.get(), millisecond);
|
||||
} catch (Exception ex) {
|
||||
LogHelper.debug(PlayerControllerPatch.class, "Failed to seek: " + ex.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the current video playing.
|
||||
*
|
||||
* @return The length of the video in milliseconds.
|
||||
*/
|
||||
public static long getCurrentVideoLength() {
|
||||
return videoLength;
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,15 @@ public class ReturnYouTubeDislikePatch {
|
||||
|
||||
/**
|
||||
* Called when the like/dislike button is clicked
|
||||
*
|
||||
* @param vote -1 (dislike), 0 (none) or 1 (like)
|
||||
*/
|
||||
public static void sendVote(int vote) {
|
||||
ReturnYouTubeDislike.sendVote(vote);
|
||||
for (ReturnYouTubeDislike.Vote v : ReturnYouTubeDislike.Vote.values()) {
|
||||
if (v.value == vote) {
|
||||
ReturnYouTubeDislike.sendVote(v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import app.revanced.integrations.utils.SharedPrefHelper;
|
||||
@@ -131,6 +132,9 @@ public class VideoQualityPatch {
|
||||
}
|
||||
|
||||
public static void userChangedQuality(int selectedQuality) {
|
||||
// Do not remember a **new** quality if REMEMBER_VIDEO_QUALITY is true
|
||||
if (SettingsEnum.REMEMBER_VIDEO_QUALITY.getBoolean()) return;
|
||||
|
||||
selectedQuality1 = selectedQuality;
|
||||
userChangedQuality = true;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import app.revanced.integrations.utils.ReVancedUtils;
|
||||
|
||||
public class VideoSpeedPatch {
|
||||
|
||||
public static final float[] videoSpeeds = { 0 }; // Values are useless as they are being overridden by the respective patch
|
||||
public static final float[] videoSpeeds = { 0, 0 }; // Values are useless as they are being overridden by the respective patch
|
||||
private static Boolean userChangedSpeed = false;
|
||||
|
||||
public static int getDefaultSpeed(Object[] speeds, int speed, Object qInterface) {
|
||||
|
||||
@@ -20,6 +20,20 @@ import app.revanced.integrations.utils.SharedPrefHelper;
|
||||
|
||||
public class ReturnYouTubeDislike {
|
||||
private static boolean isEnabled;
|
||||
private static boolean segmentedButton;
|
||||
|
||||
public enum Vote {
|
||||
LIKE(1),
|
||||
DISLIKE(-1),
|
||||
LIKE_REMOVE(0);
|
||||
|
||||
public int value;
|
||||
|
||||
Vote(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
private static Thread _dislikeFetchThread = null;
|
||||
private static Thread _votingThread = null;
|
||||
private static Registration registration;
|
||||
@@ -77,31 +91,29 @@ public class ReturnYouTubeDislike {
|
||||
if (!isEnabled) return;
|
||||
|
||||
try {
|
||||
// Contains a pathBuilder string, used to distinguish from other litho components:
|
||||
// video_action_bar.eml|27b56b54d5dcba20|video_action_bar_unwrapper.eml|c5a1d399b660e52e|CellType
|
||||
// |ScrollableContainerType|ContainerType|ContainerType|dislike_button.eml|966ee2cd7db5e29f
|
||||
// |video_actipathBuilder=video_action_bar.eml|27b56b54d5dcba20|video_action_bar_unwrapper.eml
|
||||
// |c5a1d399b660e52e|CellType|ScrollableContainerType|ContainerType|ContainerType|dislike_button.eml
|
||||
// |966ee2cd7db5e29f|video_action_toggle_button.eml|8fd9d44a8e3c9162|video_action_button.eml
|
||||
// |9dd3b4b44979c3af|ContainerType|TextType|on_toggle_button.eml|8fd9d44a8e3c9162|video_action_button.eml
|
||||
// |9dd3b4b44979c3af|ContainerType|TextType|
|
||||
if (!conversionContext.toString().contains("|dislike_button.eml|")) return;
|
||||
var conversionContextString = conversionContext.toString();
|
||||
|
||||
// Check for new component
|
||||
if (conversionContextString.contains("|segmented_like_dislike_button.eml|"))
|
||||
segmentedButton = true;
|
||||
else if (!conversionContextString.contains("|dislike_button.eml|"))
|
||||
return;
|
||||
|
||||
LogHelper.debug(ReturnYouTubeDislike.class, "dislike button was created");
|
||||
|
||||
// Have to block the current thread until fetching is done
|
||||
// There's no known way to edit the text after creation yet
|
||||
if (_dislikeFetchThread != null) _dislikeFetchThread.join();
|
||||
|
||||
if (dislikeCount != null) {
|
||||
updateDislikeText(textRef, formatDislikes(dislikeCount));
|
||||
}
|
||||
if (dislikeCount == null) return;
|
||||
|
||||
updateDislike(textRef, dislikeCount);
|
||||
LogHelper.debug(ReturnYouTubeDislike.class, "Updated text on component" + conversionContextString);
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(ReturnYouTubeDislike.class, "Error while trying to set dislikes text", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendVote(int vote) {
|
||||
public static void sendVote(Vote vote) {
|
||||
if (!isEnabled) return;
|
||||
|
||||
Context context = ReVancedUtils.getContext();
|
||||
@@ -129,16 +141,23 @@ public class ReturnYouTubeDislike {
|
||||
_votingThread.start();
|
||||
}
|
||||
|
||||
private static void updateDislikeText(AtomicReference<Object> textRef, String text) {
|
||||
SpannableString oldString = (SpannableString) textRef.get();
|
||||
SpannableString newString = new SpannableString(text);
|
||||
private static void updateDislike(AtomicReference<Object> textRef, Integer dislikeCount) {
|
||||
SpannableString oldSpannableString = (SpannableString) textRef.get();
|
||||
|
||||
// parse the buttons string
|
||||
// if the button is segmented, only get the like count as a string
|
||||
var oldButtonString = oldSpannableString.toString();
|
||||
if (segmentedButton) oldButtonString = oldButtonString.split(" \\| ")[0];
|
||||
|
||||
var dislikeString = formatDislikes(dislikeCount);
|
||||
SpannableString newString = new SpannableString(
|
||||
segmentedButton ? (oldButtonString + " | " + dislikeString) : dislikeString
|
||||
);
|
||||
|
||||
// Copy style (foreground color, etc) to new string
|
||||
Object[] spans = oldString.getSpans(0, oldString.length(), Object.class);
|
||||
for (Object span : spans) {
|
||||
int flags = oldString.getSpanFlags(span);
|
||||
newString.setSpan(span, 0, newString.length(), flags);
|
||||
}
|
||||
Object[] spans = oldSpannableString.getSpans(0, oldSpannableString.length(), Object.class);
|
||||
for (Object span : spans)
|
||||
newString.setSpan(span, 0, newString.length(), oldSpannableString.getSpanFlags(span));
|
||||
|
||||
textRef.set(newString);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ public class Voting {
|
||||
this.registration = registration;
|
||||
}
|
||||
|
||||
public boolean sendVote(String videoId, int vote) {
|
||||
public boolean sendVote(String videoId, ReturnYouTubeDislike.Vote vote) {
|
||||
String userId = registration.getUserId();
|
||||
LogHelper.debug(Voting.class, "Trying to vote the following video: " + videoId + " with vote " + vote + " and userId: " + userId);
|
||||
return ReturnYouTubeDislikeApi.sendVote(videoId, userId, vote);
|
||||
return ReturnYouTubeDislikeApi.sendVote(videoId, userId, vote.value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ReturnYouTubeDislikeApi {
|
||||
try {
|
||||
LogHelper.debug(ReturnYouTubeDislikeApi.class, "Fetching dislikes for " + videoId);
|
||||
HttpURLConnection connection = getConnectionFromRoute(ReturnYouTubeDislikeRoutes.GET_DISLIKES, videoId);
|
||||
connection.setConnectTimeout(5 * 1000);
|
||||
connection.setConnectTimeout(1000);
|
||||
if (connection.getResponseCode() == 200) {
|
||||
JSONObject json = getJSONObject(connection);
|
||||
dislikeCount = json.getInt("dislikes");
|
||||
@@ -181,4 +181,4 @@ public class ReturnYouTubeDislikeApi {
|
||||
private static JSONObject getJSONObject(HttpURLConnection connection) throws Exception {
|
||||
return Requester.getJSONObject(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,36 +17,44 @@ public enum SettingsEnum {
|
||||
DOWNLOADS_BUTTON_SHOWN("revanced_downloads", true, ReturnType.BOOLEAN, true),
|
||||
DOWNLOADS_PACKAGE_NAME("revanced_downloads_package_name", "org.schabi.newpipe" /* NewPipe */, ReturnType.STRING),
|
||||
|
||||
//Video Settings
|
||||
// Video settings
|
||||
OLD_STYLE_QUALITY_SETTINGS("revanced_use_old_style_quality_settings", true, ReturnType.BOOLEAN),
|
||||
PREFERRED_VIDEO_SPEED("revanced_pref_video_speed", -2.0f, ReturnType.FLOAT),
|
||||
REMEMBER_VIDEO_QUALITY("revanced_remember_video_quality_selection", false, ReturnType.BOOLEAN),
|
||||
|
||||
//Whitelist Settings
|
||||
// Whitelist settings
|
||||
//ToDo: Not used atm, Patch missing
|
||||
ENABLE_WHITELIST("revanced_whitelist_ads_enabled", false, ReturnType.BOOLEAN),
|
||||
|
||||
//Ad settings
|
||||
// Ad settings
|
||||
ADREMOVER_CUSTOM("revanced_adremover_custom_removal", "", ReturnType.STRING, false),
|
||||
HOME_ADS_REMOVAL("revanced_home_ads_removal", true, ReturnType.BOOLEAN, true),
|
||||
VIDEO_ADS_REMOVAL("revanced_video_ads_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_AD_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_GENERAL_ADS_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_MERCHANDISE_REMOVAL("revanced_adremover_merchandise", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", false, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMPACT_BANNER_REMOVAL("revanced_adremover_compact_banner_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMMENTS_REMOVAL("revanced_adremover_comments_removal", false, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_MOVIE_REMOVAL("revanced_adremover_movie", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_FEED_SURVEY_REMOVAL("revanced_adremover_feed_survey", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_SHORTS_SHELF("revanced_adremover_shorts_shelf", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMMUNITY_GUIDELINES("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_SHORTS_SHELF_REMOVAL("revanced_adremover_shorts_shelf", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_COMMUNITY_GUIDELINES_REMOVAL("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_EMERGENCY_BOX_REMOVAL("revanced_adremover_emergency_box_removal", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_INFO_PANEL_REMOVAL("revanced_adremover_info_panel", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_MEDICAL_PANEL_REMOVAL("revanced_adremover_medical_panel", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_PAID_CONTECT_REMOVAL("revanced_adremover_paid_content", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_SUGGESTED_FOR_YOU_REMOVAL("revanced_adremover_suggested", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_HIDE_SUGGESTIONS("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_SUGGESTIONS_REMOVAL("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_HIDE_LATEST_POSTS("revanced_adremover_hide_latest_posts", true, ReturnType.BOOLEAN, true),
|
||||
ADREMOVER_HIDE_CHANNEL_GUIDELINES("revanced_adremover_hide_channel_guidelines", true, ReturnType.BOOLEAN, true),
|
||||
|
||||
//Layout settings
|
||||
// Action buttons
|
||||
HIDE_LIKE_BUTTON("revanced_like_button", false, ReturnType.BOOLEAN, false),
|
||||
HIDE_DISLIKE_BUTTON("revanced_dislike_button", false, ReturnType.BOOLEAN, false),
|
||||
HIDE_DOWNLOAD_BUTTON("revanced_download_button", false, ReturnType.BOOLEAN, false),
|
||||
HIDE_PLAYLIST_BUTTON("revanced_playlist_button", false, ReturnType.BOOLEAN, false),
|
||||
HIDE_ACTION_BUTTON("revanced_action_button", false, ReturnType.BOOLEAN, false),
|
||||
HIDE_SHARE_BUTTON("revanced_share_button", false, ReturnType.BOOLEAN, false),
|
||||
|
||||
// Layout settings
|
||||
REEL_BUTTON_SHOWN("revanced_reel_button_enabled", false, ReturnType.BOOLEAN, true),
|
||||
INFO_CARDS_SHOWN("revanced_info_cards_enabled", false, ReturnType.BOOLEAN),
|
||||
BRANDING_SHOWN("revanced_branding_watermark_enabled", false, ReturnType.BOOLEAN),
|
||||
@@ -59,15 +67,27 @@ public enum SettingsEnum {
|
||||
FULLSCREEN_PANELS_SHOWN("revanced_fullscreen_panels_enabled", false, ReturnType.BOOLEAN), //ToDo: Add to prefs
|
||||
PLAYER_POPUP_PANELS("revanced_player_popup_panels_enabled", false, ReturnType.BOOLEAN),
|
||||
HIDE_TIME_AND_SEEKBAR("revanced_hide_time_and_seekbar", false, ReturnType.BOOLEAN),
|
||||
HIDE_EMAIL_ADDRESS("revanced_hide_email_address", false, ReturnType.BOOLEAN),
|
||||
DISABLE_STARTUP_SHORTS_PLAYER("revanced_startup_shorts_player_enabled", false, ReturnType.BOOLEAN),
|
||||
HIDE_CAPTIONS_BUTTON("revanced_hide_captions_button", false, ReturnType.BOOLEAN),
|
||||
HIDE_MIX_PLAYLISTS("revanced_mix_playlists_hidden", false, ReturnType.BOOLEAN, true),
|
||||
HIDE_CROWDFUNDING_BOX("revanced_hide_crowdfunding_box", false, ReturnType.BOOLEAN, true),
|
||||
HIDE_COMMENTS_SECTION("revanced_hide_comments_section", false, ReturnType.BOOLEAN, true),
|
||||
HIDE_SHORTS_COMMENTS_BUTTON("revanced_hide_shorts_comments_button", false, ReturnType.BOOLEAN),
|
||||
HIDE_PREVIEW_COMMENT("revanced_hide_preview_comment", false, ReturnType.BOOLEAN, true),
|
||||
HIDE_ALBUM_CARDS("revanced_hide_album_cards", false, ReturnType.BOOLEAN, true),
|
||||
HIDE_ARTIST_CARD("revanced_hide_artist_card", false, ReturnType.BOOLEAN),
|
||||
HIDE_WATCH_IN_VR("revanced_hide_watch_in_vr", false, ReturnType.BOOLEAN, true),
|
||||
|
||||
//Misc. Settings
|
||||
// Misc. Settings
|
||||
FIX_PLAYBACK("revanced_fix_playback", false, ReturnType.BOOLEAN, false),
|
||||
CAPTIONS_ENABLED("revanced_autocaptions_enabled", false, ReturnType.BOOLEAN, false),
|
||||
PREFERRED_AUTO_REPEAT("revanced_pref_auto_repeat", false, ReturnType.BOOLEAN),
|
||||
USE_HDR_AUTO_BRIGHTNESS("revanced_pref_hdr_autobrightness", true, ReturnType.BOOLEAN),
|
||||
TAP_SEEKING_ENABLED("revanced_enable_tap_seeking", true, ReturnType.BOOLEAN),
|
||||
ENABLE_MINIMIZED_PLAYBACK("revanced_enable_minimized_playback", true, ReturnType.BOOLEAN),
|
||||
|
||||
//Swipe controls
|
||||
// Swipe controls
|
||||
ENABLE_SWIPE_BRIGHTNESS("revanced_enable_swipe_brightness", true, ReturnType.BOOLEAN),
|
||||
ENABLE_SWIPE_VOLUME("revanced_enable_swipe_volume", true, ReturnType.BOOLEAN),
|
||||
ENABLE_PRESS_TO_SWIPE("revanced_enable_press_to_swipe", false, ReturnType.BOOLEAN),
|
||||
@@ -77,20 +97,20 @@ public enum SettingsEnum {
|
||||
SWIPE_OVERLAY_BACKGROUND_ALPHA("revanced_swipe_overlay_background_alpha", 127, ReturnType.INTEGER),
|
||||
SWIPE_MAGNITUDE_THRESHOLD("revanced_swipe_magnitude_threshold", 30f, ReturnType.FLOAT),
|
||||
|
||||
//Buffer Settings
|
||||
// Buffer settings
|
||||
MAX_BUFFER("revanced_pref_max_buffer_ms", 120000, ReturnType.INTEGER),
|
||||
PLAYBACK_MAX_BUFFER("revanced_pref_buffer_for_playback_ms", 2500, ReturnType.INTEGER),
|
||||
MAX_PLAYBACK_BUFFER_AFTER_REBUFFER("revanced_pref_buffer_for_playback_after_rebuffer_ms", 5000, ReturnType.INTEGER),
|
||||
|
||||
//ReVanced General Settings
|
||||
// ReVanced settings
|
||||
DEBUG("revanced_debug_enabled", false, ReturnType.BOOLEAN, true),
|
||||
USE_DARK_THEME("app_theme_dark", false, ReturnType.BOOLEAN),
|
||||
|
||||
//RYD Settings
|
||||
// RYD settings
|
||||
RYD_USER_ID("ryd_userId", null, SharedPrefHelper.SharedPrefNames.RYD, ReturnType.STRING),
|
||||
RYD_ENABLED("ryd_enabled", true, SharedPrefHelper.SharedPrefNames.RYD, ReturnType.BOOLEAN),
|
||||
|
||||
//SponsorBlock Settings
|
||||
// SponsorBlock settings
|
||||
SB_ENABLED("sb-enabled", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||
SB_SHOW_TOAST_WHEN_SKIP("show-toast", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||
SB_COUNT_SKIPS("count-skips", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||
@@ -108,7 +128,6 @@ public enum SettingsEnum {
|
||||
SB_SHOW_BROWSER_BUTTON("sb-browser-button", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||
SB_API_URL("sb-api-url", "https://sponsor.ajay.app/api/", SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.STRING);
|
||||
|
||||
public static boolean shorts_playing = false;
|
||||
private final String path;
|
||||
private final Object defaultValue;
|
||||
private final SharedPrefHelper.SharedPrefNames sharedPref;
|
||||
|
||||
@@ -18,7 +18,6 @@ import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.preference.SwitchPreference;
|
||||
|
||||
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
|
||||
import com.google.android.apps.youtube.app.application.Shell_HomeActivity;
|
||||
|
||||
import java.util.List;
|
||||
@@ -174,7 +173,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
||||
*/
|
||||
|
||||
private String getPackageName() {
|
||||
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
||||
Context context = ReVancedUtils.getContext();
|
||||
if (context == null) {
|
||||
LogHelper.printException(ReVancedSettingsFragment.class, "Context is null, returning com.google.android.youtube!");
|
||||
return "com.google.android.youtube";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,6 @@ public class ShieldButton {
|
||||
static boolean isShowing;
|
||||
|
||||
public static void initialize(Object viewStub) {
|
||||
if (SettingsEnum.shorts_playing) return;
|
||||
|
||||
try {
|
||||
LogHelper.debug(ShieldButton.class, "initializing shield button");
|
||||
|
||||
@@ -64,14 +62,10 @@ public class ShieldButton {
|
||||
}
|
||||
|
||||
public static void changeVisibilityNegatedImmediate(boolean visible) {
|
||||
if (SettingsEnum.shorts_playing) return;
|
||||
|
||||
changeVisibility(!visible, true);
|
||||
}
|
||||
|
||||
public static void changeVisibility(boolean visible) {
|
||||
if (SettingsEnum.shorts_playing) return;
|
||||
|
||||
changeVisibility(visible, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ public class SponsorBlockSettings {
|
||||
}
|
||||
|
||||
public enum SegmentBehaviour {
|
||||
SKIP_AUTOMATICALLY_ONCE("skip-once", 3, sf("skip_automatically_once"), true, true),
|
||||
SKIP_AUTOMATICALLY("skip", 2, sf("skip_automatically"), true, true),
|
||||
MANUAL_SKIP("manual-skip", 1, sf("skip_showbutton"), false, true),
|
||||
IGNORE("ignore", -1, sf("skip_ignore"), false, false);
|
||||
|
||||
@@ -403,8 +403,6 @@ public abstract class SponsorBlockUtils {
|
||||
}
|
||||
|
||||
public static String appendTimeWithoutSegments(String totalTime) {
|
||||
if (SettingsEnum.shorts_playing) return totalTime;
|
||||
|
||||
if (videoHasSegments && (SettingsEnum.SB_ENABLED.getBoolean() && SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean()) && !TextUtils.isEmpty(totalTime) && getCurrentVideoLength() > 1) {
|
||||
if (timeWithoutSegments.isEmpty()) {
|
||||
timeWithoutSegments = getTimeWithoutSegments(sponsorSegmentsOfCurrentVideo);
|
||||
|
||||
@@ -27,8 +27,6 @@ public class VotingButton {
|
||||
static boolean isShowing;
|
||||
|
||||
public static void initialize(Object viewStub) {
|
||||
if (SettingsEnum.shorts_playing) return;
|
||||
|
||||
try {
|
||||
LogHelper.debug(VotingButton.class, "initializing voting button");
|
||||
_youtubeControlsLayout = (RelativeLayout) viewStub;
|
||||
@@ -62,14 +60,10 @@ public class VotingButton {
|
||||
}
|
||||
|
||||
public static void changeVisibilityNegatedImmediate(boolean visible) {
|
||||
if (SettingsEnum.shorts_playing) return;
|
||||
|
||||
changeVisibility(!visible, true);
|
||||
}
|
||||
|
||||
public static void changeVisibility(boolean visible) {
|
||||
if (SettingsEnum.shorts_playing) return;
|
||||
|
||||
changeVisibility(visible, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package app.revanced.integrations.sponsorblock.objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import app.revanced.integrations.sponsorblock.SponsorBlockSettings;
|
||||
|
||||
public class SponsorSegment implements Comparable<SponsorSegment> {
|
||||
@@ -8,6 +12,7 @@ public class SponsorSegment implements Comparable<SponsorSegment> {
|
||||
public final SponsorBlockSettings.SegmentInfo category;
|
||||
public final String UUID;
|
||||
public final boolean isLocked;
|
||||
public boolean didAutoSkipped = false;
|
||||
|
||||
public SponsorSegment(long start, long end, SponsorBlockSettings.SegmentInfo category, String UUID, boolean isLocked) {
|
||||
this.start = start;
|
||||
@@ -17,14 +22,10 @@ public class SponsorSegment implements Comparable<SponsorSegment> {
|
||||
this.isLocked = isLocked;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SegmentInfo{" +
|
||||
"start=" + start +
|
||||
", end=" + end +
|
||||
", category='" + category + '\'' +
|
||||
", locked=" + isLocked +
|
||||
'}';
|
||||
return MessageFormat.format("SegmentInfo'{'start={0}, end={1}, category=''{2}'', locked={3}'}'", start, end, category, isLocked);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,13 +44,8 @@ public class VideoHelpers {
|
||||
}
|
||||
|
||||
private static void setClipboard(Context context, String text) {
|
||||
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
clipboard.setText(text);
|
||||
} else {
|
||||
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
android.content.ClipData clip = android.content.ClipData.newPlainText("link", text);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
}
|
||||
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
android.content.ClipData clip = android.content.ClipData.newPlainText("link", text);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user