feat(YouTube - Debugging): Add setting to block experimental client flags (#6196)
This commit is contained in:
parent
81f83690d6
commit
2e9d6959c9
36 changed files with 1174 additions and 281 deletions
|
|
@ -4,6 +4,7 @@ import android.view.View;
|
|||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
|
@ -31,7 +32,7 @@ public final class WideSearchbarPatch {
|
|||
final int paddingRight = searchBarView.getPaddingRight();
|
||||
final int paddingTop = searchBarView.getPaddingTop();
|
||||
final int paddingBottom = searchBarView.getPaddingBottom();
|
||||
final int paddingStart = Utils.dipToPixels(8);
|
||||
final int paddingStart = Dim.dp8;
|
||||
|
||||
if (Utils.isRightToLeftLocale()) {
|
||||
searchBarView.setPadding(paddingLeft, paddingTop, paddingStart, paddingBottom);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package app.revanced.extension.youtube.patches.announcements;
|
|||
|
||||
import static android.text.Html.FROM_HTML_MODE_COMPACT;
|
||||
import static app.revanced.extension.shared.StringRef.str;
|
||||
import static app.revanced.extension.shared.Utils.dipToPixels;
|
||||
import static app.revanced.extension.youtube.patches.announcements.requests.AnnouncementsRoutes.GET_LATEST_ANNOUNCEMENTS;
|
||||
import static app.revanced.extension.youtube.patches.announcements.requests.AnnouncementsRoutes.GET_LATEST_ANNOUNCEMENT_IDS;
|
||||
|
||||
|
|
@ -24,6 +23,7 @@ import java.time.LocalDateTime;
|
|||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.requests.Requester;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.youtube.patches.announcements.requests.AnnouncementsRoutes;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ public final class AnnouncementsPatch {
|
|||
if (child instanceof TextView childTextView && finalTitle.equals(childTextView.getText().toString())) {
|
||||
childTextView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
finalLevel.icon, 0, 0, 0);
|
||||
childTextView.setCompoundDrawablePadding(dipToPixels(8));
|
||||
childTextView.setCompoundDrawablePadding(Dim.dp8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package app.revanced.extension.youtube.patches.playback.speed;
|
||||
|
||||
import static app.revanced.extension.shared.StringRef.str;
|
||||
import static app.revanced.extension.shared.Utils.dipToPixels;
|
||||
import static app.revanced.extension.youtube.videoplayer.PlayerControlButton.fadeInDuration;
|
||||
import static app.revanced.extension.youtube.videoplayer.PlayerControlButton.getDialogBackgroundColor;
|
||||
|
||||
|
|
@ -30,6 +29,7 @@ import java.util.function.Function;
|
|||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.shared.ui.SheetBottomDialog;
|
||||
import app.revanced.extension.youtube.patches.VideoInformation;
|
||||
import app.revanced.extension.youtube.patches.components.PlaybackSpeedMenuFilter;
|
||||
|
|
@ -264,14 +264,6 @@ public class CustomPlaybackSpeedPatch {
|
|||
SheetBottomDialog.DraggableLinearLayout mainLayout =
|
||||
SheetBottomDialog.createMainLayout(context, getDialogBackgroundColor());
|
||||
|
||||
// Preset size constants.
|
||||
final int dip4 = dipToPixels(4);
|
||||
final int dip8 = dipToPixels(8);
|
||||
final int dip12 = dipToPixels(12);
|
||||
final int dip20 = dipToPixels(20);
|
||||
final int dip32 = dipToPixels(32);
|
||||
final int dip60 = dipToPixels(60);
|
||||
|
||||
// Display current playback speed.
|
||||
TextView currentSpeedText = new TextView(context);
|
||||
float currentSpeed = VideoInformation.getPlaybackSpeed();
|
||||
|
|
@ -283,7 +275,7 @@ public class CustomPlaybackSpeedPatch {
|
|||
currentSpeedText.setGravity(Gravity.CENTER);
|
||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
textParams.setMargins(0, dip20, 0, 0);
|
||||
textParams.setMargins(0, Dim.dp20, 0, 0);
|
||||
currentSpeedText.setLayoutParams(textParams);
|
||||
// Add current speed text view to main layout.
|
||||
mainLayout.addView(currentSpeedText);
|
||||
|
|
@ -294,8 +286,8 @@ public class CustomPlaybackSpeedPatch {
|
|||
sliderLayout.setGravity(Gravity.CENTER_VERTICAL);
|
||||
|
||||
// Create +/- buttons.
|
||||
Button minusButton = createStyledButton(context, false, dip8, dip8);
|
||||
Button plusButton = createStyledButton(context, true, dip8, dip8);
|
||||
Button minusButton = createStyledButton(context, false);
|
||||
Button plusButton = createStyledButton(context, true);
|
||||
|
||||
// Create slider for speed adjustment.
|
||||
SeekBar speedSlider = new SeekBar(context);
|
||||
|
|
@ -363,7 +355,7 @@ public class CustomPlaybackSpeedPatch {
|
|||
gridLayout.setRowCount((int) Math.ceil(customPlaybackSpeeds.length / 5.0));
|
||||
LinearLayout.LayoutParams gridParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
gridParams.setMargins(dip4, dip12, dip4, dip12); // Speed buttons container.
|
||||
gridParams.setMargins(Dim.dp4, Dim.dp12, Dim.dp4, Dim.dp12); // Speed buttons container.
|
||||
gridLayout.setLayoutParams(gridParams);
|
||||
|
||||
// For button use 1 digit minimum.
|
||||
|
|
@ -378,8 +370,8 @@ public class CustomPlaybackSpeedPatch {
|
|||
GridLayout.LayoutParams containerParams = new GridLayout.LayoutParams();
|
||||
containerParams.width = 0; // Equal width for columns.
|
||||
containerParams.columnSpec = GridLayout.spec(GridLayout.UNDEFINED, 1, 1f);
|
||||
containerParams.setMargins(dip4, 0, dip4, 0); // Button margins.
|
||||
containerParams.height = dip60; // Fixed height for button and label.
|
||||
containerParams.setMargins(Dim.dp4, 0, Dim.dp4, 0); // Button margins.
|
||||
containerParams.height = Dim.dp(60); // Fixed height for button and label.
|
||||
buttonContainer.setLayoutParams(containerParams);
|
||||
|
||||
// Create speed button.
|
||||
|
|
@ -391,14 +383,14 @@ public class CustomPlaybackSpeedPatch {
|
|||
speedButton.setGravity(Gravity.CENTER);
|
||||
|
||||
ShapeDrawable buttonBackground = new ShapeDrawable(new RoundRectShape(
|
||||
Utils.createCornerRadii(20), null, null));
|
||||
Dim.roundedCorners(20), null, null));
|
||||
buttonBackground.getPaint().setColor(getAdjustedBackgroundColor(false));
|
||||
speedButton.setBackground(buttonBackground);
|
||||
speedButton.setPadding(dip4, dip4, dip4, dip4);
|
||||
speedButton.setPadding(Dim.dp4, Dim.dp4, Dim.dp4, Dim.dp4);
|
||||
|
||||
// Center button vertically and stretch horizontally in container.
|
||||
FrameLayout.LayoutParams buttonParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT, dip32, Gravity.CENTER);
|
||||
FrameLayout.LayoutParams.MATCH_PARENT, Dim.dp32, Gravity.CENTER);
|
||||
speedButton.setLayoutParams(buttonParams);
|
||||
|
||||
// Add speed buttons view to buttons container layout.
|
||||
|
|
@ -475,21 +467,18 @@ public class CustomPlaybackSpeedPatch {
|
|||
*
|
||||
* @param context The Android context used to create the button.
|
||||
* @param isPlus True to display a plus symbol, false to display a minus symbol.
|
||||
* @param marginStart The start margin in pixels (left for LTR, right for RTL).
|
||||
* @param marginEnd The end margin in pixels (right for LTR, left for RTL).
|
||||
* @return A configured {@link Button} with the specified styling and layout parameters.
|
||||
*/
|
||||
private static Button createStyledButton(Context context, boolean isPlus, int marginStart, int marginEnd) {
|
||||
private static Button createStyledButton(Context context, boolean isPlus) {
|
||||
Button button = new Button(context, null, 0); // Disable default theme style.
|
||||
button.setText(""); // No text on button.
|
||||
ShapeDrawable background = new ShapeDrawable(new RoundRectShape(
|
||||
Utils.createCornerRadii(20), null, null));
|
||||
Dim.roundedCorners(20), null, null));
|
||||
background.getPaint().setColor(getAdjustedBackgroundColor(false));
|
||||
button.setBackground(background);
|
||||
button.setForeground(new OutlineSymbolDrawable(isPlus)); // Plus or minus symbol.
|
||||
final int dip36 = dipToPixels(36);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(dip36, dip36);
|
||||
params.setMargins(marginStart, 0, marginEnd, 0); // Set margins.
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(Dim.dp36, Dim.dp36);
|
||||
params.setMargins(Dim.dp8, 0, Dim.dp8, 0); // Set margins.
|
||||
button.setLayoutParams(params);
|
||||
return button;
|
||||
}
|
||||
|
|
@ -554,7 +543,7 @@ class OutlineSymbolDrawable extends Drawable {
|
|||
paint = new Paint(Paint.ANTI_ALIAS_FLAG); // Enable anti-aliasing for smooth rendering.
|
||||
paint.setColor(Utils.getAppForegroundColor());
|
||||
paint.setStyle(Paint.Style.STROKE); // Use stroke style for outline.
|
||||
paint.setStrokeWidth(dipToPixels(1)); // 1dp stroke width.
|
||||
paint.setStrokeWidth(Dim.dp1); // 1dp stroke width.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import java.util.concurrent.TimeoutException;
|
|||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.youtube.returnyoutubedislike.requests.RYDVoteData;
|
||||
import app.revanced.extension.youtube.returnyoutubedislike.requests.ReturnYouTubeDislikeApi;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
|
|
@ -124,12 +125,12 @@ public class ReturnYouTubeDislike {
|
|||
|
||||
static {
|
||||
leftSeparatorBounds = new Rect(0, 0,
|
||||
Utils.dipToPixels(1.2f),
|
||||
Utils.dipToPixels(14f));
|
||||
final int middleSeparatorSize = Utils.dipToPixels(3.7f);
|
||||
Dim.dp(1.2f),
|
||||
Dim.dp(14f));
|
||||
final int middleSeparatorSize = Dim.dp(3.7f);
|
||||
middleSeparatorBounds = new Rect(0, 0, middleSeparatorSize, middleSeparatorSize);
|
||||
|
||||
leftSeparatorShapePaddingPixels = Utils.dipToPixels(8.4f);
|
||||
leftSeparatorShapePaddingPixels = Dim.dp(8.4f);
|
||||
|
||||
leftSeparatorShape = new ShapeDrawable(new RectShape());
|
||||
leftSeparatorShape.setBounds(leftSeparatorBounds);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package app.revanced.extension.youtube.settings.preference;
|
|||
|
||||
import static app.revanced.extension.shared.StringRef.sf;
|
||||
import static app.revanced.extension.shared.StringRef.str;
|
||||
import static app.revanced.extension.shared.Utils.dipToPixels;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
|
@ -15,13 +14,9 @@ import android.os.Bundle;
|
|||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Pair;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
|
@ -37,6 +32,7 @@ import app.revanced.extension.shared.Logger;
|
|||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.settings.preference.CustomDialogListPreference;
|
||||
import app.revanced.extension.shared.ui.CustomDialog;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
|
||||
/**
|
||||
|
|
@ -264,42 +260,12 @@ public class ExternalDownloaderPreference extends CustomDialogListPreference {
|
|||
|
||||
// Add ListView to content layout with initial height.
|
||||
LinearLayout.LayoutParams listViewParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
0 // Initial height, will be updated.
|
||||
);
|
||||
listViewParams.bottomMargin = dipToPixels(16);
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.0f);
|
||||
listViewParams.bottomMargin = Dim.dp16;
|
||||
contentLayout.addView(listView, listViewParams);
|
||||
|
||||
// Add EditText for custom package name.
|
||||
editText = new EditText(context);
|
||||
editText.setText(packageName);
|
||||
editText.setSelection(packageName.length());
|
||||
editText.setHint(str("revanced_external_downloader_other_item_hint"));
|
||||
editText.setSingleLine(true); // Restrict EditText to a single line.
|
||||
editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
|
||||
// Set initial EditText state based on selected downloader.
|
||||
editText.setEnabled(usingCustomDownloader);
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable edit) {
|
||||
String updatedPackageName = edit.toString().trim();
|
||||
updateListViewSelection.apply(updatedPackageName);
|
||||
}
|
||||
});
|
||||
|
||||
ShapeDrawable editTextBackground = new ShapeDrawable(new RoundRectShape(
|
||||
Utils.createCornerRadii(10), null, null));
|
||||
editTextBackground.getPaint().setColor(Utils.getEditTextBackground());
|
||||
final int dip8 = dipToPixels(8);
|
||||
editText.setPadding(dip8, dip8, dip8, dip8);
|
||||
editText.setBackground(editTextBackground);
|
||||
editText.setClipToOutline(true);
|
||||
editText = createEditText(context, packageName, usingCustomDownloader, updateListViewSelection);
|
||||
contentLayout.addView(editText);
|
||||
|
||||
// Create the custom dialog.
|
||||
|
|
@ -350,50 +316,59 @@ public class ExternalDownloaderPreference extends CustomDialogListPreference {
|
|||
);
|
||||
|
||||
// Add the content layout directly to the dialog's main layout.
|
||||
LinearLayout dialogMainLayout = dialogPair.second;
|
||||
dialogMainLayout.addView(contentLayout, dialogMainLayout.getChildCount() - 1);
|
||||
LinearLayout mainLayout = dialogPair.second;
|
||||
LinearLayout.LayoutParams contentParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.0f);
|
||||
|
||||
// Update ListView height dynamically based on orientation.
|
||||
//noinspection ExtractMethodRecommender
|
||||
Runnable updateListViewHeight = () -> {
|
||||
int totalHeight = 0;
|
||||
ListAdapter listAdapter = listView.getAdapter();
|
||||
if (listAdapter != null) {
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
final int listAdapterCount = listAdapter.getCount();
|
||||
for (int i = 0; i < listAdapterCount; i++) {
|
||||
View item = listAdapter.getView(i, null, listView);
|
||||
item.measure(
|
||||
View.MeasureSpec.makeMeasureSpec(metrics.widthPixels, View.MeasureSpec.AT_MOST),
|
||||
View.MeasureSpec.UNSPECIFIED
|
||||
);
|
||||
totalHeight += item.getMeasuredHeight();
|
||||
}
|
||||
totalHeight += listView.getDividerHeight() * (listAdapterCount - 1);
|
||||
// Insert content before the dialog button row.
|
||||
mainLayout.addView(contentLayout, mainLayout.getChildCount() - 1, contentParams);
|
||||
|
||||
Dialog dialog = dialogPair.first;
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and configures the EditText for the custom package name.
|
||||
*
|
||||
* @param context Context for creating views.
|
||||
* @param initialPackageName The package name to pre-fill.
|
||||
* @param isCustom Whether the "Other" option is selected.
|
||||
* @param textChangeCallback Callback to run when text changes.
|
||||
* @return A configured EditText.
|
||||
*/
|
||||
private EditText createEditText(Context context,
|
||||
String initialPackageName, boolean isCustom,
|
||||
Function<String, Void> textChangeCallback) {
|
||||
EditText editText = new EditText(context);
|
||||
editText.setText(initialPackageName);
|
||||
editText.setSelection(initialPackageName.length());
|
||||
editText.setHint(str("revanced_external_downloader_other_item_hint"));
|
||||
editText.setSingleLine(true);
|
||||
editText.setTextSize(16);
|
||||
editText.setEnabled(isCustom);
|
||||
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable edit) {
|
||||
String updatedPackageName = edit.toString().trim();
|
||||
textChangeCallback.apply(updatedPackageName);
|
||||
}
|
||||
});
|
||||
|
||||
final int orientation = context.getResources().getConfiguration().orientation;
|
||||
if (orientation == android.content.res.Configuration.ORIENTATION_PORTRAIT) {
|
||||
// In portrait orientation, use WRAP_CONTENT for ListView height.
|
||||
listViewParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
} else {
|
||||
// In landscape orientation, limit ListView height to 30% of screen height.
|
||||
final int maxHeight = Utils.percentageHeightToPixels(30);
|
||||
listViewParams.height = Math.min(totalHeight, maxHeight);
|
||||
}
|
||||
listView.setLayoutParams(listViewParams);
|
||||
};
|
||||
ShapeDrawable editTextBackground = new ShapeDrawable(new RoundRectShape(
|
||||
Dim.roundedCorners(10), null, null));
|
||||
editTextBackground.getPaint().setColor(Utils.getEditTextBackground());
|
||||
editText.setPadding(Dim.dp8, Dim.dp8, Dim.dp8, Dim.dp8);
|
||||
editText.setBackground(editTextBackground);
|
||||
editText.setClipToOutline(true);
|
||||
|
||||
// Initial height calculation.
|
||||
updateListViewHeight.run();
|
||||
|
||||
// Listen for configuration changes (e.g., orientation).
|
||||
View dialogView = dialogPair.second;
|
||||
// Recalculate height when layout changes (e.g., orientation change).
|
||||
dialogView.getViewTreeObserver().addOnGlobalLayoutListener(updateListViewHeight::run);
|
||||
|
||||
// Show the dialog.
|
||||
dialogPair.first.show();
|
||||
return editText;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package app.revanced.extension.youtube.sponsorblock;
|
||||
|
||||
import static app.revanced.extension.shared.StringRef.str;
|
||||
import static app.revanced.extension.shared.Utils.dipToPixels;
|
||||
import static app.revanced.extension.youtube.sponsorblock.objects.CategoryBehaviour.SKIP_AUTOMATICALLY;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
|
@ -34,6 +33,7 @@ import java.util.Objects;
|
|||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.youtube.patches.VideoInformation;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
import app.revanced.extension.youtube.shared.PlayerType;
|
||||
|
|
@ -82,7 +82,7 @@ public class SegmentPlaybackController {
|
|||
* Highlight segments have zero length as they are a point in time.
|
||||
* Draw them on screen using a fixed width bar.
|
||||
*/
|
||||
private static final int HIGHLIGHT_SEGMENT_DRAW_BAR_WIDTH = dipToPixels(7);
|
||||
private static final int HIGHLIGHT_SEGMENT_DRAW_BAR_WIDTH = Dim.dp7;
|
||||
|
||||
@Nullable
|
||||
private static String currentVideoId;
|
||||
|
|
@ -808,14 +808,12 @@ public class SegmentPlaybackController {
|
|||
|
||||
LinearLayout mainLayout = new LinearLayout(currentContext);
|
||||
mainLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
final int dip8 = dipToPixels(8);
|
||||
final int dip16 = dipToPixels(16);
|
||||
mainLayout.setPadding(dip16, dip8, dip16, dip8);
|
||||
mainLayout.setPadding(Dim.dp16, Dim.dp8, Dim.dp16, Dim.dp8);
|
||||
mainLayout.setGravity(Gravity.CENTER);
|
||||
mainLayout.setMinimumHeight(dipToPixels(48));
|
||||
mainLayout.setMinimumHeight(Dim.dp48);
|
||||
|
||||
ShapeDrawable background = new ShapeDrawable(new RoundRectShape(
|
||||
Utils.createCornerRadii(20), null, null));
|
||||
Dim.roundedCorners(20), null, null));
|
||||
background.getPaint().setColor(Utils.getDialogBackgroundColor());
|
||||
mainLayout.setBackground(background);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package app.revanced.extension.youtube.sponsorblock.objects;
|
||||
|
||||
import static app.revanced.extension.shared.StringRef.str;
|
||||
import static app.revanced.extension.shared.Utils.dipToPixels;
|
||||
import static app.revanced.extension.youtube.sponsorblock.SponsorBlockSettings.migrateOldColorString;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
@ -17,6 +16,7 @@ import app.revanced.extension.shared.Logger;
|
|||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.settings.preference.ColorPickerPreference;
|
||||
import app.revanced.extension.shared.ui.ColorDot;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SegmentCategoryPreference extends ColorPickerPreference {
|
||||
|
|
@ -110,7 +110,7 @@ public class SegmentCategoryPreference extends ColorPickerPreference {
|
|||
}
|
||||
|
||||
radioGroup.setOnCheckedChangeListener((group, checkedId) -> selectedDialogEntryIndex = checkedId);
|
||||
radioGroup.setPadding(dipToPixels(10), 0, dipToPixels(10), dipToPixels(10));
|
||||
radioGroup.setPadding(Dim.dp10, 0, Dim.dp10, Dim.dp10);
|
||||
return radioGroup;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import android.widget.FrameLayout;
|
|||
import android.widget.ImageButton;
|
||||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.youtube.patches.VideoInformation;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
import app.revanced.extension.youtube.sponsorblock.SponsorBlockUtils;
|
||||
|
|
@ -132,9 +133,7 @@ public final class NewSegmentLayout extends FrameLayout {
|
|||
|
||||
GradientDrawable backgroundDrawable = new GradientDrawable();
|
||||
backgroundDrawable.setColor(getResourceColor("skip_ad_button_background_color"));
|
||||
final float cornerRadius = squareLayout
|
||||
? 0
|
||||
: 16 * getResources().getDisplayMetrics().density;
|
||||
final float cornerRadius = squareLayout ? 0f : Dim.dp16;
|
||||
backgroundDrawable.setCornerRadius(cornerRadius);
|
||||
setBackground(backgroundDrawable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import android.preference.SwitchPreference;
|
|||
import android.text.InputType;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Pair;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
|
|
@ -34,6 +33,7 @@ import app.revanced.extension.shared.settings.Setting;
|
|||
import app.revanced.extension.shared.settings.preference.CustomDialogListPreference;
|
||||
import app.revanced.extension.shared.settings.preference.ResettableEditTextPreference;
|
||||
import app.revanced.extension.shared.ui.CustomDialog;
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
import app.revanced.extension.youtube.sponsorblock.SegmentPlaybackController;
|
||||
import app.revanced.extension.youtube.sponsorblock.SponsorBlockSettings;
|
||||
|
|
@ -507,7 +507,7 @@ public class SponsorBlockPreferenceGroup extends PreferenceGroup {
|
|||
EditText editText = getEditText();
|
||||
|
||||
editText.setInputType(editText.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
editText.setTextSize(TypedValue.COMPLEX_UNIT_PT, 7); // Use a smaller font to reduce text wrap.
|
||||
editText.setTextSize(14);
|
||||
|
||||
// Create a custom dialog.
|
||||
Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create(
|
||||
|
|
@ -550,7 +550,7 @@ public class SponsorBlockPreferenceGroup extends PreferenceGroup {
|
|||
| InputType.TYPE_TEXT_FLAG_MULTI_LINE
|
||||
| InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
editText.setAutofillHints((String) null);
|
||||
editText.setTextSize(TypedValue.COMPLEX_UNIT_PT, 8);
|
||||
editText.setTextSize(14);
|
||||
|
||||
// Set preference listeners.
|
||||
importExport.setOnPreferenceClickListener(preference1 -> {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package app.revanced.extension.youtube.videoplayer;
|
||||
|
||||
import static app.revanced.extension.shared.StringRef.str;
|
||||
import static app.revanced.extension.shared.Utils.dipToPixels;
|
||||
import static app.revanced.extension.shared.settings.preference.CustomDialogListPreference.*;
|
||||
import static app.revanced.extension.youtube.patches.VideoInformation.AUTOMATIC_VIDEO_QUALITY_VALUE;
|
||||
import static app.revanced.extension.youtube.patches.VideoInformation.VIDEO_QUALITY_PREMIUM_NAME;
|
||||
|
|
@ -21,6 +20,7 @@ import android.widget.*;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.extension.shared.ui.Dim;
|
||||
import app.revanced.extension.shared.ui.SheetBottomDialog;
|
||||
import app.revanced.extension.youtube.shared.PlayerType;
|
||||
import com.google.android.libraries.youtube.innertube.model.media.VideoQuality;
|
||||
|
|
@ -214,11 +214,6 @@ public class VideoQualityDialogButton {
|
|||
}
|
||||
}
|
||||
|
||||
// Preset size constants.
|
||||
final int dip8 = dipToPixels(8);
|
||||
final int dip12 = dipToPixels(12);
|
||||
final int dip16 = dipToPixels(16);
|
||||
|
||||
// Create main layout.
|
||||
SheetBottomDialog.DraggableLinearLayout mainLayout =
|
||||
SheetBottomDialog.createMainLayout(context, getDialogBackgroundColor());
|
||||
|
|
@ -269,7 +264,7 @@ public class VideoQualityDialogButton {
|
|||
LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
titleParams.setMargins(dip12, dip16, 0, dip16);
|
||||
titleParams.setMargins(Dim.dp12, Dim.dp16, 0, Dim.dp16);
|
||||
titleView.setLayoutParams(titleParams);
|
||||
mainLayout.addView(titleView);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue