Loading res/layout-xlarge/alarm_clock.xml +1 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,7 @@ android:layout_height="match_parent" android:layout_width="wrap_content" android:gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="?android:attr/textColorPrimary" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/add_alarm" /> </LinearLayout> Loading res/layout/alarm_time.xml +2 −4 Original line number Diff line number Diff line Loading @@ -67,7 +67,6 @@ android:layout_height="wrap_content" android:paddingRight="6dip" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="?android:attr/textColorPrimary" useClockTypeface="false"/> <com.android.deskclock.AndroidClockTextView Loading @@ -75,9 +74,8 @@ android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceMedium" android:textStyle="bold" android:textColor="?android:attr/textColorPrimary" useClockTypeface="false"/> <TextView android:id="@+id/label" Loading @@ -86,7 +84,7 @@ android:layout_weight="1" android:paddingLeft="8dip" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorTertiary" android:textColor="?android:attr/textColorSecondary" android:textStyle="bold" android:gravity="right" android:singleLine="true"/> Loading src/com/android/deskclock/AndroidClockTextView.java +23 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ package com.android.deskclock; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.FontMetrics; import android.graphics.Rect; Loading @@ -39,12 +41,13 @@ public class AndroidClockTextView extends View { private static final String ATTR_SHORT_FORM = "shortForm"; private static final String ATTR_USE_CLOCK_TYPEFACE = "useClockTypeface"; private static Typeface sTypeface; private static Typeface sClockTypeface; private static Typeface sHighlightTypeface; private static Typeface sStandardTypeface; // An invisible text view that is used for parsing properties private TextView mProperties; private int mColor; private ColorStateList mColor; private Paint mTextPaint; private Paint mHighlightPaint; private String mText = ""; Loading Loading @@ -79,36 +82,32 @@ public class AndroidClockTextView extends View { } mTextSize = mProperties.getTextSize(); mColor = mProperties.getTextColors().getDefaultColor(); mColor = mProperties.getTextColors(); if (sTypeface == null) { sTypeface = Typeface.createFromFile(SYSTEM_FONT_TIME_BACKGROUND); if (sClockTypeface == null) { sClockTypeface = Typeface.createFromFile(SYSTEM_FONT_TIME_BACKGROUND); sHighlightTypeface = Typeface.createFromFile(SYSTEM_FONT_TIME_FOREGROUND); sStandardTypeface = Typeface.DEFAULT_BOLD; } mTextPaint = new Paint(); mTextPaint.setTypeface(mUseClockTypeface ? sTypeface : mProperties.getTypeface()); mTextPaint.setColor(mColor); mTextPaint.setTypeface(mUseClockTypeface ? sClockTypeface : sStandardTypeface); mTextPaint.setTextAlign(Paint.Align.LEFT); mTextPaint.setAntiAlias(true); mTextPaint.setTextSize(mTextSize); mTextPaint.setAlpha(mTextAlpha); mTextPaint.setFakeBoldText(!mUseClockTypeface); mHighlightPaint = new Paint(); mHighlightPaint.setTypeface(sHighlightTypeface); mHighlightPaint.setColor(mColor); mHighlightPaint.setTextAlign(Paint.Align.LEFT); mHighlightPaint.setAntiAlias(true); mHighlightPaint.setTextSize(mTextSize); mHighlightPaint.setAlpha(mHighlightsEnabled ? mHighlightAlpha : mTextAlpha); } public void setTextColor(int color) { mColor = color; mColor = ColorStateList.valueOf(color); mTextPaint.setColor(color); mHighlightPaint.setColor(color); refreshDrawableState(); } @Override Loading Loading @@ -162,6 +161,17 @@ public class AndroidClockTextView extends View { return mY; } @Override protected void drawableStateChanged() { int color = mColor.getColorForState(getDrawableState(), Color.RED); mTextPaint.setColor(color); mHighlightPaint.setColor(color); if (mUseClockTypeface) { mTextPaint.setAlpha(mTextAlpha); mHighlightPaint.setAlpha(mHighlightsEnabled ? mHighlightAlpha : mTextAlpha); } } @Override protected void onDraw(Canvas canvas) { if (mText != null) { Loading Loading
res/layout-xlarge/alarm_clock.xml +1 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,7 @@ android:layout_height="match_parent" android:layout_width="wrap_content" android:gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="?android:attr/textColorPrimary" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/add_alarm" /> </LinearLayout> Loading
res/layout/alarm_time.xml +2 −4 Original line number Diff line number Diff line Loading @@ -67,7 +67,6 @@ android:layout_height="wrap_content" android:paddingRight="6dip" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="?android:attr/textColorPrimary" useClockTypeface="false"/> <com.android.deskclock.AndroidClockTextView Loading @@ -75,9 +74,8 @@ android:layout_width="0dip" android:layout_weight="1" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceMedium" android:textStyle="bold" android:textColor="?android:attr/textColorPrimary" useClockTypeface="false"/> <TextView android:id="@+id/label" Loading @@ -86,7 +84,7 @@ android:layout_weight="1" android:paddingLeft="8dip" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorTertiary" android:textColor="?android:attr/textColorSecondary" android:textStyle="bold" android:gravity="right" android:singleLine="true"/> Loading
src/com/android/deskclock/AndroidClockTextView.java +23 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ package com.android.deskclock; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.FontMetrics; import android.graphics.Rect; Loading @@ -39,12 +41,13 @@ public class AndroidClockTextView extends View { private static final String ATTR_SHORT_FORM = "shortForm"; private static final String ATTR_USE_CLOCK_TYPEFACE = "useClockTypeface"; private static Typeface sTypeface; private static Typeface sClockTypeface; private static Typeface sHighlightTypeface; private static Typeface sStandardTypeface; // An invisible text view that is used for parsing properties private TextView mProperties; private int mColor; private ColorStateList mColor; private Paint mTextPaint; private Paint mHighlightPaint; private String mText = ""; Loading Loading @@ -79,36 +82,32 @@ public class AndroidClockTextView extends View { } mTextSize = mProperties.getTextSize(); mColor = mProperties.getTextColors().getDefaultColor(); mColor = mProperties.getTextColors(); if (sTypeface == null) { sTypeface = Typeface.createFromFile(SYSTEM_FONT_TIME_BACKGROUND); if (sClockTypeface == null) { sClockTypeface = Typeface.createFromFile(SYSTEM_FONT_TIME_BACKGROUND); sHighlightTypeface = Typeface.createFromFile(SYSTEM_FONT_TIME_FOREGROUND); sStandardTypeface = Typeface.DEFAULT_BOLD; } mTextPaint = new Paint(); mTextPaint.setTypeface(mUseClockTypeface ? sTypeface : mProperties.getTypeface()); mTextPaint.setColor(mColor); mTextPaint.setTypeface(mUseClockTypeface ? sClockTypeface : sStandardTypeface); mTextPaint.setTextAlign(Paint.Align.LEFT); mTextPaint.setAntiAlias(true); mTextPaint.setTextSize(mTextSize); mTextPaint.setAlpha(mTextAlpha); mTextPaint.setFakeBoldText(!mUseClockTypeface); mHighlightPaint = new Paint(); mHighlightPaint.setTypeface(sHighlightTypeface); mHighlightPaint.setColor(mColor); mHighlightPaint.setTextAlign(Paint.Align.LEFT); mHighlightPaint.setAntiAlias(true); mHighlightPaint.setTextSize(mTextSize); mHighlightPaint.setAlpha(mHighlightsEnabled ? mHighlightAlpha : mTextAlpha); } public void setTextColor(int color) { mColor = color; mColor = ColorStateList.valueOf(color); mTextPaint.setColor(color); mHighlightPaint.setColor(color); refreshDrawableState(); } @Override Loading Loading @@ -162,6 +161,17 @@ public class AndroidClockTextView extends View { return mY; } @Override protected void drawableStateChanged() { int color = mColor.getColorForState(getDrawableState(), Color.RED); mTextPaint.setColor(color); mHighlightPaint.setColor(color); if (mUseClockTypeface) { mTextPaint.setAlpha(mTextAlpha); mHighlightPaint.setAlpha(mHighlightsEnabled ? mHighlightAlpha : mTextAlpha); } } @Override protected void onDraw(Canvas canvas) { if (mText != null) { Loading