diff options
author | Yorke Lee <yorkelee@google.com> | 2014-04-16 22:03:14 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-04-16 22:03:14 +0000 |
commit | 9d0bcf58310692e6cd873a1b4c103bb474e59d6f (patch) | |
tree | 1f65efe748153a4a4e55e215d6d64d73df29fcd5 /src | |
parent | 98a65b74af3f960ed4d20688292522c6cfbc8a00 (diff) | |
parent | 7e5e5a6dc52a7d4caaea795ae9173559c4e0f2ca (diff) |
am 7e5e5a6d: Apply new ViewPager tab styles to ViewPagerTabs class
* commit '7e5e5a6dc52a7d4caaea795ae9173559c4e0f2ca':
Apply new ViewPager tab styles to ViewPagerTabs class
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/list/ViewPagerTabs.java | 10 |
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); |