feat: implement missing classes

This commit is contained in:
she11sh0cked 2022-03-25 11:20:56 +01:00
parent bc4e9f8ebb
commit a12709d243
36 changed files with 5180 additions and 7 deletions

View File

@ -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>

View File

@ -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"));
}
}

View File

@ -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;
}
}
}

View File

@ -0,0 +1,8 @@
package fi.razerman.youtube.Fenster;
/* loaded from: classes6.dex */
public enum Coverage {
FULL,
RIGHT,
LEFT
}

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -0,0 +1,128 @@
package fi.razerman.youtube.Fenster;
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 FensterGestureListener implements GestureDetector.OnGestureListener {
public static final String TAG = "FensterGestureListener";
private boolean ignoreScroll = false;
private final FensterEventsListener listener;
private final int minFlingVelocity;
public static int SWIPE_THRESHOLD = 0;
public static int TOP_PADDING = 20;
public FensterGestureListener(FensterEventsListener listener, ViewConfiguration viewConfiguration) {
this.listener = listener;
this.minFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
}
@Override // android.view.GestureDetector.OnGestureListener
public boolean onSingleTapUp(MotionEvent e) {
this.listener.onTap();
return false;
}
@Override // android.view.GestureDetector.OnGestureListener
public void onLongPress(MotionEvent e) {
if (XGlobals.debug) {
Log.i(TAG, "Long Press");
}
}
@Override // android.view.GestureDetector.OnGestureListener
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (XGlobals.debug) {
Log.i(TAG, "Scroll");
}
if (e1 == null || e2 == null) {
if (e1 == null && XGlobals.debug) {
Log.d("XDebug", "e1 is null");
}
if (e2 == null && XGlobals.debug) {
Log.d("XDebug", "e2 is null");
}
return false;
} else if (this.ignoreScroll) {
if (XGlobals.debug) {
Log.i(TAG, "Scroll ignored");
}
return false;
} else {
float deltaY = e2.getY() - e1.getY();
float deltaX = e2.getX() - e1.getX();
if (Math.abs(deltaX) > Math.abs(deltaY)) {
if (Math.abs(deltaX) > SWIPE_THRESHOLD) {
this.listener.onHorizontalScroll(e2, deltaX);
if (deltaX > 0.0f) {
if (XGlobals.debug) {
Log.i(TAG, "Slide right");
}
} else if (XGlobals.debug) {
Log.i(TAG, "Slide left");
}
}
} else if (Math.abs(deltaY) > SWIPE_THRESHOLD) {
this.listener.onVerticalScroll(e2, deltaY);
if (deltaY > 0.0f) {
if (XGlobals.debug) {
Log.i(TAG, "Slide down");
}
} else if (XGlobals.debug) {
Log.i(TAG, "Slide up");
}
}
return false;
}
}
@Override // android.view.GestureDetector.OnGestureListener
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (XGlobals.debug) {
Log.i(TAG, "Fling");
}
try {
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > this.minFlingVelocity) {
if (diffX > 0.0f) {
this.listener.onSwipeRight();
} else {
this.listener.onSwipeLeft();
}
}
} else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > this.minFlingVelocity) {
if (diffY > 0.0f) {
this.listener.onSwipeBottom();
} else {
this.listener.onSwipeTop();
}
}
return true;
} catch (Exception exception) {
exception.printStackTrace();
return false;
}
}
@Override // android.view.GestureDetector.OnGestureListener
public void onShowPress(MotionEvent e) {
if (XGlobals.debug) {
Log.i(TAG, "Show Press");
}
}
@Override // android.view.GestureDetector.OnGestureListener
public boolean onDown(MotionEvent e) {
if (XGlobals.debug) {
Log.i(TAG, "Down - x: " + e.getX() + " y: " + e.getY());
}
this.ignoreScroll = e.getY() <= TOP_PADDING;
this.listener.onDown(e);
return false;
}
}

View File

@ -0,0 +1,54 @@
package fi.razerman.youtube.Fenster.Helpers;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.provider.Settings;
import android.util.Log;
import android.view.WindowManager;
import fi.razerman.youtube.XGlobals;
/* loaded from: classes6.dex */
public class BrightnessHelper {
static Context bContext;
public static float getBrightness() {
Context context = bContext;
if (context == null) {
return -1.0f;
}
return ((Activity) context).getWindow().getAttributes().screenBrightness;
}
public static int getBrightness(Context context) {
bContext = context;
return (int) (((Activity) context).getWindow().getAttributes().screenBrightness * 100.0f);
}
public static void setBrightness(Context context, int brightness) {
if (XGlobals.debug) {
Log.d("XDebug", "Setting brightness: " + brightness);
}
float bright = brightness / 100.0f;
WindowManager.LayoutParams lp = ((Activity) context).getWindow().getAttributes();
lp.screenBrightness = bright;
((Activity) context).getWindow().setAttributes(lp);
}
public static void setBrightness2(Context context, int brightness) {
if (XGlobals.debug) {
Log.d("XDebug", "Setting brightness: " + brightness);
}
ContentResolver cResolver = context.getContentResolver();
Settings.System.putInt(cResolver, "screen_brightness", brightness);
}
public static int getBrightness2(Context context) {
ContentResolver cResolver = context.getContentResolver();
try {
return Settings.System.getInt(cResolver, "screen_brightness");
} catch (Settings.SettingNotFoundException e) {
return 0;
}
}
}

View File

@ -0,0 +1,7 @@
package fi.razerman.youtube.Fenster;
/* loaded from: classes6.dex */
public enum Orientation {
HORIZONTAL,
VERTICAL
}

View File

@ -0,0 +1,133 @@
package fi.razerman.youtube.Fenster.Seekbar;
import android.content.Context;
import android.os.Handler;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.android.apps.youtube.app.common.player.overlay.YouTubePlayerOverlaysLayout;
import fi.razerman.youtube.Fenster.Helpers.BrightnessHelper;
import fi.razerman.youtube.Helpers.SharedPrefs;
import fi.razerman.youtube.XGlobals;
/* loaded from: classes6.dex */
public class BrightnessSeekBar {
public static final int MAX_BRIGHTNESS = 100;
public static final int MIN_BRIGHTNESS = 0;
public static final String TAG = "XDebug";
public int Max;
public int Progress;
private boolean enabled;
Handler handler;
private final String mBrightnessKey = "xfile_brightness_value";
Context mContext;
TextView mTextView;
ViewGroup mViewGroup;
public void initialise(Context context, ViewGroup viewGroup) {
this.enabled = false;
this.mViewGroup = viewGroup;
this.mContext = context;
float systemBrightness = Settings.System.getFloat(this.mContext.getContentResolver(), "screen_brightness", -1.0f);
int _systemBrightness = (int) ((systemBrightness / 255.0f) * 100.0f);
this.Progress = SharedPrefs.getInt(this.mContext, "xfile_brightness_value", Integer.valueOf(_systemBrightness)).intValue();
this.Max = 100;
this.mTextView = new TextView(context);
this.mTextView.setTextSize(24.0f);
this.mTextView.setBackgroundColor(Integer.MIN_VALUE);
this.mTextView.setTextColor(-1);
this.mViewGroup.addView(this.mTextView);
}
public void refreshViewGroup(ViewGroup viewGroup) {
if (this.mTextView.getParent() != null) {
((ViewGroup) this.mTextView.getParent()).removeView(this.mTextView);
}
this.mContext = YouTubePlayerOverlaysLayout.overlayContext;
this.mViewGroup = viewGroup;
this.mViewGroup.addView(this.mTextView);
}
private void updateBrightnessProgress() {
this.Progress = BrightnessHelper.getBrightness(this.mContext);
if (this.mTextView != null) {
this.mTextView.setText("Brightness: " + this.Progress);
if (!isVisible()) {
this.mTextView.setVisibility(View.VISIBLE);
}
}
if (XGlobals.debug) {
Log.d("XDebug", "updateBrightnessProgress: " + this.Progress);
}
}
private void disableBrightness() {
BrightnessHelper.setBrightness(this.mContext, -1);
}
public void setBrightness(int brightness) {
if (this.enabled) {
if (brightness < 0) {
brightness = 0;
} else if (brightness > 100) {
brightness = 100;
}
BrightnessHelper.setBrightness(this.mContext, brightness);
updateBrightnessProgress();
}
}
public void manuallyUpdate(int update) {
if (this.enabled) {
setBrightness(update);
}
}
public void hide() {
if (isVisible()) {
this.mTextView.setVisibility(View.INVISIBLE);
}
}
public void hideDelayed() {
if (this.handler == null) {
this.handler = new Handler();
}
this.handler.postDelayed(new Runnable() { // from class: fi.razerman.youtube.Fenster.Seekbar.BrightnessSeekBar.1
@Override // java.lang.Runnable
public void run() {
BrightnessSeekBar.this.hide();
}
}, 2000L);
}
public boolean isVisible() {
if (this.mTextView != null && this.mTextView.getVisibility() == View.VISIBLE) {
return true;
}
return false;
}
public void disable() {
this.enabled = false;
SharedPrefs.saveInt(this.mContext, "xfile_brightness_value", Integer.valueOf(this.Progress));
disableBrightness();
Log.d("XDebug", "Brightness swipe disabled");
}
public void enable() {
this.enabled = true;
float systemBrightness = Settings.System.getFloat(this.mContext.getContentResolver(), "screen_brightness", -1.0f);
int _systemBrightness = (int) ((systemBrightness / 255.0f) * 100.0f);
int brightness = SharedPrefs.getInt(this.mContext, "xfile_brightness_value", Integer.valueOf(_systemBrightness)).intValue();
if (brightness < 0) {
brightness = 0;
} else if (brightness > 100) {
brightness = 100;
}
BrightnessHelper.setBrightness(this.mContext, brightness);
Log.d("XDebug", "Brightness swipe enabled");
}
}

View File

@ -0,0 +1,124 @@
package fi.razerman.youtube.Fenster.Seekbar;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import fi.razerman.youtube.XGlobals;
/* loaded from: classes6.dex */
public class VolumeSeekBar {
public int Max;
public int Progress;
private AudioManager audioManager;
private boolean enabled;
Handler handler;
private boolean isRegistered;
private Context mContext;
TextView mTextView;
ViewGroup mViewGroup;
private final BroadcastReceiver volumeReceiver = new BroadcastReceiver() { // from class: fi.razerman.youtube.Fenster.Seekbar.VolumeSeekBar.1
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
VolumeSeekBar.this.updateVolumeProgress();
VolumeSeekBar.this.hideDelayed();
}
};
public void initialise(Context context, ViewGroup viewGroup) {
this.enabled = false;
this.mViewGroup = viewGroup;
this.mContext = context;
this.audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
this.Max = this.audioManager.getStreamMaxVolume(3);
this.Progress = this.audioManager.getStreamVolume(3);
this.mTextView = new TextView(context);
this.mTextView.setTextSize(24.0f);
this.mTextView.setBackgroundColor(Integer.MIN_VALUE);
this.mTextView.setTextColor(-1);
this.mViewGroup.addView(this.mTextView);
}
public void refreshViewGroup(ViewGroup viewGroup) {
if (this.mTextView.getParent() != null) {
((ViewGroup) this.mTextView.getParent()).removeView(this.mTextView);
}
this.mViewGroup = viewGroup;
this.mViewGroup.addView(this.mTextView);
}
/* JADX INFO: Access modifiers changed from: private */
public void updateVolumeProgress() {
this.Progress = this.audioManager.getStreamVolume(3);
if (this.mTextView != null) {
this.mTextView.setText("Volume: " + this.Progress);
if (!isVisible()) {
this.mTextView.setVisibility(View.VISIBLE);
}
}
if (XGlobals.debug) {
Log.d("XDebug", "updateVolumeProgress: " + this.Progress);
}
}
private void setVolume(int volume) {
this.audioManager.setStreamVolume(3, volume, 0);
updateVolumeProgress();
}
private void registerVolumeReceiver() {
this.mContext.registerReceiver(this.volumeReceiver, new IntentFilter("android.media.VOLUME_CHANGED_ACTION"));
this.isRegistered = true;
}
public void unregisterVolumeReceiver() {
this.mContext.unregisterReceiver(this.volumeReceiver);
this.isRegistered = false;
}
public void manuallyUpdate(int update) {
if (this.enabled) {
setVolume(update);
}
}
public void hide() {
if (isVisible()) {
this.mTextView.setVisibility(View.INVISIBLE);
}
}
public void hideDelayed() {
if (this.handler == null) {
this.handler = new Handler();
}
// from class: fi.razerman.youtube.Fenster.Seekbar.VolumeSeekBar.2
// java.lang.Runnable
this.handler.postDelayed(VolumeSeekBar.this::hide, 2000L);
}
public boolean isVisible() {
return this.mTextView != null && this.mTextView.getVisibility() == View.VISIBLE;
}
public void disable() {
this.enabled = false;
if (this.isRegistered) {
unregisterVolumeReceiver();
}
}
public void enable() {
this.enabled = true;
this.Progress = this.audioManager.getStreamVolume(3);
if (!this.isRegistered) {
registerVolumeReceiver();
}
}
}

View File

@ -0,0 +1,307 @@
package fi.razerman.youtube.Fenster;
import android.content.Context;
import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.Fenster.Seekbar.BrightnessSeekBar;
import fi.razerman.youtube.Fenster.Seekbar.VolumeSeekBar;
import fi.razerman.youtube.Helpers.XSwipeHelper;
import fi.razerman.youtube.XGlobals;
/* loaded from: classes6.dex */
public class XFenster implements FensterEventsListener {
public static final int ONE_FINGER = 1;
public static final String TAG = "XDebug";
Handler handler;
float mBrightnessDownPos;
int mBrightnessDownProgress;
ViewGroup mViewGroup;
float mVolumeDownPos;
int mVolumeDownProgress;
float mTouchProgressOffset = 0.0f;
protected int mPaddingTop = 0;
protected int mPaddingBottom = 0;
protected int mPaddingLeft = 0;
protected int mPaddingRight = 0;
Orientation brightnessOrientation = Orientation.VERTICAL;
Orientation volumeOrientation = Orientation.VERTICAL;
Coverage brightnessCoverage = Coverage.LEFT;
Coverage volumeCoverage = Coverage.RIGHT;
BrightnessSeekBar mBrightness = new BrightnessSeekBar();
VolumeSeekBar mVolume = new VolumeSeekBar();
public XFenster(Context context, ViewGroup viewGroup) {
this.mViewGroup = viewGroup;
this.mBrightness.initialise(context, viewGroup);
this.mVolume.initialise(context, viewGroup);
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onTap() {
if (XGlobals.debug) {
Log.d("XDebug", "onTap");
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onHorizontalScroll(MotionEvent event, float delta) {
if (XGlobals.debug) {
Log.d("XDebug", "onHorizontalScroll - y: " + ((int) event.getY()) + " x: " + ((int) event.getX()));
}
if (event.getPointerCount() == 1) {
if (this.brightnessOrientation == Orientation.HORIZONTAL && (this.brightnessCoverage == Coverage.FULL || getCoverageHorizontal(event) == this.brightnessCoverage)) {
updateBrightnessProgressBarHorizontal(event);
}
if (this.volumeOrientation != Orientation.HORIZONTAL) {
return;
}
if (this.volumeCoverage == Coverage.FULL || getCoverageHorizontal(event) == this.volumeCoverage) {
updateVolumeProgressBarHorizontal(event);
}
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onVerticalScroll(MotionEvent event, float delta) {
if (XGlobals.debug) {
Log.d("XDebug", "onVerticalScroll - y: " + ((int) event.getY()) + " x: " + ((int) event.getX()));
}
if (event.getPointerCount() == 1) {
if (this.brightnessOrientation == Orientation.VERTICAL && (this.brightnessCoverage == Coverage.FULL || getCoverageVertical(event) == this.brightnessCoverage)) {
updateBrightnessProgressBarVertical(event);
}
if (this.volumeOrientation != Orientation.VERTICAL) {
return;
}
if (this.volumeCoverage == Coverage.FULL || getCoverageVertical(event) == this.volumeCoverage) {
updateVolumeProgressBarVertical(event);
}
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onSwipeRight() {
if (XGlobals.debug) {
Log.d("XDebug", "onSwipeRight");
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onSwipeLeft() {
if (XGlobals.debug) {
Log.d("XDebug", "onSwipeLeft");
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onSwipeBottom() {
if (XGlobals.debug) {
Log.d("XDebug", "onSwipeBottom");
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onSwipeTop() {
if (XGlobals.debug) {
Log.d("XDebug", "onSwipeTop");
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onDown(MotionEvent event) {
if (XGlobals.debug) {
Log.d("XDebug", "onDown");
}
if (event.getPointerCount() == 1) {
if (this.brightnessOrientation == Orientation.VERTICAL && (this.brightnessCoverage == Coverage.FULL || getCoverageVertical(event) == this.brightnessCoverage)) {
this.mBrightnessDownPos = getProgressVertical(event, this.mBrightness.Max);
}
if (this.volumeOrientation == Orientation.VERTICAL && (this.volumeCoverage == Coverage.FULL || getCoverageVertical(event) == this.volumeCoverage)) {
this.mVolumeDownPos = getProgressVertical(event, this.mVolume.Max);
}
if (this.brightnessOrientation == Orientation.HORIZONTAL && (this.brightnessCoverage == Coverage.FULL || getCoverageHorizontal(event) == this.brightnessCoverage)) {
this.mBrightnessDownPos = getProgressHorizontal(event, this.mBrightness.Max);
}
if (this.volumeOrientation == Orientation.HORIZONTAL && (this.volumeCoverage == Coverage.FULL || getCoverageHorizontal(event) == this.volumeCoverage)) {
this.mVolumeDownPos = getProgressHorizontal(event, this.mVolume.Max);
}
this.mVolumeDownProgress = this.mVolume.Progress;
this.mBrightnessDownProgress = this.mBrightness.Progress;
}
}
@Override // fi.razerman.youtube.Fenster.FensterEventsListener
public void onUp() {
Log.d("XDebug", "onUp");
hideNotifications();
}
public void disable() {
if (this.mBrightness != null) {
this.mBrightness.disable();
}
if (this.mVolume != null) {
this.mVolume.disable();
}
hideNotifications();
}
public void enable(boolean brightness, boolean volume) {
checkPlayerOverlaysView();
if (brightness && this.mBrightness != null) {
this.mBrightness.enable();
}
if (volume && this.mVolume != null) {
this.mVolume.enable();
}
}
public void hideNotifications() {
if (this.handler == null) {
this.handler = new Handler();
}
// from class: fi.razerman.youtube.Fenster.XFenster.1
// java.lang.Runnable
this.handler.postDelayed(() -> {
XFenster.this.mVolume.hide();
XFenster.this.mBrightness.hide();
}, 2000L);
}
private void updateVolumeProgressBarVertical(MotionEvent event) {
float difference = getDifferenceVertical(this.mVolumeDownPos, getProgressVertical(event, this.mVolume.Max));
if (this.mBrightness.isVisible()) {
this.mBrightness.hide();
}
this.mVolume.manuallyUpdate((int) (this.mVolumeDownProgress + difference));
}
private void updateBrightnessProgressBarVertical(MotionEvent event) {
float difference = getDifferenceVertical(this.mBrightnessDownPos, getProgressVertical(event, this.mBrightness.Max));
if (this.mVolume.isVisible()) {
this.mVolume.hide();
}
this.mBrightness.manuallyUpdate((int) (this.mBrightnessDownProgress + difference));
}
private void updateVolumeProgressBarHorizontal(MotionEvent event) {
float difference = getDifferenceHorizontal(this.mVolumeDownPos, getProgressHorizontal(event, this.mVolume.Max));
if (this.mBrightness.isVisible()) {
this.mBrightness.hide();
}
this.mVolume.manuallyUpdate((int) (this.mVolumeDownProgress + difference));
}
private void updateBrightnessProgressBarHorizontal(MotionEvent event) {
float difference = getDifferenceHorizontal(this.mBrightnessDownPos, getProgressHorizontal(event, this.mBrightness.Max));
if (this.mVolume.isVisible()) {
this.mVolume.hide();
}
this.mBrightness.manuallyUpdate((int) (this.mBrightnessDownProgress + difference));
}
private float getDifferenceVertical(float downProgress, float newProgress) {
float diff = downProgress - newProgress;
return diff * (-1.0f);
}
private float getDifferenceHorizontal(float downProgress, float newProgress) {
float diff = downProgress - newProgress;
return diff;
}
private float getProgressVertical(MotionEvent event, int maxSteps) {
float progress = calculateProgressVertical(event, maxSteps);
if (XGlobals.debug) {
Log.d("XDebug", "Progress vertical: " + progress);
}
return progress;
}
private float getProgressHorizontal(MotionEvent event, int maxSteps) {
float progress = calculateProgressHorizontal(event, maxSteps);
if (XGlobals.debug) {
Log.d("XDebug", "Progress horizontal: " + progress);
}
return progress;
}
private float calculateProgressVertical(MotionEvent event, int maxSteps) {
float scale;
int height = this.mViewGroup.getHeight();
if (XGlobals.debug) {
Log.d("XDebug", "calculateProgressVertical - height: " + height);
}
int available = (height - this.mPaddingTop) - this.mPaddingBottom;
int y = height - ((int) event.getY());
float progress = 0.0f;
if (y < this.mPaddingBottom) {
scale = 0.0f;
} else if (y > height - this.mPaddingTop) {
scale = 1.0f;
} else {
scale = (y - this.mPaddingBottom) / available;
progress = this.mTouchProgressOffset;
}
return progress + (maxSteps * scale);
}
private float calculateProgressHorizontal(MotionEvent event, int maxSteps) {
float scale;
int width = this.mViewGroup.getWidth();
int available = (width - this.mPaddingLeft) - this.mPaddingRight;
int x = width - ((int) event.getX());
float progress = 0.0f;
if (x < this.mPaddingRight) {
scale = 0.0f;
} else if (x > width - this.mPaddingLeft) {
scale = 1.0f;
} else {
scale = (x - this.mPaddingRight) / available;
progress = this.mTouchProgressOffset;
}
return progress + (maxSteps * scale);
}
private Coverage getCoverageHorizontal(MotionEvent event) {
int halfScreen = this.mViewGroup.getHeight() / 2;
int y = (int) event.getY();
return y <= halfScreen ? Coverage.LEFT : Coverage.RIGHT;
}
private Coverage getCoverageVertical(MotionEvent event) {
int halfScreen = this.mViewGroup.getWidth() / 2;
int x = (int) event.getX();
return x <= halfScreen ? Coverage.LEFT : Coverage.RIGHT;
}
private void checkPlayerOverlaysView() {
try {
if ((this.mViewGroup.getHeight() == 0 || this.mViewGroup.getWidth() == 0) && XSwipeHelper.nextGenWatchLayout != null) {
View layout = XSwipeHelper.nextGenWatchLayout.findViewById(getIdentifier());
if (layout != null) {
this.mViewGroup = (ViewGroup) layout;
this.mBrightness.refreshViewGroup(this.mViewGroup);
this.mVolume.refreshViewGroup(this.mViewGroup);
if (XGlobals.debug) {
Log.d("XGlobals", "player_overlays refreshed");
}
} else if (XGlobals.debug) {
Log.d("XGlobals", "player_overlays was not found");
}
}
} catch (Exception ex) {
Log.e("XError", "Unable to refresh player_overlays layout", ex);
}
}
private static int getIdentifier() {
Context context = YouTubeTikTokRoot_Application.getAppContext();
assert context != null;
return context.getResources().getIdentifier("player_overlays", "id", context.getPackageName());
}
}

View File

@ -0,0 +1,67 @@
package fi.razerman.youtube.Helpers;
import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
import androidx.annotation.NonNull;
import java.util.HashMap;
/* loaded from: classes6.dex */
public class ColorRef {
public static final String CREDITS = "Converted from jakubweg's StringRef https://github.com/YTVanced/SponsorBlock/blob/master/app/src/main/java/pl/jakubweg/StringRef.java";
public static final String TAG = "ColorRef";
private static final HashMap<String, ColorRef> colors = new HashMap<>();
private static String packageName;
private static Resources resources;
@NonNull
private final String colorName;
private boolean resolved;
private Integer value;
public static void setContext(Context context) {
if (context != null) {
resources = context.getApplicationContext().getResources();
packageName = context.getPackageName();
}
}
@NonNull
/* renamed from: cf */
public static ColorRef m32591cf(@NonNull String resName, @NonNull Integer defaultValue) {
ColorRef ref = colors.get(resName);
if (ref != null) {
return ref;
}
ColorRef ref2 = new ColorRef(resName, defaultValue);
colors.put(resName, ref2);
return ref2;
}
@NonNull
public static Integer color(@NonNull String resName, @NonNull Integer defaultValue) {
return m32591cf(resName, defaultValue).resolve();
}
public ColorRef(@NonNull String resName, @NonNull Integer defaultValue) {
this.colorName = resName;
this.value = defaultValue;
}
@NonNull
public Integer resolve() {
if (!this.resolved) {
this.resolved = true;
Resources resources2 = resources;
if (resources2 != null) {
try {
this.value = resources2.getColor(resources2.getIdentifier(this.colorName, "color", packageName));
} catch (Resources.NotFoundException e) {
Log.e(TAG, "Resource not found: " + this.value);
}
}
}
return this.value;
}
}

View File

@ -0,0 +1,10 @@
package fi.razerman.youtube.Helpers;
import android.text.TextUtils;
/* loaded from: classes6.dex */
public class NullCheck {
public static String ensureHasFragment(String fragmentName) {
return TextUtils.isEmpty(fragmentName) ? "placeholder" : fragmentName;
}
}

View File

@ -0,0 +1,49 @@
package fi.razerman.youtube.Helpers;
import android.content.Context;
import android.content.SharedPreferences;
/* loaded from: classes6.dex */
public class SharedPrefs {
public static void saveString(Context context, String key, String value) {
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
sharedPreferences.edit().putString(key, value).apply();
}
public static void saveBoolean(Context context, String key, Boolean value) {
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
sharedPreferences.edit().putBoolean(key, value).apply();
}
public static void saveInt(Context context, String key, Integer value) {
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
sharedPreferences.edit().putInt(key, value).apply();
}
public static String getString(Context context, String key) {
return getString(context, key, null);
}
public static String getString(Context context, String key, String _default) {
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
return sharedPreferences.getString(key, _default);
}
public static Boolean getBoolean(Context context, String key) {
return getBoolean(context, key, false);
}
public static Boolean getBoolean(Context context, String key, Boolean _default) {
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
return sharedPreferences.getBoolean(key, _default);
}
public static Integer getInt(Context context, String key) {
return getInt(context, key, -1);
}
public static Integer getInt(Context context, String key, Integer _default) {
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
return sharedPreferences.getInt(key, _default);
}
}

View File

@ -0,0 +1,14 @@
package fi.razerman.youtube.Helpers;
import android.content.Context;
/* loaded from: classes6.dex */
public class XScreenSizeHelpers {
public static boolean isTablet(Context context) {
return smallestWidthDp(context) >= 600;
}
private static int smallestWidthDp(Context context) {
return context.getResources().getConfiguration().smallestScreenWidthDp;
}
}

View File

@ -0,0 +1,22 @@
package fi.razerman.youtube.Helpers;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
/* loaded from: classes6.dex */
public class XSharedPrefs {
public static boolean getBoolean(Context context, String key, boolean defValue) {
try {
if (context == null) {
Log.e("XSharedPrefs", "context is null");
return false;
}
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
return sharedPreferences.getBoolean(key, defValue);
} catch (Exception ex) {
Log.e("XSharedPrefs", "Error getting boolean", ex);
return defValue;
}
}
}

View File

@ -1,8 +1,82 @@
package fi.razerman.youtube.Helpers;
import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.XGlobals;
/* loaded from: classes6.dex */
public class XSwipeHelper {
// Implementation in another repo
static FrameLayout _frameLayout;
public static boolean isTabletMode;
public static ViewGroup nextGenWatchLayout;
}
public static void SetFrameLayout(Object obj) {
try {
_frameLayout = (FrameLayout) obj;
Context appContext = YouTubeTikTokRoot_Application.getAppContext();
if (XScreenSizeHelpers.isTablet(appContext) || XSharedPrefs.getBoolean(appContext, "pref_xfenster_tablet", false)) {
isTabletMode = true;
}
} catch (Exception e) {
Log.e("XError", "Unable to set FrameLayout", e);
}
}
public static void setNextGenWatchLayout(Object obj) {
try {
nextGenWatchLayout = (ViewGroup) obj;
} catch (Exception e) {
Log.e("XError", "Unable to set _nextGenWatchLayout", e);
}
}
public static boolean IsControlsShown() {
FrameLayout frameLayout;
if (isTabletMode || (frameLayout = _frameLayout) == null || frameLayout.getVisibility() != View.VISIBLE) {
return false;
}
try {
} catch (Exception e) {
Log.e("XError", "Unable to get related_endscreen_results visibility", e);
}
if (_frameLayout.getChildCount() > 0) {
return _frameLayout.getChildAt(0).getVisibility() == View.VISIBLE;
}
refreshLayout();
return false;
}
private static void refreshLayout() {
View findViewById;
try {
if (XGlobals.isWatchWhileFullScreen() && (findViewById = nextGenWatchLayout.findViewById(getIdentifier())) != null) {
_frameLayout = (FrameLayout) findViewById.getParent();
if (XGlobals.debug) {
Log.d("XGlobals", "related_endscreen_results refreshed");
}
}
} catch (Exception e) {
Log.e("XError", "Unable to refresh related_endscreen_results layout", e);
}
}
private static String getViewMessage(View view) {
try {
String resourceName = view.getResources() != null ? view.getId() != 0 ? view.getResources().getResourceName(view.getId()) : "no_id" : "no_resources";
return "[" + view.getClass().getSimpleName() + "] " + resourceName + "\n";
} catch (Resources.NotFoundException unused) {
return "[" + view.getClass().getSimpleName() + "] name_not_found\n";
}
}
private static int getIdentifier() {
Context appContext = YouTubeTikTokRoot_Application.getAppContext();
assert appContext != null;
return appContext.getResources().getIdentifier("related_endscreen_results", "id", appContext.getPackageName());
}
}

View File

@ -0,0 +1,43 @@
package fi.razerman.youtube.Helpers;
import android.os.Build;
import android.util.Log;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import java.util.Objects;
import fi.razerman.youtube.XGlobals;
/* loaded from: classes6.dex */
public class XThemeHelpers {
static String TAG = "XTheme";
static int themeValue;
public static void setTheme(int value) {
themeValue = value;
if (XGlobals.debug) {
String str = TAG;
Log.d(str, "Theme value: " + themeValue);
}
}
public static void setTheme(Object value) {
themeValue = ((Enum) value).ordinal();
if (XGlobals.debug) {
String str = TAG;
Log.d(str, "Theme value: " + themeValue);
}
}
public static boolean isDarkTheme() {
return themeValue == 1;
}
public static boolean isNightDarkMode() {
return (Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()).getResources().getConfiguration().uiMode & 48) == 32;
}
public static boolean isAbovePie() {
return Build.VERSION.SDK_INT > 28;
}
}

View File

@ -0,0 +1,117 @@
package fi.razerman.youtube.VideoUrl;
import android.content.Context;
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.XGlobals;
import fi.vanced.libraries.youtube.player.VideoHelpers;
import java.lang.ref.WeakReference;
/* loaded from: classes6.dex */
public class Copy {
static String TAG = "CopyButton";
static WeakReference<ImageView> _button = new WeakReference<>(null);
static ConstraintLayout _constraintLayout;
static int fadeDurationFast;
static int fadeDurationScheduled;
static Animation fadeIn;
static Animation fadeOut;
public static boolean isCopyButtonEnabled;
static boolean isShowing;
public static void initializeCopyButton(Object obj) {
try {
if (XGlobals.debug) {
Log.d(TAG, "initializing");
}
_constraintLayout = (ConstraintLayout) obj;
isCopyButtonEnabled = shouldBeShown();
ImageView imageView = _constraintLayout.findViewById(getIdentifier("copy_button", "id"));
if (XGlobals.debug && imageView == null) {
Log.d(TAG, "Couldn't find imageView with id \"copy_button\"");
}
if (imageView != null) {
// from class: fi.razerman.youtube.VideoUrl.Copy.1
// android.view.View.OnClickListener
imageView.setOnClickListener(view -> {
if (XGlobals.debug) {
Log.d(Copy.TAG, "Button clicked");
}
VideoHelpers.copyVideoUrlToClipboard();
});
_button = new WeakReference<>(imageView);
fadeDurationFast = getInteger("fade_duration_fast");
fadeDurationScheduled = getInteger("fade_duration_scheduled");
Animation animation = getAnimation("fade_in");
fadeIn = animation;
animation.setDuration(fadeDurationFast);
Animation animation2 = getAnimation("fade_out");
fadeOut = animation2;
animation2.setDuration(fadeDurationScheduled);
isShowing = true;
changeVisibility(false);
}
} catch (Exception e) {
Log.e(TAG, "Unable to set FrameLayout", e);
}
}
public static void changeVisibility(boolean z) {
if (isShowing != z) {
isShowing = z;
ImageView imageView = _button.get();
if (_constraintLayout != null && imageView != null) {
if (z && isCopyButtonEnabled) {
if (XGlobals.debug) {
Log.d(TAG, "Fading in");
}
imageView.setVisibility(View.VISIBLE);
imageView.startAnimation(fadeIn);
} else if (imageView.getVisibility() == View.VISIBLE) {
if (XGlobals.debug) {
Log.d(TAG, "Fading out");
}
imageView.startAnimation(fadeOut);
imageView.setVisibility(View.GONE);
}
}
}
}
public static void refreshShouldBeShown() {
isCopyButtonEnabled = shouldBeShown();
}
private static boolean shouldBeShown() {
Context appContext = YouTubeTikTokRoot_Application.getAppContext();
if (appContext == null) {
Log.e(TAG, "shouldBeShown - context is null!");
return false;
}
String string = appContext.getSharedPreferences("youtube", 0).getString("pref_copy_video_url_button_list", null);
if (string == null || string.isEmpty()) {
return false;
}
return string.equalsIgnoreCase("PLAYER") || string.equalsIgnoreCase("BOTH");
}
private static int getIdentifier(String str, String str2) {
Context appContext = YouTubeTikTokRoot_Application.getAppContext();
return appContext.getResources().getIdentifier(str, str2, appContext.getPackageName());
}
private static int getInteger(String str) {
return YouTubeTikTokRoot_Application.getAppContext().getResources().getInteger(getIdentifier(str, "integer"));
}
private static Animation getAnimation(String str) {
return AnimationUtils.loadAnimation(YouTubeTikTokRoot_Application.getAppContext(), getIdentifier(str, "anim"));
}
}

View File

@ -0,0 +1,118 @@
package fi.razerman.youtube.VideoUrl;
import android.content.Context;
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.XGlobals;
import fi.vanced.libraries.youtube.player.VideoHelpers;
import java.lang.ref.WeakReference;
/* loaded from: classes6.dex */
public class CopyWithTimeStamp {
static String TAG = "CopyButtonWithTimeStamp";
static WeakReference<ImageView> _button = new WeakReference<>(null);
static ConstraintLayout _constraintLayout;
static int fadeDurationFast;
static int fadeDurationScheduled;
static Animation fadeIn;
static Animation fadeOut;
public static boolean isCopyButtonWithTimeStampEnabled;
static boolean isShowing;
public static void initializeCopyButtonWithTimeStamp(Object obj) {
try {
if (XGlobals.debug) {
Log.d(TAG, "initializing");
}
_constraintLayout = (ConstraintLayout) obj;
isCopyButtonWithTimeStampEnabled = shouldBeShown();
ImageView imageView = (ImageView) _constraintLayout.findViewById(getIdentifier("copy_with_timestamp_button", "id"));
if (XGlobals.debug && imageView == null) {
Log.d(TAG, "Couldn't find imageView with id \"copy_with_timestamp_button\"");
}
if (imageView != null) {
imageView.setOnClickListener(new View.OnClickListener() { // from class: fi.razerman.youtube.VideoUrl.CopyWithTimeStamp.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (XGlobals.debug) {
Log.d(CopyWithTimeStamp.TAG, "Button clicked");
}
VideoHelpers.copyVideoUrlWithTimeStampToClipboard();
}
});
_button = new WeakReference<>(imageView);
fadeDurationFast = getInteger("fade_duration_fast");
fadeDurationScheduled = getInteger("fade_duration_scheduled");
Animation animation = getAnimation("fade_in");
fadeIn = animation;
animation.setDuration(fadeDurationFast);
Animation animation2 = getAnimation("fade_out");
fadeOut = animation2;
animation2.setDuration(fadeDurationScheduled);
isShowing = true;
changeVisibility(false);
}
} catch (Exception e) {
Log.e(TAG, "Unable to set FrameLayout", e);
}
}
public static void changeVisibility(boolean z) {
if (isShowing != z) {
isShowing = z;
ImageView imageView = _button.get();
if (_constraintLayout != null && imageView != null) {
if (z && isCopyButtonWithTimeStampEnabled) {
if (XGlobals.debug) {
Log.d(TAG, "Fading in");
}
imageView.setVisibility(View.VISIBLE);
imageView.startAnimation(fadeIn);
} else if (imageView.getVisibility() == View.VISIBLE) {
if (XGlobals.debug) {
Log.d(TAG, "Fading out");
}
imageView.startAnimation(fadeOut);
imageView.setVisibility(View.GONE);
}
}
}
}
public static void refreshShouldBeShown() {
isCopyButtonWithTimeStampEnabled = shouldBeShown();
}
private static boolean shouldBeShown() {
Context appContext = YouTubeTikTokRoot_Application.getAppContext();
if (appContext == null) {
Log.e(TAG, "shouldBeShown - context is null!");
return false;
}
String string = appContext.getSharedPreferences("youtube", 0).getString("pref_copy_video_url_timestamp_button_list", null);
if (string == null || string.isEmpty()) {
return false;
}
return string.equalsIgnoreCase("PLAYER") || string.equalsIgnoreCase("BOTH");
}
private static int getIdentifier(String str, String str2) {
Context appContext = YouTubeTikTokRoot_Application.getAppContext();
return appContext.getResources().getIdentifier(str, str2, appContext.getPackageName());
}
private static int getInteger(String str) {
return YouTubeTikTokRoot_Application.getAppContext().getResources().getInteger(getIdentifier(str, "integer"));
}
private static Animation getAnimation(String str) {
return AnimationUtils.loadAnimation(YouTubeTikTokRoot_Application.getAppContext(), getIdentifier(str, "anim"));
}
}

View File

@ -0,0 +1,234 @@
package fi.razerman.youtube;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toolbar;
import fi.razerman.youtube.preferences.BooleanPreferences;
/* loaded from: classes6.dex */
public class XAdRemover {
public static Object RemoveInfoCardSuggestions(Object InfoCardOverlayPresenter) {
XGlobals.ReadSettings();
if (!XGlobals.suggestionsShown) {
InfoCardOverlayPresenter = null;
}
if (XGlobals.debug) {
if (InfoCardOverlayPresenter == null) {
Log.d("XAdRemover", "RemoveInfoCardSuggestions: true");
} else {
Log.d("XAdRemover", "RemoveInfoCardSuggestions: false");
}
}
return InfoCardOverlayPresenter;
}
public static Boolean RemoveSuggestions(Boolean showSuggestions) {
XGlobals.ReadSettings();
if (showSuggestions && !XGlobals.suggestionsShown) {
if (XGlobals.debug) {
Log.d("XAdRemover", "RemoveSuggestions: Removed");
}
return false;
} else if (XGlobals.debug && showSuggestions) {
Log.d("XAdRemover", "RemoveSuggestions: Not removed");
return true;
} else if (!XGlobals.debug) {
return showSuggestions;
} else {
Log.d("XAdRemover", "RemoveSuggestions: Already not shown");
return false;
}
}
public static FrameLayout CheckInfoCardsStatus(FrameLayout frameLayout) {
XGlobals.ReadSettings();
frameLayout.setVisibility(XGlobals.infoCardsShown ? View.VISIBLE : View.GONE);
if (XGlobals.debug) {
Log.d("XAdRemover", "CheckInfoCardsStatus - Set visibility to: " + XGlobals.infoCardsShown);
}
return frameLayout;
}
public static boolean isBrandingWatermarkShown(boolean defaultValue) {
XGlobals.ReadSettings();
if (defaultValue && !XGlobals.brandingShown) {
if (XGlobals.debug) {
Log.d("XAdRemover", "BrandingWatermark: Removed");
}
return false;
} else if (XGlobals.debug && defaultValue) {
Log.d("XAdRemover", "BrandingWatermark: Not removed");
return true;
} else if (!XGlobals.debug) {
return defaultValue;
} else {
Log.d("XAdRemover", "BrandingWatermark: Already not shown");
return false;
}
}
public static int BrandingWatermark(int defaultValue) {
XGlobals.ReadSettings();
if (defaultValue == 0 && !XGlobals.brandingShown) {
if (XGlobals.debug) {
Log.d("XAdRemover", "BrandingWatermark: Removed");
}
return 8;
} else if (XGlobals.debug && defaultValue == 0) {
Log.d("XAdRemover", "BrandingWatermark: Not removed");
return defaultValue;
} else if (!XGlobals.debug) {
return defaultValue;
} else {
Log.d("XAdRemover", "BrandingWatermark: Already not shown");
return defaultValue;
}
}
private static void recursiveLoopChildren(ViewGroup parent) {
for (int i = 0; i < parent.getChildCount(); i++) {
View child = parent.getChildAt(i);
if (child instanceof ViewGroup) {
recursiveLoopChildren((ViewGroup) child);
child.setVisibility(View.GONE);
} else if (child != null) {
child.setVisibility(View.GONE);
}
}
}
public static void HideViewV2(View view) {
XGlobals.ReadSettings();
if (!XGlobals.homeAdsShown) {
recursiveLoopChildren((ViewGroup) view);
RelativeLayout relativeLayout = new RelativeLayout(XGlobals.getContext());
RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(1, 1);
((ViewGroup) view).addView(relativeLayout, rlp);
}
}
public static void HideReel(View view) {
XGlobals.ReadSettings();
if (!XGlobals.reelShown) {
if (XGlobals.debug) {
Log.d("XAdRemover", "HideReel: " + view.getId());
}
HideViewWithLayout1dp(view);
}
}
public static void HideView(View view) {
XGlobals.ReadSettings();
if (!XGlobals.homeAdsShown) {
if (XGlobals.debug) {
Log.d("XAdRemover", "HideView: " + view.getId());
}
HideViewWithLayout1dp(view);
}
}
private static void HideViewWithLayout1dp(View view) {
if (view instanceof LinearLayout) {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(1, 1);
view.setLayoutParams(layoutParams);
} else if (view instanceof FrameLayout) {
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(1, 1);
view.setLayoutParams(layoutParams2);
} else if (view instanceof RelativeLayout) {
RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(1, 1);
view.setLayoutParams(layoutParams3);
} else if (view instanceof Toolbar) {
Toolbar.LayoutParams layoutParams4 = new Toolbar.LayoutParams(1, 1);
view.setLayoutParams(layoutParams4);
} else if (view instanceof ViewGroup) {
ViewGroup.LayoutParams layoutParams5 = new ViewGroup.LayoutParams(1, 1);
view.setLayoutParams(layoutParams5);
} else if (XGlobals.debug) {
Log.d("XAdRemover", "HideViewWithLayout1dp - Id: " + view.getId() + " Type: " + view.getClass().getName());
}
}
public static boolean VideoAdsEnabled(boolean input) {
XGlobals.ReadSettings();
if (XGlobals.videoAdsShown) {
if (XGlobals.debug) {
Log.d("XAdRemover", "Videoads: shown - " + input);
}
return input;
} else if (!XGlobals.debug) {
return false;
} else {
Log.d("XAdRemover", "Videoads: hidden");
return false;
}
}
public static void hideCreateButton(View view) {
if (BooleanPreferences.isCreateButtonHidden()) {
if (XGlobals.debug) {
Log.d("XAdRemover", "Create button: shown");
}
view.setVisibility(View.GONE);
} else if (XGlobals.debug) {
Log.d("XAdRemover", "Create button: hidden");
}
}
public static void inspectComponentHost(Object item) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("Litho", "Couldn't locate the method called from.");
} else {
String sb = "Called from method: " +
stackTraceElements[3].toString() + "\n";
Log.d("Litho", sb);
}
if (item == null) {
Log.d("Litho", "Item is null.");
} else if (item.getClass().getSimpleName().contains("cwl")) {
Log.d("Litho", "Item is a cwl item.");
Log.i("Litho", getViewHierarcy((ViewGroup) item));
} else {
Log.d("Litho", "Item is not a cwl item.");
}
}
public static String getViewHierarcy(ViewGroup v) {
StringBuffer buf = new StringBuffer();
printViews(v, buf, 0);
return buf.toString();
}
private static String printViews(ViewGroup v, StringBuffer buf, int level) {
int childCount = v.getChildCount();
v.getId();
indent(buf, level);
buf.append(v.getClass().getName());
buf.append(" children:");
buf.append(childCount);
buf.append(" id:").append(v.getId());
buf.append("\n");
for (int i = 0; i < childCount; i++) {
View child = v.getChildAt(i);
if (child instanceof ViewGroup) {
printViews((ViewGroup) child, buf, level + 1);
} else {
indent(buf, level + 1);
buf.append(child.getClass().getName());
buf.append(" id:").append(child.getId());
buf.append("\n");
}
}
return buf.toString();
}
private static void indent(StringBuffer buf, int level) {
for (int i = 0; i < level; i++) {
buf.append(" ");
}
}
}

View File

@ -0,0 +1,431 @@
package fi.razerman.youtube;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
import android.media.MediaCodec;
import android.os.Build;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
/* loaded from: classes6.dex */
public class XDebug {
private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
public static void printBooleanWithMethod(boolean bool) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XBoolean", "Couldn't locate the method called from.");
Log.d("XBoolean", "" + bool);
return;
}
Log.d("XBoolean", "Called from method: " + stackTraceElements[3].toString() + "\n");
Log.d("XBoolean", "" + bool);
}
public static void printColorStateListWithMethod(ColorStateList colorStateList) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XColorStateList", "Couldn't locate the method called from.");
} else {
Log.d("XColorStateList", "Called from method: " + stackTraceElements[3].toString() + "\n");
}
if (colorStateList == null) {
Log.d("XColorStateList", "<Null>");
} else {
Log.d("XColorStateList", "" + colorStateList);
}
}
public static void printIntIntWithMethod(int integer, int integer2) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XIntInt", "Couldn't locate the method called from.");
Log.d("XIntInt", "" + integer + " | " + integer2);
return;
}
Log.d("XIntInt", "Called from method: " + stackTraceElements[3].toString() + "\n");
Log.d("XIntInt", "" + integer + " | " + integer2);
}
public static void printIntWithMethod(int integer) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XInt", "Couldn't locate the method called from.");
Log.d("XInt", "" + integer);
return;
}
Log.d("XInt", "Called from method: " + stackTraceElements[3].toString() + "\n");
Log.d("XInt", "" + integer);
}
public static void printStringWithMethod(String string) {
if (string == null || string.isEmpty()) {
string = "-- null --";
}
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XString", "Couldn't locate the method called from.");
Log.d("XString", string);
return;
}
Log.d("XString", "Called from method: " + stackTraceElements[3].toString() + "\n");
Log.d("XString", string);
}
public static void printCharSequenceBooleanWithMethod(CharSequence charSequence, boolean bool) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XCharSequenceB", "Couldn't locate the method called from.");
} else {
Log.d("XCharSequenceB", "Called from method: " + stackTraceElements[3].toString() + "\n");
}
if (charSequence == null) {
Log.d("XCharSequenceB", "<Null>");
} else {
Log.d("XCharSequenceB", charSequence + " | " + (bool ? "true" : "false"));
}
}
public static void printCharSequenceWithMethod(CharSequence charSequence) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XCharSequence", "Couldn't locate the method called from.");
} else {
Log.d("XCharSequence", "Called from method: " + stackTraceElements[3].toString() + "\n");
}
if (charSequence == null) {
Log.d("XCharSequence", "<Null>");
} else {
Log.d("XCharSequence", charSequence.toString());
}
}
public static void printCharSequenceAndBufferTypeWithMethod(CharSequence charSequence, TextView.BufferType bufferType) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XCharSequenceBT", "Couldn't locate the method called from.");
if (charSequence == null) {
if (bufferType == null) {
Log.d("XCharSequenceBT", "<Null>");
} else {
Log.d("XCharSequenceBT", "<Null> | " + bufferType);
}
} else if (bufferType == null) {
Log.d("XCharSequenceBT", charSequence.toString());
} else {
Log.d("XCharSequenceBT", charSequence.toString() + " | " + bufferType);
}
} else {
Log.d("XCharSequenceBT", "Called from method: " + stackTraceElements[3].toString() + "\n");
if (charSequence == null) {
Log.d("XCharSequenceBT", "<Null>");
} else {
Log.d("XCharSequenceBT", charSequence.toString());
}
}
}
public static void printStringBuilder(StringBuilder stringBuilder) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XStringBuilder", "Couldn't locate the method called from.");
Log.d("XStringBuilder", stringBuilder.toString());
return;
}
Log.d("XStringBuilder", "Called from method: " + stackTraceElements[3].toString() + "\n");
Log.d("XStringBuilder", stringBuilder.toString());
Log.d("StackWithMethod", stringBuilder.toString());
printStackTrace("StackWithMethod");
}
public static void printMethod() {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length > 3) {
Log.d("XStack", stackTraceElements[3].toString() + "\n");
}
}
public static void printStackTraces() {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
for (StackTraceElement element : stackTraceElements) {
System.out.println("Class name :: " + element.getClassName() + " || method name :: " + element.getMethodName());
}
}
public static void printStackTrace() {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
StringBuilder stringBuilder = new StringBuilder();
for (StackTraceElement element : stackTraceElements) {
stringBuilder.append(element.toString()).append("\n");
}
Log.d("xfileSTACK", stringBuilder.toString());
}
public static void printStackTrace(String tag) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
StringBuilder stringBuilder = new StringBuilder();
for (StackTraceElement element : stackTraceElements) {
stringBuilder.append(element.toString()).append("\n");
}
Log.d(tag, stringBuilder.toString());
}
public static void printDebugBoolean(boolean val) {
Log.d("XDebug", "" + val);
}
public static void printDebugInteger(int value) {
Log.d("XDebug", "" + value);
}
public static void printDebugFloat(float value) {
Log.d("XDebug", "" + value);
}
public static void printDebugLong(long value) {
Log.d("XDebug", "" + value);
}
public static void printDebugString(String value) {
if (value != null) {
Log.d("XDebug", value);
}
}
public static void printDebugStringWithMethodName(String value) {
StackTraceElement[] stackTraceElements;
if (value != null && (stackTraceElements = Thread.currentThread().getStackTrace()) != null && stackTraceElements.length > 3) {
Log.d("XDebug", value + " | " + stackTraceElements[3].toString() + "\n");
}
}
public static void printDebugStringWithStack(String value) {
StackTraceElement[] stackTraceElements;
if (!(value == null || (stackTraceElements = Thread.currentThread().getStackTrace()) == null)) {
StringBuilder stringBuilder = new StringBuilder();
for (StackTraceElement element : stackTraceElements) {
stringBuilder.append(element.toString()).append("\n");
}
Log.d("XDebug", value + " | " + stringBuilder.toString());
}
}
public static void printDebugByteArray(byte[] value) {
Log.d("XDebug", bytesToHex(value));
}
public static void printByteBufferWithMethod(ByteBuffer buf) {
String string;
if (buf == null) {
string = "-- null --";
} else {
string = new String(buf.array(), StandardCharsets.UTF_8);
if (string.isEmpty()) {
string = "-- null --";
}
}
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
if (stackTraceElements.length <= 3) {
Log.d("XByteBuffer", "Couldn't locate the method called from.");
Log.d("XByteBuffer", string);
return;
}
Log.d("XByteBuffer", "Called from method: " + stackTraceElements[3].toString() + "\n");
Log.d("XByteBuffer", string);
}
public static void printDebugByteBuffer(ByteBuffer buf) {
byte[] bytes = new byte[buf.remaining()];
buf.get(bytes, 0, bytes.length);
buf.clear();
byte[] bytes2 = new byte[buf.capacity()];
buf.get(bytes2, 0, bytes2.length);
Log.d("XDebug", bytesToHex(bytes2));
}
public static void printDebugByteBuffer(ByteBuffer[] buffers) {
int length = buffers.length;
int i = 0;
int index = 0;
while (i < length) {
ByteBuffer buf = buffers[i];
byte[] bytes = new byte[buf.remaining()];
buf.get(bytes, 0, bytes.length);
buf.clear();
byte[] bytes2 = new byte[buf.capacity()];
buf.get(bytes2, 0, bytes2.length);
Log.d("XDebug - Index: " + index, bytesToHex(bytes2));
i++;
index++;
}
}
public static void printDebugMediaCodec(MediaCodec mediaCodec) {
Exception e;
int i = 0;
try {
ByteBuffer[] outputBuffers = mediaCodec.getOutputBuffers();
int length = outputBuffers.length;
int index = 0;
while (i < length) {
try {
ByteBuffer buf = outputBuffers[i];
byte[] bytes = new byte[buf.remaining()];
buf.get(bytes, 0, bytes.length);
buf.clear();
byte[] bytes2 = new byte[buf.capacity()];
buf.get(bytes2, 0, bytes2.length);
int index2 = index + 1;
Log.d("XDebug - Index: " + index, bytesToHex(bytes2));
i++;
index = index2;
} catch (Exception e2) {
e = e2;
Log.d("XDebug abc", "Error: " + e.getMessage());
return;
}
}
} catch (Exception ignored) {
}
}
public static void printDebugMediaCodec(MediaCodec mediaCodec, int i) {
try {
ByteBuffer buf = mediaCodec.getOutputBuffer(i);
byte[] bytes = getByteArrayFromByteBuffer(buf);
Log.d("XDebug - decrypt: " + i, bytesToHex(bytes));
} catch (Exception e) {
Log.d("XDebug - buffer: " + i, "Error: " + i + " | " + e.getMessage());
}
}
private static byte[] getByteArrayFromByteBuffer(ByteBuffer byteBuffer) {
byte[] bytesArray = new byte[byteBuffer.capacity()];
byteBuffer.get(bytesArray, 0, bytesArray.length);
return bytesArray;
}
public static void printDebugRect(Rect value) {
Log.d("XDebug", "Rectangle| Left:" + value.left + " - Top: " + value.top + " - Right: " + value.right + " - Bottom: " + value.bottom);
}
public static DisplayMetrics getMetrics() {
return new DisplayMetrics();
}
public static Point getRealSize() {
return new Point(3840, 2160);
}
public static Point getSize() {
return new Point(3840, 2160);
}
public static Point getPhysicalSize() {
return new Point(3840, 2160);
}
public static int getDisplayWidth() {
return 2160;
}
public static int getDisplayHeight() {
return 3840;
}
public static String CheckYTRed(String input, String original) {
if (input.equals("has_unlimited_entitlement") || input.equals("has_unlimited_ncc_free_trial")) {
return "True";
}
if (input.equals("e")) {
return "11202604,23700636,23701019,9415293,9422596,9431754,9435797,9444109,9444635,9449243,9456940,9461315,9463829,9464088,9466234,9467503,9474594,9476327,9477602,9478523,9479785,9480475,9480495,9482942,9484378,9484706,9488038,9489706";
}
return original;
}
public static String DecodeColdConfig() {
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (XGlobals.XFILEDEBUG && context == null) {
context = XSettingActivity.getAppContext();
}
if (context == null) {
Log.e("XDebug", "Context is null, ignoring to decode");
return Build.MANUFACTURER;
}
SharedPreferences sharedPreferences = context.getSharedPreferences("youtube", 0);
String config_group = sharedPreferences.getString("com.google.android.libraries.youtube.innertube.cold_config_group", null);
String decoded = "";
if (config_group == null) {
return decoded;
}
try {
if (config_group.isEmpty()) {
return decoded;
}
decoded = bytesToHex(Base64.decode(config_group, 8));
sharedPreferences.edit().putString("com.google.android.libraries.youtube.innertube.cold_config_group.decoded", decoded).apply();
return decoded;
} catch (Exception e) {
return decoded;
}
}
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 255;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[(j * 2) + 1] = hexArray[v & 15];
}
return new String(hexChars);
}
public static long ConvertDoubleToLong(double value) {
return (long) value;
}
public static void getViewHierarchy(@NonNull View v) {
StringBuilder desc = new StringBuilder();
getViewHierarchy(v, desc, 0);
Log.d("XDebug", desc.toString());
}
private static void getViewHierarchy(View v, StringBuilder desc, int margin) {
desc.append(getViewMessage(v, margin));
if (v instanceof ViewGroup) {
int margin2 = margin + 1;
ViewGroup vg = (ViewGroup) v;
for (int i = 0; i < vg.getChildCount(); i++) {
getViewHierarchy(vg.getChildAt(i), desc, margin2);
}
}
}
private static String getViewMessage(View v, int marginOffset) {
String resourceId;
String repeated = new String(new char[marginOffset]).replace("\u0000", " ");
try {
if (v.getResources() != null) {
resourceId = v.getId() != 0 ? v.getResources().getResourceName(v.getId()) : "no_id";
} else {
resourceId = "no_resources";
}
return repeated + "[" + v.getClass().getSimpleName() + "] " + resourceId + "\n";
} catch (Resources.NotFoundException e) {
return repeated + "[" + v.getClass().getSimpleName() + "] name_not_found\n";
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
package fi.razerman.youtube;
import android.text.format.Time;
import android.util.Log;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import org.json.JSONObject;
/* loaded from: classes6.dex */
public class XJson {
public static String[] getVersion(String versionName) {
try {
final String[] results = new String[4];
final String vName = versionName.replace('.', '_');
Thread t = new Thread() { // from class: fi.razerman.youtube.XJson.1
@Override // java.lang.Thread, java.lang.Runnable
public void run() {
try {
Time now = new Time();
now.setToNow();
String time = "" + now.hour + now.minute + now.second;
int time_int = Integer.parseInt(time);
URL url = new URL("https://github.com/YTVanced/VancedBackend/releases/download/changelogs/" + vName + "?searchTime=" + time_int); // TODO change to ReVanced changelog URL.
url.openConnection().setReadTimeout(2000);
url.openConnection().setConnectTimeout(2000);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuilder sb = new StringBuilder();
while (true) {
String line = reader.readLine();
if (line != null) {
sb.append(line).append("\n");
} else {
String json = sb.toString();
reader.close();
JSONObject jsonObject = new JSONObject(json);
String title = jsonObject.getString("title");
String message = jsonObject.getString("message");
String buttonpositive = jsonObject.getString("buttonpositive");
results[0] = title;
results[1] = message;
results[2] = buttonpositive;
try {
String buttonnegative = jsonObject.getString("buttonnegative");
results[3] = buttonnegative;
return;
} catch (Exception e) {
return;
}
}
}
} catch (Exception e2) {
Log.e("XError", "exception", e2);
}
}
};
t.start();
t.join();
return results;
} catch (Exception e) {
Log.e("XError", "exception", e);
return null;
}
}
}

View File

@ -0,0 +1,29 @@
package fi.razerman.youtube;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Process;
import com.google.android.apps.youtube.app.application.Shell_HomeActivity;
/* loaded from: classes6.dex */
public class XReboot {
static void Reboot(Activity activity) {
int intent;
intent = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE;
((AlarmManager) activity.getSystemService(Context.ALARM_SERVICE)).setExact(AlarmManager.ELAPSED_REALTIME, 1500L, PendingIntent.getActivity(activity, 0, new Intent(activity, Shell_HomeActivity.class), intent));
Process.killProcess(Process.myPid());
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void RebootDialog(final Activity activity) {
// from class: fi.razerman.youtube.XReboot.1
// android.content.DialogInterface.OnClickListener
new AlertDialog.Builder(activity).setMessage(XGlobals.getStringByName(activity, "pref_refresh_config")).setPositiveButton(XGlobals.getStringByName(activity, "in_app_update_restart_button"), (dialog, id) -> XReboot.Reboot(activity)).setNegativeButton(XGlobals.getStringByName(activity, "sign_in_cancel"), null).show();
}
}

View File

@ -0,0 +1,18 @@
package fi.razerman.youtube;
import android.app.Activity;
/* loaded from: classes6.dex */
final class XRecreate implements Runnable {
private final Activity activity;
/* JADX INFO: Access modifiers changed from: package-private */
public XRecreate(Activity activity) {
this.activity = activity;
}
@Override // java.lang.Runnable
public final void run() {
this.activity.recreate();
}
}

View File

@ -0,0 +1,25 @@
package fi.razerman.youtube;
import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import android.preference.Preference;
/* loaded from: classes6.dex */
public final class XRefresher implements Preference.OnPreferenceClickListener {
private final XSettingsFragment fragment;
public XRefresher(XSettingsFragment xSettingsFragment) {
this.fragment = xSettingsFragment;
}
@Override // android.preference.Preference.OnPreferenceClickListener
public final boolean onPreferenceClick(Preference preference) {
XSettingsFragment fragment = this.fragment;
Handler handler = new Handler(Looper.getMainLooper());
Activity activity = fragment.getActivity();
activity.getClass();
handler.postAtFrontOfQueue(new XRecreate(activity));
return true;
}
}

View File

@ -0,0 +1,122 @@
package fi.razerman.youtube;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.TextView;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.Helpers.XThemeHelpers;
import fi.vanced.libraries.youtube.ryd.RYDFragment;
import pl.jakubweg.SponsorBlockPreferenceFragment;
/* loaded from: classes6.dex */
public class XSettingActivity extends Activity {
static String TAG = "XSettingsActivity";
private static Context context;
boolean currentTheme;
@Override // android.app.Activity
protected void onCreate(Bundle bundle) {
boolean isDarkTheme = XThemeHelpers.isDarkTheme();
this.currentTheme = isDarkTheme;
if (isDarkTheme) {
Log.d("XSettingsActivity", "set Theme.YouTube.Settings.Dark");
setTheme(getIdentifier("Theme.YouTube.Settings.Dark", "style"));
} else {
Log.d("XSettingsActivity", "set Theme.YouTube.Settings");
setTheme(getIdentifier("Theme.YouTube.Settings", "style"));
}
super.onCreate(bundle);
setContentView(getIdentifier("xsettings_with_toolbar", "layout"));
initImageButton(this.currentTheme);
String dataString = getIntent().getDataString();
if (dataString.equalsIgnoreCase("sponsorblock_settings")) {
trySetTitle(getIdentifier("sb_settings", "string"));
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new SponsorBlockPreferenceFragment()).commit();
} else if (dataString.equalsIgnoreCase("ryd_settings")) {
trySetTitle(getIdentifier("vanced_ryd_settings_title", "string"));
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new RYDFragment()).commit();
} else {
trySetTitle(getIdentifier("xfile_settings", "string"));
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new XSettingsFragment()).commit();
}
context = getApplicationContext();
}
private void trySetTitle(int i) {
try {
getTextView((ViewGroup) findViewById(getIdentifier("toolbar", "id"))).setText(i);
} catch (Exception e) {
Log.e(TAG, "Couldn't set Toolbar title", e);
}
}
private void trySetTitle(String str) {
try {
getTextView((ViewGroup) findViewById(getIdentifier("toolbar", "id"))).setText(str);
} catch (Exception e) {
Log.e(TAG, "Couldn't set Toolbar title", e);
}
}
private void initImageButton(boolean z) {
try {
ImageButton imageButton = getImageButton((ViewGroup) findViewById(getIdentifier("toolbar", "id")));
imageButton.setOnClickListener(new View.OnClickListener() { // from class: fi.razerman.youtube.XSettingActivity.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
XSettingActivity.this.onBackPressed();
}
});
imageButton.setImageDrawable(getResources().getDrawable(getIdentifier(z ? "quantum_ic_arrow_back_white_24" : "quantum_ic_arrow_back_grey600_24", "drawable")));
} catch (Exception e) {
Log.e(TAG, "Couldn't set Toolbar click handler", e);
}
}
public static ImageButton getImageButton(ViewGroup viewGroup) {
if (viewGroup == null) {
return null;
}
int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = viewGroup.getChildAt(i);
if (childAt instanceof ImageButton) {
return (ImageButton) childAt;
}
}
return null;
}
public static TextView getTextView(ViewGroup viewGroup) {
if (viewGroup == null) {
return null;
}
int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = viewGroup.getChildAt(i);
if (childAt instanceof TextView) {
return (TextView) childAt;
}
}
return null;
}
private static int getIdentifier(String str, String str2) {
Context appContext = YouTubeTikTokRoot_Application.getAppContext();
return appContext.getResources().getIdentifier(str, str2, appContext.getPackageName());
}
public static Context getAppContext() {
Context context2 = context;
if (context2 != null) {
return context2;
}
Log.e("WatchWhileActivity", "Context is null!");
return null;
}
}

View File

@ -0,0 +1,607 @@
package fi.razerman.youtube;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.util.Log;
import android.widget.Toast;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.Autorepeat.AutoRepeat;
import fi.razerman.youtube.Fenster.FensterGestureListener;
import fi.razerman.youtube.Helpers.XScreenSizeHelpers;
import fi.razerman.youtube.Helpers.XSwipeHelper;
import fi.razerman.youtube.VideoUrl.Copy;
import fi.razerman.youtube.VideoUrl.CopyWithTimeStamp;
import vanced.integrations.BuildConfig;
/* loaded from: classes6.dex */
public class XSettingsFragment extends PreferenceFragment {
private Toast toast;
private PreferenceScreen adsSettingsPreferenceScreen;
private PreferenceScreen bufferSettingsPreferenceScreen;
private Preference codecDefault;
private Preference codecHDRH;
private Preference codecHDRS;
private PreferenceScreen codecPreferenceScreen;
private Preference codecVP9;
private PreferenceScreen layoutSettingsPreferenceScreen;
private EditTextPreference manufacturerOverride;
private PreferenceScreen miscsPreferenceScreen;
private EditTextPreference modelOverride;
public SharedPreferences sharedPreferences;
private SwitchPreference tabletComments;
private SwitchPreference tabletMiniplayer;
private PreferenceScreen videoAdSettingsPreferenceScreen;
private PreferenceScreen videoSettingsPreferenceScreen;
private SwitchPreference vp9Override;
private PreferenceScreen xFensterPreferenceScreen;
private boolean Registered = false;
CharSequence[] videoQualityEntries = {"Auto", "144p", "240p", "360p", "480p", "720p", "1080p", "1440p", "2160p"};
CharSequence[] videoQualityentryValues = {"-2", "144", "240", "360", "480", "720", "1080", "1440", "2160"};
CharSequence[] minimizedVideoEntries = {"Auto", "Video only", "Video with controls"};
CharSequence[] minimizedVideoentryValues = {"-2", "0", "1"};
CharSequence[] videoSpeedEntries = {"Auto", "0.25x", "0.5x", "0.75x", "Normal", "1.25x", "1.5x", "1.75x", "2x"};
CharSequence[] videoSpeedentryValues = {"-2", "0.25", "0.5", "0.75", BuildConfig.VERSION_NAME, "1.25", "1.5", "1.75", "2.0"};
CharSequence[] buttonLocationEntries = {"None", "In player", "Under player", "Both"};
CharSequence[] buttonLocationentryValues = {"NONE", "PLAYER", "BUTTON_BAR", "BOTH"};
private long PreviousClick = 0;
private int clicks = 0;
private final int neededClicks = 5;
private boolean hiddenMenuOpened = false;
private boolean settingsInitialized = false;
// from class: fi.razerman.youtube.XSettingsFragment.9
// android.content.SharedPreferences.OnSharedPreferenceChangeListener
SharedPreferences.OnSharedPreferenceChangeListener listener = (sharedPreferences, str) -> {
if ("debug_xfile_enabled".equals(str)) {
XGlobals.debug = ((SwitchPreference) XSettingsFragment.this.findPreference("debug_xfile_enabled")).isChecked();
} else if ("vp9_xfile_enabled".equals(str)) {
if (((SwitchPreference) XSettingsFragment.this.codecPreferenceScreen.findPreference("vp9_xfile_enabled")).isChecked()) {
sharedPreferences.edit().putString("override_manufacturer", "samsung").apply();
sharedPreferences.edit().putString("override_model", "SM-G920F").apply();
XGlobals.manufacturerOverride = "samsung";
XGlobals.modelOverride = "SM-G920F";
return;
}
sharedPreferences.edit().remove("override_manufacturer").apply();
sharedPreferences.edit().remove("override_model").apply();
XGlobals.manufacturerOverride = null;
XGlobals.modelOverride = null;
} else if ("override_manufacturer".equals(str)) {
EditTextPreference editTextPreference = (EditTextPreference) XSettingsFragment.this.codecPreferenceScreen.findPreference("override_manufacturer");
if (editTextPreference != null) {
editTextPreference.setSummary(editTextPreference.getText());
XGlobals.manufacturerOverride = editTextPreference.getText();
}
} else if ("override_model".equals(str)) {
EditTextPreference editTextPreference2 = (EditTextPreference) XSettingsFragment.this.codecPreferenceScreen.findPreference("override_model");
if (editTextPreference2 != null) {
editTextPreference2.setSummary(editTextPreference2.getText());
XGlobals.modelOverride = editTextPreference2.getText();
}
} else if ("home_ads_enabled".equals(str)) {
XGlobals.homeAdsShown = ((SwitchPreference) XSettingsFragment.this.adsSettingsPreferenceScreen.findPreference("home_ads_enabled")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("video_ads_enabled".equals(str)) {
XGlobals.videoAdsShown = ((SwitchPreference) XSettingsFragment.this.adsSettingsPreferenceScreen.findPreference("video_ads_enabled")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("reel_enabled".equals(str)) {
XGlobals.reelShown = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("reel_enabled")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("info_card_suggestions_enabled".equals(str)) {
XGlobals.suggestionsShown = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("info_card_suggestions_enabled")).isChecked();
} else if ("info_cards_enabled".equals(str)) {
XGlobals.infoCardsShown = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("info_cards_enabled")).isChecked();
} else if ("branding_watermark_enabled".equals(str)) {
XGlobals.brandingShown = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("branding_watermark_enabled")).isChecked();
} else if ("cast_button_enabled".equals(str)) {
XGlobals.castButtonShown = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("cast_button_enabled")).isChecked();
} else if ("tablet_miniplayer".equals(str)) {
XGlobals.tabletMiniplayer = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("tablet_miniplayer")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("comments_location".equals(str)) {
SwitchPreference switchPreference = (SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("comments_location");
XGlobals.commentsLocation = switchPreference.isChecked();
XSwipeHelper.isTabletMode = switchPreference.isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("xfile_create_button_hidden".equals(str)) {
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("xfile_new_actionbar".equals(str)) {
XGlobals.newActionBar = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("xfile_new_actionbar")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("xfile_zoom_to_fit_vertical".equals(str)) {
XGlobals.verticalZoomToFit = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("xfile_zoom_to_fit_vertical")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("pref_minimized_video_preview".equals(str)) {
ListPreference listPreference = (ListPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("pref_minimized_video_preview");
String string = sharedPreferences.getString("pref_minimized_video_preview", "-2");
listPreference.setDefaultValue(string);
listPreference.setSummary(XSettingsFragment.this.minimizedVideoEntries[listPreference.findIndexOfValue(string)]);
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("xfile_accessibility_seek_buttons".equals(str)) {
XGlobals.accessibilitySeek = ((SwitchPreference) XSettingsFragment.this.layoutSettingsPreferenceScreen.findPreference("xfile_accessibility_seek_buttons")).isChecked();
} else if ("override_resolution_xfile_enabled".equals(str)) {
XGlobals.overrideCodec = ((SwitchPreference) XSettingsFragment.this.findPreference("override_resolution_xfile_enabled")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("pref_auto_captions".equals(str)) {
XGlobals.prefAutoCaptions = ((SwitchPreference) XSettingsFragment.this.findPreference("pref_auto_captions")).isChecked();
if (XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
} else if ("pref_preferred_video_quality_wifi".equals(str)) {
ListPreference listPreference2 = (ListPreference) XSettingsFragment.this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_quality_wifi");
String string2 = sharedPreferences.getString("pref_preferred_video_quality_wifi", "-2");
listPreference2.setDefaultValue(string2);
listPreference2.setSummary(XSettingsFragment.this.videoQualityEntries[listPreference2.findIndexOfValue(string2)]);
XGlobals.prefResolutionWIFI = Integer.parseInt(string2);
} else if ("pref_preferred_video_quality_mobile".equals(str)) {
ListPreference listPreference3 = (ListPreference) XSettingsFragment.this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_quality_mobile");
String string3 = sharedPreferences.getString("pref_preferred_video_quality_mobile", "-2");
listPreference3.setDefaultValue(string3);
listPreference3.setSummary(XSettingsFragment.this.videoQualityEntries[listPreference3.findIndexOfValue(string3)]);
XGlobals.prefResolutionMobile = Integer.parseInt(string3);
} else if ("pref_preferred_video_speed".equals(str)) {
ListPreference listPreference4 = (ListPreference) XSettingsFragment.this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_speed");
String string4 = sharedPreferences.getString("pref_preferred_video_speed", "-2");
listPreference4.setDefaultValue(string4);
listPreference4.setSummary(XSettingsFragment.this.videoSpeedEntries[listPreference4.findIndexOfValue(string4)]);
XGlobals.prefVideoSpeed = Float.parseFloat(string4);
} else if ("pref_max_buffer_ms".equals(str)) {
EditTextPreference editTextPreference3 = (EditTextPreference) XSettingsFragment.this.bufferSettingsPreferenceScreen.findPreference("pref_max_buffer_ms");
if (editTextPreference3 != null) {
editTextPreference3.setSummary(editTextPreference3.getText());
XGlobals.maxBuffer = Integer.parseInt(editTextPreference3.getText());
}
} else if ("pref_buffer_for_playback_ms".equals(str)) {
EditTextPreference editTextPreference4 = (EditTextPreference) XSettingsFragment.this.bufferSettingsPreferenceScreen.findPreference("pref_buffer_for_playback_ms");
if (editTextPreference4 != null) {
editTextPreference4.setSummary(editTextPreference4.getText());
XGlobals.playbackMS = Integer.parseInt(editTextPreference4.getText());
}
} else if ("pref_buffer_for_playback_after_rebuffer_ms".equals(str)) {
EditTextPreference editTextPreference5 = (EditTextPreference) XSettingsFragment.this.bufferSettingsPreferenceScreen.findPreference("pref_buffer_for_playback_after_rebuffer_ms");
if (editTextPreference5 != null) {
editTextPreference5.setSummary(editTextPreference5.getText());
XGlobals.reBuffer = Integer.parseInt(editTextPreference5.getText());
}
} else if ("pref_auto_repeat_button".equals(str)) {
XSettingsFragment.this.AutoRepeatLinks();
} else if ("pref_auto_repeat".equals(str)) {
AutoRepeat.changeSelected(sharedPreferences.getBoolean("pref_auto_repeat", false), true);
} else if ("pref_copy_video_url_timestamp_button_list".equals(str)) {
CopyWithTimeStamp.refreshShouldBeShown();
} else if ("pref_copy_video_url_button_list".equals(str)) {
Copy.refreshShouldBeShown();
} else if ("pref_hdr_autobrightness".equals(str)) {
XGlobals.HDRBrightness = ((SwitchPreference) XSettingsFragment.this.miscsPreferenceScreen.findPreference("pref_hdr_autobrightness")).isChecked();
} else if ("pref_xfenster_brightness".equals(str)) {
XGlobals.EnableXFensterBrightness = ((SwitchPreference) XSettingsFragment.this.xFensterPreferenceScreen.findPreference("pref_xfenster_brightness")).isChecked();
} else if ("pref_xfenster_volume".equals(str)) {
XGlobals.EnableXFensterVolume = ((SwitchPreference) XSettingsFragment.this.xFensterPreferenceScreen.findPreference("pref_xfenster_volume")).isChecked();
} else if ("pref_xfenster_tablet".equals(str)) {
XSwipeHelper.isTabletMode = ((SwitchPreference) XSettingsFragment.this.xFensterPreferenceScreen.findPreference("pref_xfenster_tablet")).isChecked();
} else if ("pref_xfenster_swipe_threshold".equals(str)) {
EditTextPreference editTextPreference6 = (EditTextPreference) XSettingsFragment.this.xFensterPreferenceScreen.findPreference("pref_xfenster_swipe_threshold");
if (editTextPreference6 != null) {
editTextPreference6.setSummary(editTextPreference6.getText());
try {
FensterGestureListener.SWIPE_THRESHOLD = Integer.parseInt(editTextPreference6.getText());
} catch (NumberFormatException unused) {
FensterGestureListener.SWIPE_THRESHOLD = 0;
}
}
} else if ("pref_xfenster_swipe_padding_top".equals(str)) {
EditTextPreference editTextPreference7 = (EditTextPreference) XSettingsFragment.this.xFensterPreferenceScreen.findPreference("pref_xfenster_swipe_padding_top");
if (editTextPreference7 != null) {
editTextPreference7.setSummary(editTextPreference7.getText());
try {
FensterGestureListener.TOP_PADDING = Integer.parseInt(editTextPreference7.getText());
} catch (NumberFormatException unused2) {
FensterGestureListener.TOP_PADDING = 20;
}
}
} else if ("vanced_ryd_enabled".equals(str) && XGlobals.getContext() != null && XSettingsFragment.this.settingsInitialized) {
XReboot.RebootDialog(XSettingsFragment.this.getActivity());
}
};
static /* synthetic */ int access$308(XSettingsFragment xSettingsFragment) {
int i = xSettingsFragment.clicks;
xSettingsFragment.clicks = i + 1;
return i;
}
@SuppressLint("ResourceType")
@Override // android.preference.PreferenceFragment, android.app.Fragment
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
getPreferenceManager().setSharedPreferencesName("youtube");
try {
int identifier = getResources().getIdentifier("xfile_prefs", "xml", XGlobals.getPackageName());
if (XGlobals.XFILEDEBUG) {
addPreferencesFromResource(2131689473);
} else {
addPreferencesFromResource(identifier);
}
if (!XGlobals.XFILEDEBUG) {
String stringByName = XGlobals.getStringByName(getActivity(), "quality_auto");
this.videoQualityEntries[0] = stringByName;
this.minimizedVideoEntries[0] = stringByName;
this.videoSpeedEntries[0] = stringByName;
String stringByName2 = XGlobals.getStringByName(getActivity(), "pref_subtitles_scale_normal");
if (stringByName2.equals("")) {
this.videoSpeedEntries[4] = "Normal";
} else {
this.videoSpeedEntries[4] = stringByName2;
}
this.minimizedVideoEntries[1] = XGlobals.getStringByName(getActivity(), "xfile_miniplayer_style_video");
this.minimizedVideoEntries[2] = XGlobals.getStringByName(getActivity(), "xfile_miniplayer_style_video_controls");
}
SharedPreferences sharedPreferences = getPreferenceManager().getSharedPreferences();
this.sharedPreferences = sharedPreferences;
this.settingsInitialized = sharedPreferences.getBoolean("xfile_initialized", false);
this.sharedPreferences.registerOnSharedPreferenceChangeListener(this.listener);
this.Registered = true;
this.hiddenMenuOpened = this.sharedPreferences.getBoolean("xfile_hiddenMenu_enabled", false);
this.codecPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("codec_override");
this.videoSettingsPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("video_settings");
this.videoAdSettingsPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("video_ad_settings");
this.adsSettingsPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("ad_settings");
this.layoutSettingsPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("layout_settings");
this.bufferSettingsPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("buffer_screen");
this.miscsPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("misc_screen");
this.xFensterPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("xfenster_screen");
this.vp9Override = (SwitchPreference) this.codecPreferenceScreen.findPreference("vp9_xfile_enabled");
this.manufacturerOverride = (EditTextPreference) this.codecPreferenceScreen.findPreference("override_manufacturer");
this.modelOverride = (EditTextPreference) this.codecPreferenceScreen.findPreference("override_model");
this.codecDefault = this.codecPreferenceScreen.findPreference("pref_default_override");
this.codecVP9 = this.codecPreferenceScreen.findPreference("pref_vp9_override");
this.codecHDRH = this.codecPreferenceScreen.findPreference("pref_hdrhardware_override");
this.codecHDRS = this.codecPreferenceScreen.findPreference("pref_hdrsoftware_override");
this.tabletMiniplayer = (SwitchPreference) this.layoutSettingsPreferenceScreen.findPreference("tablet_miniplayer");
this.tabletComments = (SwitchPreference) this.layoutSettingsPreferenceScreen.findPreference("comments_location");
AutoRepeatLinks();
EditTextPreference editTextPreference = this.manufacturerOverride;
editTextPreference.setSummary(editTextPreference.getText());
EditTextPreference editTextPreference2 = this.modelOverride;
editTextPreference2.setSummary(editTextPreference2.getText());
CheckHiddenMenuStatus();
final ListPreference listPreference = (ListPreference) this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_quality_wifi");
final ListPreference listPreference2 = (ListPreference) this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_quality_mobile");
setListPreferenceData(listPreference, true);
setListPreferenceData(listPreference2, false);
// from class: fi.razerman.youtube.XSettingsFragment.1
// android.preference.Preference.OnPreferenceClickListener
listPreference.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.setListPreferenceData(listPreference, true);
return false;
});
// from class: fi.razerman.youtube.XSettingsFragment.2
// android.preference.Preference.OnPreferenceClickListener
listPreference2.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.setListPreferenceData(listPreference2, false);
return false;
});
final ListPreference listPreference3 = (ListPreference) this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_speed");
setSpeedListPreferenceData(listPreference3);
// from class: fi.razerman.youtube.XSettingsFragment.3
// android.preference.Preference.OnPreferenceClickListener
listPreference3.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.setSpeedListPreferenceData(listPreference3);
return false;
});
Preference findPreference = findPreference("pref_about_field");
final String stringByName3 = XGlobals.getStringByName(getActivity(), "xfile_hiddenmenu_open");
final String stringByName4 = XGlobals.getStringByName(getActivity(), "xfile_hiddenmenu_opened");
final String str = " " + XGlobals.getStringByName(getActivity(), "xfile_hiddenmenu_needed");
// from class: fi.razerman.youtube.XSettingsFragment.4
// android.preference.Preference.OnPreferenceClickListener
findPreference.setOnPreferenceClickListener(preference -> {
if (XSettingsFragment.this.hiddenMenuOpened) {
if (XSettingsFragment.this.toast != null) {
XSettingsFragment.this.toast.cancel();
}
XSettingsFragment.this.toast = Toast.makeText(XGlobals.getContext(), stringByName3, Toast.LENGTH_SHORT);
XSettingsFragment.this.toast.show();
return false;
}
long currentTimeMillis = System.currentTimeMillis() - XSettingsFragment.this.PreviousClick;
XSettingsFragment.this.PreviousClick = System.currentTimeMillis();
if (currentTimeMillis / 1000 < 2) {
XSettingsFragment.access$308(XSettingsFragment.this);
int i = XSettingsFragment.this.neededClicks - XSettingsFragment.this.clicks;
if (XSettingsFragment.this.toast != null) {
XSettingsFragment.this.toast.cancel();
}
if (i <= 0) {
XSettingsFragment.this.toast = Toast.makeText(XGlobals.getContext(), stringByName4, Toast.LENGTH_SHORT);
XSettingsFragment.this.hiddenMenuOpened = true;
XSettingsFragment.this.sharedPreferences.edit().putBoolean("xfile_hiddenMenu_enabled", true).apply();
XSettingsFragment.this.CheckHiddenMenuStatus();
} else {
XSettingsFragment xSettingsFragment = XSettingsFragment.this;
Context context = XGlobals.getContext();
xSettingsFragment.toast = Toast.makeText(context, i + str, Toast.LENGTH_SHORT);
}
XSettingsFragment.this.toast.show();
} else {
XSettingsFragment.this.clicks = 0;
}
return false;
});
// from class: fi.razerman.youtube.XSettingsFragment.5
// android.preference.Preference.OnPreferenceClickListener
this.codecDefault.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
// from class: fi.razerman.youtube.XSettingsFragment.6
// android.preference.Preference.OnPreferenceClickListener
this.codecVP9.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
// from class: fi.razerman.youtube.XSettingsFragment.7
// android.preference.Preference.OnPreferenceClickListener
this.codecHDRH.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
// from class: fi.razerman.youtube.XSettingsFragment.8
// android.preference.Preference.OnPreferenceClickListener
this.codecHDRS.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
if (XScreenSizeHelpers.isTablet(YouTubeTikTokRoot_Application.getAppContext())) {
if (this.layoutSettingsPreferenceScreen.findPreference("tablet_miniplayer") != null) {
this.layoutSettingsPreferenceScreen.removePreference(this.tabletMiniplayer);
}
if (this.layoutSettingsPreferenceScreen.findPreference("comments_location") != null) {
this.layoutSettingsPreferenceScreen.removePreference(this.tabletComments);
}
}
this.sharedPreferences.edit().putBoolean("xfile_initialized", true);
this.settingsInitialized = true;
} catch (Throwable th) {
Log.e("XSettingsFragment", "Unable to retrieve resourceId for xfile_prefs", th);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void ChangeCodec(Preference preference) {
String key = preference.getKey();
char c = 65535;
switch (key.hashCode()) {
case -1420246871:
if (key.equals("pref_hdrhardware_override")) {
c = 0;
break;
}
break;
case -350518296:
if (key.equals("pref_vp9_override")) {
c = 1;
break;
}
break;
case 1613958090:
if (key.equals("pref_hdrsoftware_override")) {
c = 2;
break;
}
break;
}
String str = "samsung";
String str2 = null;
switch (c) {
case 0:
str2 = "SM-G955W";
break;
case 1:
str2 = "SM-G920F";
break;
case 2:
str = "Google";
str2 = "Pixel XL";
break;
default:
str = null;
break;
}
if (str != null) {
this.sharedPreferences.edit().putString("override_manufacturer", str).apply();
} else {
this.sharedPreferences.edit().remove("override_manufacturer").apply();
}
if (str2 != null) {
this.sharedPreferences.edit().putString("override_model", str2).apply();
} else {
this.sharedPreferences.edit().remove("override_model").apply();
}
this.manufacturerOverride.setText(str);
this.modelOverride.setText(str2);
EditTextPreference editTextPreference = this.manufacturerOverride;
editTextPreference.setSummary(editTextPreference.getText());
EditTextPreference editTextPreference2 = this.modelOverride;
editTextPreference2.setSummary(editTextPreference2.getText());
}
/* JADX INFO: Access modifiers changed from: private */
public void CheckHiddenMenuStatus() {
if (this.hiddenMenuOpened) {
if (this.codecPreferenceScreen.findPreference("vp9_xfile_enabled") != null) {
this.codecPreferenceScreen.removePreference(this.vp9Override);
}
if (this.codecPreferenceScreen.findPreference("override_manufacturer") == null) {
this.codecPreferenceScreen.addPreference(this.manufacturerOverride);
EditTextPreference editTextPreference = this.manufacturerOverride;
editTextPreference.setSummary(editTextPreference.getText());
}
if (this.codecPreferenceScreen.findPreference("override_model") == null) {
this.codecPreferenceScreen.addPreference(this.modelOverride);
EditTextPreference editTextPreference2 = this.modelOverride;
editTextPreference2.setSummary(editTextPreference2.getText());
}
if (this.codecPreferenceScreen.findPreference("pref_default_override") == null) {
this.codecPreferenceScreen.addPreference(this.codecDefault);
// from class: fi.razerman.youtube.XSettingsFragment.10
// android.preference.Preference.OnPreferenceClickListener
this.codecDefault.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
}
if (this.codecPreferenceScreen.findPreference("pref_vp9_override") == null) {
this.codecPreferenceScreen.addPreference(this.codecVP9);
// from class: fi.razerman.youtube.XSettingsFragment.11
// android.preference.Preference.OnPreferenceClickListener
this.codecVP9.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
}
if (this.codecPreferenceScreen.findPreference("pref_hdrhardware_override") == null) {
this.codecPreferenceScreen.addPreference(this.codecHDRH);
// from class: fi.razerman.youtube.XSettingsFragment.12
// android.preference.Preference.OnPreferenceClickListener
this.codecHDRH.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
}
if (this.codecPreferenceScreen.findPreference("pref_hdrsoftware_override") == null) {
this.codecPreferenceScreen.addPreference(this.codecHDRS);
// from class: fi.razerman.youtube.XSettingsFragment.13
// android.preference.Preference.OnPreferenceClickListener
this.codecHDRS.setOnPreferenceClickListener(preference -> {
XSettingsFragment.this.ChangeCodec(preference);
return false;
});
return;
}
return;
}
if (this.codecPreferenceScreen.findPreference("vp9_xfile_enabled") == null) {
this.codecPreferenceScreen.addPreference(this.vp9Override);
}
if (this.codecPreferenceScreen.findPreference("override_manufacturer") != null) {
this.codecPreferenceScreen.removePreference(this.manufacturerOverride);
}
if (this.codecPreferenceScreen.findPreference("override_model") != null) {
this.codecPreferenceScreen.removePreference(this.modelOverride);
}
if (this.codecPreferenceScreen.findPreference("pref_default_override") != null) {
this.codecPreferenceScreen.removePreference(this.codecDefault);
}
if (this.codecPreferenceScreen.findPreference("pref_vp9_override") != null) {
this.codecPreferenceScreen.removePreference(this.codecVP9);
}
if (this.codecPreferenceScreen.findPreference("pref_hdrhardware_override") != null) {
this.codecPreferenceScreen.removePreference(this.codecHDRH);
}
if (this.codecPreferenceScreen.findPreference("pref_hdrsoftware_override") != null) {
this.codecPreferenceScreen.removePreference(this.codecHDRS);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void AutoRepeatLinks() {
boolean z = this.sharedPreferences.getBoolean("pref_auto_repeat_button", false);
SwitchPreference switchPreference = (SwitchPreference) this.miscsPreferenceScreen.findPreference("pref_auto_repeat");
if (switchPreference == null) {
return;
}
if (z) {
switchPreference.setEnabled(false);
AutoRepeat.isAutoRepeatBtnEnabled = true;
return;
}
switchPreference.setEnabled(true);
AutoRepeat.isAutoRepeatBtnEnabled = false;
}
protected void setListPreferenceData(ListPreference listPreference, boolean z) {
listPreference.setEntries(this.videoQualityEntries);
listPreference.setEntryValues(this.videoQualityentryValues);
String string = this.sharedPreferences.getString(z ? "pref_preferred_video_quality_wifi" : "pref_preferred_video_quality_mobile", "-2");
if (listPreference.getValue() == null) {
listPreference.setValue(string);
}
listPreference.setSummary(this.videoQualityEntries[listPreference.findIndexOfValue(string)]);
}
protected void setMinimizedListPreferenceData(ListPreference listPreference) {
listPreference.setEntries(this.minimizedVideoEntries);
listPreference.setEntryValues(this.minimizedVideoentryValues);
String string = this.sharedPreferences.getString("pref_minimized_video_preview", "-2");
if (listPreference.getValue() == null) {
listPreference.setValue(string);
}
listPreference.setSummary(this.minimizedVideoEntries[listPreference.findIndexOfValue(string)]);
}
protected void setSpeedListPreferenceData(ListPreference listPreference) {
listPreference.setEntries(this.videoSpeedEntries);
listPreference.setEntryValues(this.videoSpeedentryValues);
String string = this.sharedPreferences.getString("pref_preferred_video_speed", "-2");
if (listPreference.getValue() == null) {
listPreference.setValue(string);
}
listPreference.setSummary(this.videoSpeedEntries[listPreference.findIndexOfValue(string)]);
}
protected void setCopyLinkListPreferenceData(ListPreference listPreference, String str) {
listPreference.setEntries(this.buttonLocationEntries);
listPreference.setEntryValues(this.buttonLocationentryValues);
String string = this.sharedPreferences.getString(str, "NONE");
if (listPreference.getValue() == null) {
listPreference.setValue(string);
}
listPreference.setSummary(this.buttonLocationEntries[listPreference.findIndexOfValue(string)]);
}
private void RestartApplication() {
Intent launchIntentForPackage = getActivity().getBaseContext().getPackageManager().getLaunchIntentForPackage(getActivity().getBaseContext().getPackageName());
launchIntentForPackage.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(launchIntentForPackage);
getActivity().finish();
}
@Override // android.preference.PreferenceFragment, android.app.Fragment
public void onDestroy() {
if (this.Registered) {
this.sharedPreferences.unregisterOnSharedPreferenceChangeListener(this.listener);
this.Registered = false;
}
super.onDestroy();
}
}

View File

@ -0,0 +1,165 @@
package fi.razerman.youtube;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.util.Log;
import android.util.TypedValue;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.Helpers.ColorRef;
/* loaded from: classes6.dex */
public class XTheme {
static boolean ENABLE_COLOR_OVERRIDE = false;
public static int SearchIconColor(int original) {
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (context == null) {
Log.e("XTheme", "Context is null, returning " + original);
return original;
}
try {
return context.getResources().getColor(context.getResources().getIdentifier("custom_search_color", "color", XGlobals.getPackageName()));
} catch (Resources.NotFoundException e) {
return original;
}
}
public static int RefreshIconColor(int original) {
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (context == null) {
Log.e("XTheme", "Context is null, returning " + original);
return original;
}
try {
return context.getResources().getColor(context.getResources().getIdentifier("custom_refresh_color", "color", XGlobals.getPackageName()));
} catch (Resources.NotFoundException e) {
return original;
}
}
public static int RefreshIconColor(Context context, int attributeId) {
return getColorAttrContext(context, attributeId);
}
public static int getColorAttrContext(Context context, int attributeId) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(attributeId, typedValue, true);
int colorRes = typedValue.resourceId;
try {
int color = context.getResources().getColor(colorRes);
return color;
} catch (Resources.NotFoundException e) {
Log.w("XGlobals", "Not found color resource by id: " + colorRes);
return -328966;
}
}
public static int getColorAttrActivity(Activity context, int attributeId) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(attributeId, typedValue, true);
int colorRes = typedValue.resourceId;
try {
return context.getResources().getColor(colorRes);
} catch (Resources.NotFoundException e) {
Log.w("XGlobals", "Not found color resource by id: " + colorRes);
return -328966;
}
}
public static int PinnedMessageColor(int original) {
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (context == null) {
Log.e("XTheme", "Context is null, returning " + original);
return original;
}
try {
return context.getResources().getColor(context.getResources().getIdentifier("custom_pinned_color", "color", XGlobals.getPackageName()));
} catch (Resources.NotFoundException e) {
return original;
}
}
public static int getTheme(SharedPreferences sharedPreferences) {
if (sharedPreferences.getBoolean("app_theme_dark", false)) {
return 2;
}
if (sharedPreferences.getBoolean("app_theme_dark", false)) {
return 3;
}
return 1;
}
private static boolean isDarkTheme() {
return XGlobals.getThemeStatus();
}
public static int foregroundColorOverride(int original) {
int returnValue;
int returnValue2;
if (!ENABLE_COLOR_OVERRIDE) {
return original;
}
if (XGlobals.debug) {
Log.d("XTheme", "foregroundColorOverride: " + original);
}
switch (original) {
case -16359468:
int returnValue3 = ColorRef.color("vanced_link_text_light", -16359468);
if (!XGlobals.debug) {
return returnValue3;
}
Log.d("XTheme", "foregroundColorOverride - returning blue: " + returnValue3);
return returnValue3;
case -15527149:
if (isDarkTheme()) {
returnValue2 = ColorRef.color("vanced_text_secondary_dark", -15527149);
} else {
returnValue2 = ColorRef.color("vanced_text_primary_light", -15527149);
}
if (!XGlobals.debug) {
return returnValue2;
}
Log.d("XTheme", "foregroundColorOverride - returning black: " + returnValue2);
return returnValue2;
case -12671233:
int returnValue4 = ColorRef.color("vanced_link_text_dark", -12671233);
if (!XGlobals.debug) {
return returnValue4;
}
Log.d("XTheme", "foregroundColorOverride - returning blue: " + returnValue4);
return returnValue4;
case -10461088:
int returnValue5 = ColorRef.color("vanced_text_accent_light", -10461088);
if (!XGlobals.debug) {
return returnValue5;
}
Log.d("XTheme", "foregroundColorOverride - returning grey: " + returnValue5);
return returnValue5;
case -5592406:
int returnValue6 = ColorRef.color("vanced_text_accent_dark", -5592406);
if (!XGlobals.debug) {
return returnValue6;
}
Log.d("XTheme", "foregroundColorOverride - returning grey: " + returnValue6);
return returnValue6;
case -1:
if (isDarkTheme()) {
returnValue = ColorRef.color("vanced_text_primary_dark", -1);
} else {
returnValue = ColorRef.color("vanced_text_secondary_light", -1);
}
if (!XGlobals.debug) {
return returnValue;
}
Log.d("XTheme", "foregroundColorOverride - returning white: " + returnValue);
return returnValue;
default:
if (XGlobals.debug) {
Log.d("XTheme", "foregroundColorOverride - returning original: " + original);
}
return original;
}
}
}

View File

@ -0,0 +1,212 @@
package fi.razerman.youtube.litho;
import android.util.Log;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.Helpers.SharedPrefs;
import fi.razerman.youtube.XGlobals;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/* loaded from: classes6.dex */
public class LithoAdRemoval {
private static final byte[] endRelatedPageAd = {112, 97, 103, 101, 97, 100};
private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
public static boolean isExperimentalAdRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_ad_removal", true);
}
public static boolean isExperimentalMerchandiseRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_merchandise", false);
}
public static boolean isExperimentalCommunityPostRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_community_posts", false);
}
public static boolean isExperimentalMovieUpsellRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_movie_upsell", false);
}
public static boolean isExperimentalCompactBannerRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_compact_banner", false);
}
public static boolean isExperimentalCommentsRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_comments", false);
}
public static boolean isExperimentalCompactMovieRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_compact_movie", false);
}
public static boolean isExperimentalHorizontalMovieShelfRemoval() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_horizontal_movie_shelf", false);
}
public static boolean isInFeedSurvey() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_in_feed_survey", false);
}
public static boolean isShortsShelf() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_shorts_shelf", false);
}
public static boolean isCommunityGuidelines() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "experimental_community_guidelines", false);
}
public static boolean containsAd(String value) {
if (!(isExperimentalAdRemoval() || isExperimentalMerchandiseRemoval() || isExperimentalCommunityPostRemoval() || isExperimentalMovieUpsellRemoval() || isExperimentalCompactBannerRemoval() || isExperimentalCommentsRemoval() || isExperimentalCompactMovieRemoval() || isExperimentalHorizontalMovieShelfRemoval() || isInFeedSurvey() || isShortsShelf() || isCommunityGuidelines()) || value == null || value.isEmpty()) {
return false;
}
List<String> blockList = new ArrayList<>();
if (isExperimentalAdRemoval()) {
blockList.add("_ad");
blockList.add("ad_badge");
}
if (isExperimentalMerchandiseRemoval()) {
blockList.add("product_carousel");
}
if (isExperimentalCommunityPostRemoval()) {
blockList.add("post_base_wrapper");
}
if (isExperimentalMovieUpsellRemoval()) {
blockList.add("movie_and_show_upsell_card");
}
if (isExperimentalCompactBannerRemoval()) {
blockList.add("compact_banner");
}
if (isExperimentalCommentsRemoval()) {
blockList.add("comments_composite_entry_point");
}
if (isExperimentalCompactMovieRemoval()) {
blockList.add("compact_movie");
}
if (isExperimentalHorizontalMovieShelfRemoval()) {
blockList.add("horizontal_movie_shelf");
}
if (isInFeedSurvey()) {
blockList.add("in_feed_survey");
}
if (isShortsShelf()) {
blockList.add("shorts_shelf");
}
if (isCommunityGuidelines()) {
blockList.add("community_guidelines");
}
for (String s : blockList) {
if (value.contains(s)) {
if (XGlobals.debug) {
Log.d("TemplateBlocked", value);
}
return true;
}
}
if (!XGlobals.debug) {
return false;
}
Log.d("Template", value);
return false;
}
public static boolean containsAd(String value, ByteBuffer buffer) {
try {
if (!(isExperimentalAdRemoval() || isExperimentalMerchandiseRemoval() || isExperimentalCommunityPostRemoval() || isExperimentalMovieUpsellRemoval() || isExperimentalCompactBannerRemoval() || isExperimentalCommentsRemoval() || isExperimentalCompactMovieRemoval() || isExperimentalHorizontalMovieShelfRemoval() || isInFeedSurvey() || isShortsShelf() || isCommunityGuidelines()) || value == null || value.isEmpty()) {
return false;
}
List<String> blockList = new ArrayList<>();
if (isExperimentalAdRemoval()) {
blockList.add("_ad");
blockList.add("ad_badge");
blockList.add("ads_video_with_context");
}
if (isExperimentalMerchandiseRemoval()) {
blockList.add("product_carousel");
}
if (isExperimentalCommunityPostRemoval()) {
blockList.add("post_base_wrapper");
}
if (isExperimentalMovieUpsellRemoval()) {
blockList.add("movie_and_show_upsell_card");
}
if (isExperimentalCompactBannerRemoval()) {
blockList.add("compact_banner");
}
if (isExperimentalCommentsRemoval()) {
blockList.add("comments_composite_entry_point");
}
if (isExperimentalCompactMovieRemoval()) {
blockList.add("compact_movie");
}
if (isExperimentalHorizontalMovieShelfRemoval()) {
blockList.add("horizontal_movie_shelf");
}
if (isInFeedSurvey()) {
blockList.add("in_feed_survey");
}
if (isShortsShelf()) {
blockList.add("shorts_shelf");
}
if (isCommunityGuidelines()) {
blockList.add("community_guidelines");
}
if (!value.contains("related_video_with_context") || indexOf(buffer.array(), endRelatedPageAd) <= 0) {
for (String s : blockList) {
if (value.contains(s)) {
if (XGlobals.debug) {
Log.d("TemplateBlocked", value);
}
return true;
}
}
if (!XGlobals.debug) {
return false;
}
if (value.contains("related_video_with_context")) {
Log.d("Template", value + " | " + bytesToHex(buffer.array()));
return false;
}
Log.d("Template", value);
return false;
}
if (XGlobals.debug) {
Log.d("TemplateBlocked", value);
}
return true;
} catch (Exception ex) {
Log.e("Template", ex.getMessage(), ex);
return false;
}
}
public static int indexOf(byte[] array, byte[] target) {
if (target.length == 0) {
return 0;
}
int i = 0;
while (i < array.length - target.length + 1 ){
for (int j = 0; j < target.length; j++) {
if (array[i+j] != target[j]) {
break;
}
}
return i;
}
return -1;
}
private static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 255;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[(j * 2) + 1] = hexArray[v & 15];
}
return new String(hexChars);
}
}

