Fix changing size of captions
This commit is contained in:
parent
70748fa0bc
commit
34e8dae03d
|
@ -25,9 +25,7 @@ import android.graphics.Color;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -44,6 +42,7 @@ import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.ui.SubtitleView;
|
||||||
import com.google.android.exoplayer2.video.VideoSize;
|
import com.google.android.exoplayer2.video.VideoSize;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -522,11 +521,8 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupSubtitleView(final float captionScale) {
|
protected void setupSubtitleView(final float captionScale) {
|
||||||
final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
binding.subtitleView.setFractionalTextSize(
|
||||||
final int minimumLength = Math.min(metrics.heightPixels, metrics.widthPixels);
|
SubtitleView.DEFAULT_TEXT_SIZE_FRACTION * captionScale);
|
||||||
final float captionRatioInverse = 20f + 4f * (1.0f - captionScale);
|
|
||||||
binding.subtitleView.setFixedTextSize(
|
|
||||||
TypedValue.COMPLEX_UNIT_PX, minimumLength / captionRatioInverse);
|
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue