Set caption preview font size in dips

Change-Id: I9844b6f927b557b46f23c6211b5be47647002ab8
This commit is contained in:
Alan Viverette
2014-02-17 13:34:37 -08:00
parent b05f1d0081
commit bc02ced9fb
2 changed files with 7 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ public class EdgeTypePreference extends ListDialogPreference {
private static final int DEFAULT_FOREGROUND_COLOR = Color.WHITE;
private static final int DEFAULT_BACKGROUND_COLOR = Color.TRANSPARENT;
private static final int DEFAULT_EDGE_COLOR = Color.BLACK;
private static final float DEFAULT_FONT_SIZE = 96f;
private static final float DEFAULT_FONT_SIZE = 32f;
public EdgeTypePreference(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -57,7 +57,9 @@ public class EdgeTypePreference extends ListDialogPreference {
preview.setForegroundColor(DEFAULT_FOREGROUND_COLOR);
preview.setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
preview.setTextSize(DEFAULT_FONT_SIZE);
final float density = getContext().getResources().getDisplayMetrics().density;
preview.setTextSize(DEFAULT_FONT_SIZE * density);
final int value = getValueAt(index);
preview.setEdgeType(value);

View File

@@ -27,7 +27,7 @@ import com.android.internal.widget.SubtitleView;
import com.android.settings.R;
public class PresetPreference extends ListDialogPreference {
private static final float DEFAULT_FONT_SIZE = 96f;
private static final float DEFAULT_FONT_SIZE = 32f;
private final CaptioningManager mCaptioningManager;
@@ -54,7 +54,8 @@ public class PresetPreference extends ListDialogPreference {
CaptionPropertiesFragment.applyCaptionProperties(
mCaptioningManager, previewText, value);
previewText.setTextSize(DEFAULT_FONT_SIZE);
final float density = getContext().getResources().getDisplayMetrics().density;
previewText.setTextSize(DEFAULT_FONT_SIZE * density);
final CharSequence title = getTitleAt(index);
if (title != null) {