View File

@ -0,0 +1,22 @@
package fi.razerman.youtube.preferences;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import java.util.Objects;
import fi.razerman.youtube.Helpers.SharedPrefs;
/* loaded from: classes6.dex */
public class BooleanPreferences {
public static boolean isTapSeekingEnabled() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "xfile_enable_tap_seeking", true);
}
public static boolean isExoplayerV2Enabled() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "xfile_exoplayer_v2", true);
}
public static boolean isCreateButtonHidden() {
return SharedPrefs.getBoolean(Objects.requireNonNull(YouTubeTikTokRoot_Application.getAppContext()), "xfile_create_button_hidden", false);
}
}

View File

@ -0,0 +1,108 @@
package fi.razerman.youtube.videosettings;
import android.content.Context;
import android.util.Log;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.Connectivity;
import fi.razerman.youtube.XGlobals;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
/* loaded from: classes6.dex */
public class VideoQuality {
static final int[] videoResolutions = {0, 144, 240, 360, 480, 720, 1080, 1440, 2160};
public static void userChangedQuality() {
XGlobals.userChangedQuality = true;
XGlobals.newVideo = false;
}
public static int setVideoQuality(Object[] qualities, int quality, Object qInterface) {
int preferredQuality;
Field[] fields;
if (!XGlobals.newVideo || XGlobals.userChangedQuality || qInterface == null) {
if (XGlobals.debug && XGlobals.userChangedQuality) {
Log.d("XGlobals - quality", "Skipping quality change because user changed it: " + quality);
}
XGlobals.userChangedQuality = false;
return quality;
}
XGlobals.newVideo = false;
if (XGlobals.debug) {
Log.d("XGlobals - quality", "Quality: " + quality);
}
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (context == null) {
Log.e("XGlobals", "Context is null or settings not initialized, returning quality: " + quality);
return quality;
}
if (Connectivity.isConnectedWifi(context)) {
preferredQuality = XGlobals.prefResolutionWIFI;
if (XGlobals.debug) {
Log.d("XGlobals", "Wi-Fi connection detected, preferred quality: " + preferredQuality);
}
} else if (Connectivity.isConnectedMobile(context)) {
preferredQuality = XGlobals.prefResolutionMobile;
if (XGlobals.debug) {
Log.d("XGlobals", "Mobile data connection detected, preferred quality: " + preferredQuality);
}
} else {
if (XGlobals.debug) {
Log.d("XGlobals", "No Internet connection!");
}
return quality;
}
if (preferredQuality == -2) {
return quality;
}
Class<?> intType = Integer.TYPE;
ArrayList<Integer> iStreamQualities = new ArrayList<>();
try {
for (Object streamQuality : qualities) {
for (Field field : streamQuality.getClass().getFields()) {
if (field.getType().isAssignableFrom(intType)) {
int value = field.getInt(streamQuality);
if (field.getName().length() <= 2) {
iStreamQualities.add(value);
}
}
}
}
} catch (Exception ignored) {}
Collections.sort(iStreamQualities);
int index = 0;
for (int streamQuality2 : iStreamQualities) {
if (XGlobals.debug) {
Log.d("XGlobals - qualities", "Quality at index " + index + ": " + streamQuality2);
}
index++;
}
for (Integer iStreamQuality : iStreamQualities) {
int streamQuality3 = iStreamQuality;
if (streamQuality3 <= preferredQuality) {
quality = streamQuality3;
}
}
if (quality == -2) {
return quality;
}
int qualityIndex = iStreamQualities.indexOf(quality);
if (XGlobals.debug) {
Log.d("XGlobals", "Index of quality " + quality + " is " + qualityIndex);
}
try {
Class<?> cl = qInterface.getClass();
Method m = cl.getMethod("x", Integer.TYPE);
m.invoke(qInterface, iStreamQualities.get(qualityIndex));
if (XGlobals.debug) {
Log.d("XGlobals", "Quality changed to: " + qualityIndex);
}
return qualityIndex;
} catch (Exception ex) {
Log.e("XGlobals", "Failed to set quality", ex);
return qualityIndex;
}
}
}

