Merge "Treat caption preview viewport as clipped 16:9 aspect" into lmp-dev

This commit is contained in:
Alan Viverette
2014-07-22 00:10:17 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 2 deletions

View File

@@ -23,7 +23,9 @@
<FrameLayout
android:id="@+id/preview_viewport"
android:layout_width="match_parent"
android:layout_height="@dimen/captioning_preview_height" >
android:layout_height="@dimen/captioning_preview_height"
android:paddingStart="@dimen/settings_side_margin"
android:paddingEnd="@dimen/settings_side_margin" >
<ImageView
android:layout_width="match_parent"

View File

@@ -206,7 +206,10 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
final ContentResolver cr = context.getContentResolver();
final float fontScale = manager.getFontScale();
if (previewWindow != null) {
previewText.setTextSize(previewWindow.getHeight() * LINE_HEIGHT_RATIO * fontScale);
// Assume the viewport is clipped with a 16:9 aspect ratio.
final float virtualHeight = Math.max(9 * previewWindow.getWidth(),
16 * previewWindow.getHeight()) / 16.0f;
previewText.setTextSize(virtualHeight * LINE_HEIGHT_RATIO * fontScale);
} else {
final float textSize = context.getResources().getDimension(
R.dimen.caption_preview_text_size);