File tree 3 files changed +8
-9
lines changed
app/src/main/java/org/schabi/newpipe/player/ui
3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 25
25
import android .os .Handler ;
26
26
import android .os .Looper ;
27
27
import android .provider .Settings ;
28
- import android .util .DisplayMetrics ;
29
28
import android .util .Log ;
30
- import android .util .TypedValue ;
31
29
import android .view .KeyEvent ;
32
30
import android .view .View ;
33
31
import android .view .ViewGroup ;
44
42
import androidx .recyclerview .widget .ItemTouchHelper ;
45
43
import androidx .recyclerview .widget .RecyclerView ;
46
44
45
+ import com .google .android .exoplayer2 .ui .SubtitleView ;
47
46
import com .google .android .exoplayer2 .video .VideoSize ;
48
47
49
48
import org .schabi .newpipe .R ;
@@ -522,11 +521,8 @@ private void showHideKodiButton() {
522
521
523
522
@ Override
524
523
protected void setupSubtitleView (final float captionScale ) {
525
- final DisplayMetrics metrics = context .getResources ().getDisplayMetrics ();
526
- final int minimumLength = Math .min (metrics .heightPixels , metrics .widthPixels );
527
- final float captionRatioInverse = 20f + 4f * (1.0f - captionScale );
528
- binding .subtitleView .setFixedTextSize (
529
- TypedValue .COMPLEX_UNIT_PX , minimumLength / captionRatioInverse );
524
+ binding .subtitleView .setFractionalTextSize (
525
+ SubtitleView .DEFAULT_TEXT_SIZE_FRACTION * captionScale );
530
526
}
531
527
//endregion
532
528
Original file line number Diff line number Diff line change @@ -424,9 +424,8 @@ public void onCompleted() {
424
424
425
425
@ Override
426
426
protected void setupSubtitleView (final float captionScale ) {
427
- final float captionRatio = (captionScale - 1.0f ) / 5.0f + 1.0f ;
428
427
binding .subtitleView .setFractionalTextSize (
429
- SubtitleView .DEFAULT_TEXT_SIZE_FRACTION * captionRatio );
428
+ SubtitleView .DEFAULT_TEXT_SIZE_FRACTION * captionScale );
430
429
}
431
430
432
431
@ Override
Original file line number Diff line number Diff line change @@ -1414,6 +1414,10 @@ private void setupSubtitleView() {
1414
1414
binding .subtitleView .setStyle (captionStyle );
1415
1415
}
1416
1416
1417
+ /**
1418
+ *
1419
+ * @param captionScale Value returned by {@link PlayerHelper#getCaptionScale}.
1420
+ */
1417
1421
protected abstract void setupSubtitleView (float captionScale );
1418
1422
//endregion
1419
1423
You can’t perform that action at this time.
0 commit comments