From 34e8dae03daa2e885de9cd5ae563b49944693341 Mon Sep 17 00:00:00 2001 From: Thompson3142 Date: Fri, 20 Dec 2024 13:03:50 +0100 Subject: [PATCH] Fix changing size of captions --- .../org/schabi/newpipe/player/ui/MainPlayerUi.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java index 03f90a3446d..d8efb30df7d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java @@ -25,9 +25,7 @@ import android.os.Handler; import android.os.Looper; import android.provider.Settings; -import android.util.DisplayMetrics; import android.util.Log; -import android.util.TypedValue; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; @@ -44,6 +42,7 @@ import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.exoplayer2.ui.SubtitleView; import com.google.android.exoplayer2.video.VideoSize; import org.schabi.newpipe.R; @@ -522,11 +521,8 @@ private void showHideKodiButton() { @Override protected void setupSubtitleView(final float captionScale) { - final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); - final int minimumLength = Math.min(metrics.heightPixels, metrics.widthPixels); - final float captionRatioInverse = 20f + 4f * (1.0f - captionScale); - binding.subtitleView.setFixedTextSize( - TypedValue.COMPLEX_UNIT_PX, minimumLength / captionRatioInverse); + binding.subtitleView.setFractionalTextSize( + SubtitleView.DEFAULT_TEXT_SIZE_FRACTION * captionScale); } //endregion