View File

@ -0,0 +1,198 @@
package fi.razerman.youtube.videosettings;
import android.util.Log;
import fi.razerman.youtube.XGlobals;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes6.dex */
public class VideoSpeed {
static final float[] videoSpeeds = {0.25f, 0.5f, 0.75f, 1.0f, 1.25f, 1.5f, 1.75f, 2.0f};
public static int DefaultSpeed(Object[] speeds, int speed, Object qInterface) {
int speed2;
Exception e;
if (!XGlobals.newVideoSpeed) {
return speed;
}
XGlobals.newVideoSpeed = false;
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed: " + speed);
}
float preferredSpeed = XGlobals.prefVideoSpeed;
if (XGlobals.debug) {
Log.d("XGlobals", "Preferred speed: " + preferredSpeed);
}
if (preferredSpeed == -2.0f) {
return speed;
}
Class<?> floatType = Float.TYPE;
ArrayList<Float> iStreamSpeeds = new ArrayList<>();
try {
for (Object streamSpeed : speeds) {
Field[] fields = streamSpeed.getClass().getFields();
for (Field field : fields) {
if (field.getType().isAssignableFrom(floatType)) {
float value = field.getFloat(streamSpeed);
if (field.getName().length() <= 2) {
iStreamSpeeds.add(value);
}
}
}
}
} catch (Exception ignored) {
}
Iterator<Float> it = iStreamSpeeds.iterator();
int index = 0;
while (it.hasNext()) {
float streamSpeed2 = it.next();
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed at index " + index + ": " + streamSpeed2);
}
index++;
}
int speed3 = -1;
for (float streamSpeed3 : iStreamSpeeds) {
if (streamSpeed3 <= preferredSpeed) {
speed3++;
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed loop at index " + speed3 + ": " + streamSpeed3);
}
}
}
if (speed3 == -1) {
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed was not found");
}
speed2 = 3;
} else {
speed2 = speed3;
}
try {
Method[] declaredMethods = qInterface.getClass().getDeclaredMethods();
for (Method method : declaredMethods) {
if (method.getName().length() <= 2) {
if (XGlobals.debug) {
Log.d("SPEED - Method", "Method name: " + method.getName());
}
try {
try {
method.invoke(qInterface, videoSpeeds[speed2]);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) {
} catch (Exception e6) {
e = e6;
Log.e("XDebug", e.getMessage());
return speed2;
}
} catch (Exception ignored) {
}
}
}
} catch (Exception e10) {
e = e10;
}
if (XGlobals.debug) {
Log.d("XGlobals", "Speed changed to: " + speed2);
}
return speed2;
}
public static void userChangedSpeed() {
XGlobals.userChangedSpeed = true;
XGlobals.newVideoSpeed = false;
}
private static float getSpeedByIndex(int index) {
if (index == -2) {
return 1.0f;
}
try {
return videoSpeeds[index];
} catch (Exception e) {
return 1.0f;
}
}
public static float getSpeedValue(Object[] speeds, int speed) {
int i = 0;
if (!XGlobals.newVideoSpeed || XGlobals.userChangedSpeed) {
if (XGlobals.debug && XGlobals.userChangedSpeed) {
Log.d("XGlobals - speeds", "Skipping speed change because user changed it: " + speed);
}
XGlobals.userChangedSpeed = false;
return -1.0f;
}
XGlobals.newVideoSpeed = false;
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed: " + speed);
}
float preferredSpeed = XGlobals.prefVideoSpeed;
if (XGlobals.debug) {
Log.d("XGlobals", "Preferred speed: " + preferredSpeed);
}
if (preferredSpeed == -2.0f) {
return -1.0f;
}
Class<?> floatType = Float.TYPE;
ArrayList<Float> iStreamSpeeds = new ArrayList<>();
try {
int length = speeds.length;
int i2 = 0;
while (i2 < length) {
Object streamSpeed = speeds[i2];
Field[] fields = streamSpeed.getClass().getFields();
int length2 = fields.length;
while (i < length2) {
Field field = fields[i];
if (field.getType().isAssignableFrom(floatType)) {
float value = field.getFloat(streamSpeed);
if (field.getName().length() <= 2) {
iStreamSpeeds.add(value);
}
}
i++;
}
i2++;
i = 0;
}
} catch (Exception ignored) {
}
int index = 0;
for (Float iStreamSpeed : iStreamSpeeds) {
float streamSpeed2 = iStreamSpeed;
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed at index " + index + ": " + streamSpeed2);
}
index++;
}
int newSpeedIndex = -1;
for (Float iStreamSpeed : iStreamSpeeds) {
float streamSpeed3 = iStreamSpeed;
if (streamSpeed3 <= preferredSpeed) {
newSpeedIndex++;
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed loop at index " + newSpeedIndex + ": " + streamSpeed3);
}
}
}
if (newSpeedIndex == -1) {
if (XGlobals.debug) {
Log.d("XGlobals - speeds", "Speed was not found");
}
newSpeedIndex = 3;
}
if (newSpeedIndex == speed) {
if (XGlobals.debug) {
Log.d("XGlobals", "Trying to set speed to what it already is, skipping...: " + newSpeedIndex);
}
return -1.0f;
}
if (XGlobals.debug) {
Log.d("XGlobals", "Speed changed to: " + newSpeedIndex);
}
return getSpeedByIndex(newSpeedIndex);
}
}

View File

@ -37,7 +37,7 @@ public class SponsorBlockSettings {
public static final String PREFERENCES_KEY_LAST_VIP_CHECK = "sb-last-vip-check";
public static final String PREFERENCES_KEY_API_URL = "sb-api-url";
public static final SegmentBehaviour DefaultBehaviour = SegmentBehaviour.SKIP_AUTOMATICALLY;
public static final SegmentBehaviour DefaultBehaviour = SegmentBehaviour.IGNORE;
public static final String DEFAULT_SERVER_URL = "https://sponsor.ajay.app";
public static final String DEFAULT_API_URL = DEFAULT_SERVER_URL + "/api/";
@ -203,7 +203,7 @@ public class SponsorBlockSettings {
}
public enum SegmentInfo {
SPONSOR("sponsor", sf("segments_sponsor"), sf("skipped_sponsor"), sf("segments_sponsor_sum"), DefaultBehaviour, 0xFF00d400),
SPONSOR("sponsor", sf("segments_sponsor"), sf("skipped_sponsor"), sf("segments_sponsor_sum"), SegmentBehaviour.SKIP_AUTOMATICALLY, 0xFF00d400),
INTRO("intro", sf("segments_intermission"), sf("skipped_intermission"), sf("segments_intermission_sum"), DefaultBehaviour, 0xFF00ffff),
OUTRO("outro", sf("segments_endcards"), sf("skipped_endcard"), sf("segments_endcards_sum"), DefaultBehaviour, 0xFF0202ed),
INTERACTION("interaction", sf("segments_subscribe"), sf("skipped_subscribe"), sf("segments_subscribe_sum"), DefaultBehaviour, 0xFFcc00ff),