mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-09 21:49:25 +01:00
Fixes (#34)
* General improvements - Fixed preferences not obtained properly. - Cleaned up libraries and code. - Update deps. * Update README.md
This commit is contained in:
parent
0797155a25
commit
3460237c0f
10
README.md
10
README.md
@ -1,8 +1,10 @@
|
|||||||
# SponsorBlock YouTube Vanced Implementation
|
# SponsorBlock YouTube Vanced Implementation
|
||||||
In order to use this in YouTube/Vanced you must first apply the smali mods applied to vanced (the patching process used for this is currently automated using our closed source tools with no plans to open source it for the time being) (if you mod vanced directly it is not required)
|
In order to use this in YouTube/Vanced you must first apply the smali mods applied to vanced (the patching process used for this is currently automated using our closed source tools with no plans to open source it for the time being) (if you mod vanced directly it is not required)
|
||||||
* First make your edits in android studio and then compile the code to a debug apk
|
* First make your edits in android studio
|
||||||
|
* Change the string "replaceMeWithsetMillisecondMethod" on PlayerController.java to the method name of YouTube package
|
||||||
|
* Compile debug apk
|
||||||
* Decompile this apk using apktool https://github.com/iBotPeaches/Apktool
|
* Decompile this apk using apktool https://github.com/iBotPeaches/Apktool
|
||||||
* Take this decompiled folder and look for a folder labeled pl in one of your dex class folders (usually the second one)
|
* Take this decompiled folder and look for a folder labeled pl in one of your dex class folders
|
||||||
* Decompile YouTube/Vanced using apktool (you only need to decompile the base apk files(for vanced you can get these using vanced manager and looking in android/data/com.vanced.manager for black or dark.apk), if you are decompiling stock youtube you must also merge a dpi split into it (todo))
|
* Decompile YouTube/Vanced using apktool (you only need to decompile the base apk files (for vanced you can get these using vanced manager and looking in android/data/com.vanced.manager for black or dark.apk), if you are decompiling stock youtube you must also merge a dpi split into it (todo))
|
||||||
* Copy the pl folder from earlier into the 4th dex class folder (remove any existing one completely first)
|
* Copy the pl folder from earlier into the dex class folder (remove any existing one completely first)
|
||||||
* Recompile your modded YouTube/Vanced using apktool and sign it + all splits required for your device using the same key
|
* Recompile your modded YouTube/Vanced using apktool and sign it + all splits required for your device using the same key
|
||||||
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
buildToolsVersion "30.0.1"
|
buildToolsVersion "30.0.2"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "pl.jakubweg"
|
applicationId "pl.jakubweg"
|
||||||
@ -10,8 +10,7 @@ android {
|
|||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
multiDexEnabled false
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -20,13 +19,13 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation 'androidx.annotation:annotation:1.2.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
}
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +1,4 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="pl.jakubweg">
|
package="pl.jakubweg">
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
tools:ignore="AllowBackup" />
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -92,7 +92,6 @@ public class InjectedPlugin {
|
|||||||
Log.i(TAG, spacesStr + "Normal view: " + view);
|
Log.i(TAG, spacesStr + "Normal view: " + view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package pl.jakubweg;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -10,6 +11,8 @@ import android.util.Log;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -59,6 +62,13 @@ public class PlayerController {
|
|||||||
|
|
||||||
VideoInformation.currentVideoId = videoId;
|
VideoInformation.currentVideoId = videoId;
|
||||||
|
|
||||||
|
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
||||||
|
if(context == null){
|
||||||
|
Log.e(TAG, "context is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SponsorBlockSettings.update(context);
|
||||||
|
|
||||||
if (!SponsorBlockSettings.isSponsorBlockEnabled) {
|
if (!SponsorBlockSettings.isSponsorBlockEnabled) {
|
||||||
currentVideoId = null;
|
currentVideoId = null;
|
||||||
return;
|
return;
|
||||||
|
@ -34,7 +34,6 @@ public class ShieldButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_youtubeControlsLayout = (RelativeLayout) viewStub;
|
_youtubeControlsLayout = (RelativeLayout) viewStub;
|
||||||
initButtonVisibilitySettings();
|
|
||||||
|
|
||||||
ImageView imageView = (ImageView)_youtubeControlsLayout
|
ImageView imageView = (ImageView)_youtubeControlsLayout
|
||||||
.findViewById(getIdentifier("sponsorblock_button", "id"));
|
.findViewById(getIdentifier("sponsorblock_button", "id"));
|
||||||
@ -107,20 +106,6 @@ public class ShieldButton {
|
|||||||
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initButtonVisibilitySettings() {
|
|
||||||
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
|
||||||
if(context == null){
|
|
||||||
Log.e(TAG, "context is null");
|
|
||||||
SponsorBlockSettings.isSponsorBlockEnabled = false;
|
|
||||||
SponsorBlockSettings.isAddNewSegmentEnabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = context.getSharedPreferences(SponsorBlockSettings.PREFERENCES_NAME, Context.MODE_PRIVATE);
|
|
||||||
SponsorBlockSettings.isSponsorBlockEnabled = sharedPreferences.getBoolean(SponsorBlockSettings.PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED, false);
|
|
||||||
SponsorBlockSettings.isAddNewSegmentEnabled = sharedPreferences.getBoolean(SponsorBlockSettings.PREFERENCES_KEY_NEW_SEGMENT_ENABLED, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//region Helpers
|
//region Helpers
|
||||||
private static int getIdentifier(String name, String defType) {
|
private static int getIdentifier(String name, String defType) {
|
||||||
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
||||||
|
@ -36,7 +36,6 @@ import static pl.jakubweg.SponsorBlockSettings.showToastWhenSkippedAutomatically
|
|||||||
import static pl.jakubweg.SponsorBlockSettings.uuid;
|
import static pl.jakubweg.SponsorBlockSettings.uuid;
|
||||||
import static pl.jakubweg.StringRef.str;
|
import static pl.jakubweg.StringRef.str;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "deprecation"}) // injected
|
@SuppressWarnings({"unused", "deprecation"}) // injected
|
||||||
public class SponsorBlockPreferenceFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class SponsorBlockPreferenceFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@ -54,6 +53,8 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment implement
|
|||||||
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(context);
|
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(context);
|
||||||
setPreferenceScreen(preferenceScreen);
|
setPreferenceScreen(preferenceScreen);
|
||||||
|
|
||||||
|
SponsorBlockSettings.update(context);
|
||||||
|
|
||||||
{
|
{
|
||||||
SwitchPreference preference = new SwitchPreference(context);
|
SwitchPreference preference = new SwitchPreference(context);
|
||||||
preferenceScreen.addPreference(preference);
|
preferenceScreen.addPreference(preference);
|
||||||
|
@ -86,7 +86,7 @@ public class SponsorBlockSettings {
|
|||||||
SponsorBlockUtils.hideShieldButton();
|
SponsorBlockUtils.hideShieldButton();
|
||||||
SponsorBlockUtils.hideVoteButton();
|
SponsorBlockUtils.hideVoteButton();
|
||||||
PlayerController.sponsorSegmentsOfCurrentVideo = null;
|
PlayerController.sponsorSegmentsOfCurrentVideo = null;
|
||||||
} else if (/*isAddNewSegmentEnabled*/false) {
|
} else { /*isAddNewSegmentEnabled*/
|
||||||
SponsorBlockUtils.showShieldButton();
|
SponsorBlockUtils.showShieldButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,5 +602,4 @@ public abstract class SponsorBlockUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,4 @@ public class SponsorSegment implements Comparable<SponsorSegment> {
|
|||||||
public int compareTo(SponsorSegment o) {
|
public int compareTo(SponsorSegment o) {
|
||||||
return (int) (this.start - o.start);
|
return (int) (this.start - o.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ public class VotingButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_youtubeControlsLayout = (RelativeLayout) viewStub;
|
_youtubeControlsLayout = (RelativeLayout) viewStub;
|
||||||
initButtonVisibilitySettings();
|
|
||||||
|
|
||||||
ImageView imageView = (ImageView)_youtubeControlsLayout
|
ImageView imageView = (ImageView)_youtubeControlsLayout
|
||||||
.findViewById(getIdentifier("voting_button", "id"));
|
.findViewById(getIdentifier("voting_button", "id"));
|
||||||
@ -107,20 +106,6 @@ public class VotingButton {
|
|||||||
return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled;
|
return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initButtonVisibilitySettings() {
|
|
||||||
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
|
||||||
if(context == null){
|
|
||||||
Log.e(TAG, "context is null");
|
|
||||||
SponsorBlockSettings.isSponsorBlockEnabled = false;
|
|
||||||
SponsorBlockSettings.isVotingEnabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = context.getSharedPreferences(SponsorBlockSettings.PREFERENCES_NAME, Context.MODE_PRIVATE);
|
|
||||||
SponsorBlockSettings.isSponsorBlockEnabled = sharedPreferences.getBoolean(SponsorBlockSettings.PREFERENCES_KEY_SPONSOR_BLOCK_ENABLED, false);
|
|
||||||
SponsorBlockSettings.isVotingEnabled = sharedPreferences.getBoolean(SponsorBlockSettings.PREFERENCES_KEY_VOTING_ENABLED, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//region Helpers
|
//region Helpers
|
||||||
private static int getIdentifier(String name, String defType) {
|
private static int getIdentifier(String name, String defType) {
|
||||||
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
Context context = YouTubeTikTokRoot_Application.getAppContext();
|
||||||
|
@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:4.0.1"
|
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Tue Aug 18 22:56:28 EEST 2020
|
#Mon Jun 07 19:51:48 CEST 2021
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
Loading…
Reference in New Issue
Block a user