This commit is contained in:
Cuynu 2024-01-01 03:57:14 +07:00
commit 5d9cea25fc
93 changed files with 123 additions and 11952 deletions

View file

@ -1,16 +0,0 @@
package com.vanced.integrations;
import android.content.Context;
import android.util.Log;
public class XGlobals {
public static Context context;
public static Context getAppContext() {
if (context != null) {
return context;
}
Log.e("Globals", "Context is null!");
return null;
}
}

View file

@ -1,67 +0,0 @@
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

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

View file

@ -1,24 +0,0 @@
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

@ -1,33 +0,0 @@
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

@ -1,128 +0,0 @@
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

@ -1,54 +0,0 @@
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

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

View file

@ -1,135 +0,0 @@
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 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);
}
/**
* @param context YouTubePlayerOverlaysLayout.overlayContext
*/
public void refreshViewGroup(ViewGroup viewGroup, Context context) {
if (this.mTextView.getParent() != null) {
((ViewGroup) this.mTextView.getParent()).removeView(this.mTextView);
}
this.mContext = context;
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

@ -1,124 +0,0 @@
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

@ -1,308 +0,0 @@
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;
import fi.razerman.youtube.XSettingsFragment;
/* 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, XSettingsFragment.overlayContext);
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

@ -1,67 +0,0 @@
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 cf(@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 cf(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

@ -1,10 +0,0 @@
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

@ -1,49 +0,0 @@
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

@ -1,14 +0,0 @@
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

@ -1,22 +0,0 @@
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,82 +0,0 @@
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 {
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

@ -1,43 +0,0 @@
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

@ -1,155 +0,0 @@
package fi.razerman.youtube.VideoUrl;
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 android.support.constraint.ConstraintLayout;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import fi.razerman.youtube.XGlobals;
import java.lang.ref.WeakReference;
/* loaded from: classes6.dex */
public class AutoRepeat {
static String TAG = "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(TAG, "initializing auto repeat");
}
_constraintLayout = (ConstraintLayout) constraintLayout;
isAutoRepeatBtnEnabled = shouldBeShown();
ImageView imageView = _constraintLayout.findViewById(getIdentifier("autoreplay_button", "id"));
if (XGlobals.debug && imageView == null) {
Log.d(TAG, "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(TAG, "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) {
if (isShowing != visible) {
isShowing = visible;
ImageView iView = _autoRepeatBtn.get();
if (_constraintLayout != null && iView != null) {
if (visible && isAutoRepeatBtnEnabled) {
if (XGlobals.debug) {
Log.d(TAG, "Fading in");
}
iView.setVisibility(View.VISIBLE);
iView.startAnimation(fadeIn);
} else if (iView.getVisibility() == View.VISIBLE) {
if (XGlobals.debug) {
Log.d(TAG, "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(TAG, sb.toString());
}
iView.setSelected(selected);
if (!onlyView) {
setSelected(selected);
}
}
}
private static boolean shouldBeSelected() {
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (context == null) {
Log.e(TAG, "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(TAG, "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(TAG, "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

@ -1,117 +0,0 @@
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 android.support.constraint.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"));
}
}

Some files were not shown because too many files have changed in this diff Show more