summaryrefslogtreecommitdiff
path: root/src/com/android/dialer/list
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-04-16 12:06:28 -0700
committerYorke Lee <yorkelee@google.com>2014-04-16 12:06:57 -0700
commit7e5e5a6dc52a7d4caaea795ae9173559c4e0f2ca (patch)
tree389c5824b7194bac79ed20c968d3cdc2355ea5f7 /src/com/android/dialer/list
parenta63d4469cdb92e717599d13830c9f43584fb66ef (diff)
Apply new ViewPager tab styles to ViewPagerTabs class
Also correctly detect and set the textStyle and textSize on the children TextViews Bug: 14012803 Change-Id: I4e0f6ed8354befb7c738707131124d5c442e713f
Diffstat (limited to 'src/com/android/dialer/list')
-rw-r--r--src/com/android/dialer/list/ViewPagerTabs.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/dialer/list/ViewPagerTabs.java b/src/com/android/dialer/list/ViewPagerTabs.java
index 45f468ddd..030ddcb53 100644
--- a/src/com/android/dialer/list/ViewPagerTabs.java
+++ b/src/com/android/dialer/list/ViewPagerTabs.java
@@ -6,6 +6,7 @@ import android.content.res.TypedArray;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
+import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
@@ -30,6 +31,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
* of the parent HorizontalScrollView.
*/
LinearLayout mChild;
+ final int mTextStyle;
final ColorStateList mTextColor;
final int mTextSize;
final boolean mTextAllCaps;
@@ -39,7 +41,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
private static final int TAB_SIDE_PADDING_IN_DPS = 10;
private static final int[] ATTRS = new int[] {
- android.R.attr.textAppearance,
+ android.R.attr.textStyle,
android.R.attr.textSize,
android.R.attr.textColor,
android.R.attr.textAllCaps
@@ -92,6 +94,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
mSidePadding = (int) (getResources().getDisplayMetrics().density * TAB_SIDE_PADDING_IN_DPS);
final TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
+ mTextStyle = a.getInt(0, 0);
mTextSize = a.getDimensionPixelSize(1, 0);
mTextColor = a.getColorStateList(2);
mTextAllCaps = a.getBoolean(3, false);
@@ -129,8 +132,11 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
textView.setOnLongClickListener(new OnTabLongClickListener(position));
// Assign various text appearance related attributes to child views.
+ if (mTextStyle > 0) {
+ textView.setTypeface(textView.getTypeface(), mTextStyle);
+ }
if (mTextSize > 0) {
- textView.setTextSize(mTextSize);
+ textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
}
if (mTextColor != null) {
textView.setTextColor(mTextColor);