forked from ReVanced/revanced-integrations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c945e2
commit 57be50c
Showing
39 changed files
with
5,183 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ | |
.externalNativeBuild | ||
.cxx | ||
/.idea | ||
/.vscode | ||
/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1 @@ | ||
# 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) | ||
* 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 | ||
* 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)) | ||
* 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 | ||
# ReVanced Integrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="vanced.integrations"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" /> | ||
</manifest> |
160 changes: 160 additions & 0 deletions
160
app/src/main/java/fi/razerman/youtube/Autorepeat/AutoRepeat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
package fi.razerman.youtube.Autorepeat; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.view.animation.Animation; | ||
import android.view.animation.AnimationUtils; | ||
import android.widget.ImageView; | ||
|
||
import androidx.constraintlayout.widget.ConstraintLayout; | ||
|
||
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application; | ||
import fi.razerman.youtube.VideoUrl.Copy; | ||
import fi.razerman.youtube.VideoUrl.CopyWithTimeStamp; | ||
import fi.razerman.youtube.XGlobals; | ||
import java.lang.ref.WeakReference; | ||
|
||
/* loaded from: classes6.dex */ | ||
public class AutoRepeat { | ||
static WeakReference<ImageView> _autoRepeatBtn = new WeakReference<>(null); | ||
static ConstraintLayout _constraintLayout; | ||
static int fadeDurationFast; | ||
static int fadeDurationScheduled; | ||
static Animation fadeIn; | ||
static Animation fadeOut; | ||
public static boolean isAutoRepeatBtnEnabled; | ||
static boolean isShowing; | ||
|
||
public static void initializeAutoRepeat(Object constraintLayout) { | ||
try { | ||
if (XGlobals.debug) { | ||
Log.d("AutoRepeat", "initializing auto repeat"); | ||
} | ||
CopyWithTimeStamp.initializeCopyButtonWithTimeStamp(constraintLayout); | ||
Copy.initializeCopyButton(constraintLayout); | ||
_constraintLayout = (ConstraintLayout) constraintLayout; | ||
isAutoRepeatBtnEnabled = shouldBeShown(); | ||
ImageView imageView = _constraintLayout.findViewById(getIdentifier("autoreplay_button", "id")); | ||
if (XGlobals.debug && imageView == null) { | ||
Log.d("AutoRepeat", "Couldn't find imageView with tag \"autoreplay_button\""); | ||
} | ||
if (imageView != null) { | ||
imageView.setSelected(shouldBeSelected()); | ||
imageView.setOnClickListener(new View.OnClickListener() { // from class: fi.razerman.youtube.Autorepeat.AutoRepeat.1 | ||
@Override // android.view.View.OnClickListener | ||
public void onClick(View v) { | ||
if (XGlobals.debug) { | ||
Log.d("AutoRepeat", "Auto repeat button clicked"); | ||
} | ||
AutoRepeat.changeSelected(!v.isSelected()); | ||
} | ||
}); | ||
_autoRepeatBtn = new WeakReference<>(imageView); | ||
fadeDurationFast = getInteger("fade_duration_fast"); | ||
fadeDurationScheduled = getInteger("fade_duration_scheduled"); | ||
fadeIn = getAnimation("fade_in"); | ||
fadeIn.setDuration(fadeDurationFast); | ||
fadeOut = getAnimation("fade_out"); | ||
fadeOut.setDuration(fadeDurationScheduled); | ||
isShowing = true; | ||
changeVisibility(false); | ||
} | ||
} catch (Exception ex) { | ||
Log.e("XError", "Unable to set FrameLayout", ex); | ||
} | ||
} | ||
|
||
public static void changeVisibility(boolean visible) { | ||
CopyWithTimeStamp.changeVisibility(visible); | ||
Copy.changeVisibility(visible); | ||
if (isShowing != visible) { | ||
isShowing = visible; | ||
ImageView iView = _autoRepeatBtn.get(); | ||
if (_constraintLayout != null && iView != null) { | ||
if (visible && isAutoRepeatBtnEnabled) { | ||
if (XGlobals.debug) { | ||
Log.d("AutoRepeat", "Fading in"); | ||
} | ||
iView.setVisibility(View.VISIBLE); | ||
iView.startAnimation(fadeIn); | ||
} else if (iView.getVisibility() == View.VISIBLE) { | ||
if (XGlobals.debug) { | ||
Log.d("AutoRepeat", "Fading out"); | ||
} | ||
iView.startAnimation(fadeOut); | ||
iView.setVisibility(View.GONE); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public static void changeSelected(boolean selected) { | ||
changeSelected(selected, false); | ||
} | ||
|
||
public static void changeSelected(boolean selected, boolean onlyView) { | ||
ImageView iView = _autoRepeatBtn.get(); | ||
if (_constraintLayout != null && iView != null) { | ||
if (XGlobals.debug) { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("Changing selected state to: "); | ||
sb.append(selected ? "SELECTED" : "NONE"); | ||
Log.d("AutoRepeat", sb.toString()); | ||
} | ||
iView.setSelected(selected); | ||
if (!onlyView) { | ||
setSelected(selected); | ||
} | ||
} | ||
} | ||
|
||
private static boolean shouldBeSelected() { | ||
Context context = YouTubeTikTokRoot_Application.getAppContext(); | ||
if (context == null) { | ||
Log.e("AutoRepeat", "ChangeSelected - context is null!"); | ||
return false; | ||
} | ||
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0); | ||
return sharedPreferences.getBoolean("pref_auto_repeat", false); | ||
} | ||
|
||
private static void setSelected(boolean selected) { | ||
try { | ||
Context context = YouTubeTikTokRoot_Application.getAppContext(); | ||
if (context == null) { | ||
Log.e("AutoRepeat", "ChangeSelected - context is null!"); | ||
return; | ||
} | ||
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0); | ||
sharedPreferences.edit().putBoolean("pref_auto_repeat", selected).apply(); | ||
} catch (Exception ignored) { | ||
} | ||
} | ||
|
||
private static boolean shouldBeShown() { | ||
Context context = YouTubeTikTokRoot_Application.getAppContext(); | ||
if (context == null) { | ||
Log.e("AutoRepeat", "ChangeSelected - context is null!"); | ||
return false; | ||
} | ||
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0); | ||
return sharedPreferences.getBoolean("pref_auto_repeat_button", false); | ||
} | ||
|
||
private static int getIdentifier(String name, String defType) { | ||
Context context = YouTubeTikTokRoot_Application.getAppContext(); | ||
return context.getResources().getIdentifier(name, defType, context.getPackageName()); | ||
} | ||
|
||
private static int getInteger(String name) { | ||
Context context = YouTubeTikTokRoot_Application.getAppContext(); | ||
return context.getResources().getInteger(getIdentifier(name, "integer")); | ||
} | ||
|
||
private static Animation getAnimation(String name) { | ||
Context context = YouTubeTikTokRoot_Application.getAppContext(); | ||
return AnimationUtils.loadAnimation(context, getIdentifier(name, "anim")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package fi.razerman.youtube; | ||
|
||
import android.content.Context; | ||
import android.net.ConnectivityManager; | ||
import android.net.NetworkInfo; | ||
|
||
/* loaded from: classes6.dex */ | ||
public class Connectivity { | ||
public static NetworkInfo getNetworkInfo(Context context) { | ||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | ||
return cm.getActiveNetworkInfo(); | ||
} | ||
|
||
public static boolean isConnected(Context context) { | ||
NetworkInfo info = getNetworkInfo(context); | ||
return info != null && info.isConnected(); | ||
} | ||
|
||
public static boolean isConnectedWifi(Context context) { | ||
NetworkInfo info = getNetworkInfo(context); | ||
return info != null && info.isConnected() && info.getType() == 1; | ||
} | ||
|
||
public static boolean isConnectedMobile(Context context) { | ||
NetworkInfo info = getNetworkInfo(context); | ||
return info != null && info.isConnected() && info.getType() == 0; | ||
} | ||
|
||
public static boolean isConnectedFast(Context context) { | ||
NetworkInfo info = getNetworkInfo(context); | ||
return info != null && info.isConnected() && isConnectionFast(info.getType(), info.getSubtype()); | ||
} | ||
|
||
public static boolean isConnectionFast(int type, int subType) { | ||
if (type == 1) { | ||
return true; | ||
} | ||
if (type != 0) { | ||
return false; | ||
} | ||
switch (subType) { | ||
case 1: | ||
return false; | ||
case 2: | ||
return false; | ||
case 3: | ||
case 5: | ||
case 6: | ||
case 8: | ||
case 9: | ||
case 10: | ||
case 12: | ||
case 13: | ||
case 14: | ||
case 15: | ||
return true; | ||
case 4: | ||
return false; | ||
case 7: | ||
return false; | ||
case 11: | ||
return false; | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package fi.razerman.youtube.Fenster; | ||
|
||
/* loaded from: classes6.dex */ | ||
public enum Coverage { | ||
FULL, | ||
RIGHT, | ||
LEFT | ||
} |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/fi/razerman/youtube/Fenster/FensterEventsListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package fi.razerman.youtube.Fenster; | ||
|
||
import android.view.MotionEvent; | ||
|
||
/* loaded from: classes6.dex */ | ||
public interface FensterEventsListener { | ||
void onDown(MotionEvent motionEvent); | ||
|
||
void onHorizontalScroll(MotionEvent motionEvent, float f); | ||
|
||
void onSwipeBottom(); | ||
|
||
void onSwipeLeft(); | ||
|
||
void onSwipeRight(); | ||
|
||
void onSwipeTop(); | ||
|
||
void onTap(); | ||
|
||
void onUp(); | ||
|
||
void onVerticalScroll(MotionEvent motionEvent, float f); | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/java/fi/razerman/youtube/Fenster/FensterGestureController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package fi.razerman.youtube.Fenster; | ||
|
||
import android.content.Context; | ||
import android.util.Log; | ||
import android.view.GestureDetector; | ||
import android.view.MotionEvent; | ||
import android.view.ViewConfiguration; | ||
import fi.razerman.youtube.XGlobals; | ||
|
||
/* loaded from: classes6.dex */ | ||
public class FensterGestureController { | ||
public boolean TouchesEnabled = false; | ||
private GestureDetector gestureDetector; | ||
public FensterEventsListener listener; | ||
|
||
public boolean onTouchEvent(MotionEvent event) { | ||
if (event == null || !this.TouchesEnabled || event.getPointerCount() > 1) { | ||
return false; | ||
} | ||
if (event.getAction() == 1) { | ||
this.listener.onUp(); | ||
if (XGlobals.debug) { | ||
Log.i("TouchTest", "Touch up"); | ||
} | ||
} | ||
return this.gestureDetector.onTouchEvent(event); | ||
} | ||
|
||
public void setFensterEventsListener(FensterEventsListener listener, Context context, ViewConfiguration viewConfiguration) { | ||
this.listener = listener; | ||
this.gestureDetector = new GestureDetector(context, new FensterGestureListener(listener, viewConfiguration)); | ||
} | ||
} |
Oops, something went wrong.