diff options
author | Mindy Pereira <mindyp@google.com> | 2010-11-24 14:04:04 -0800 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2010-11-24 15:28:07 -0800 |
commit | 35c8be065541fc818cc06567acd3c763b5f86056 (patch) | |
tree | 4e4aac66d6bf84d14b1a0020a20401b61c5194b0 /core/java/android | |
parent | e587d838e9c7163ffd0a36f242f73c11e991e924 (diff) | |
download | frameworks_base-35c8be065541fc818cc06567acd3c763b5f86056.zip frameworks_base-35c8be065541fc818cc06567acd3c763b5f86056.tar.gz frameworks_base-35c8be065541fc818cc06567acd3c763b5f86056.tar.bz2 |
Use getDimensionPixel size instead of casting to an int.
Change-Id: I907c8be25bd4cf0fefc2bb4e0282db2d136da099
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/preference/PreferenceFrameLayout.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/android/preference/PreferenceFrameLayout.java b/core/java/android/preference/PreferenceFrameLayout.java index 426abf0..481859e 100644 --- a/core/java/android/preference/PreferenceFrameLayout.java +++ b/core/java/android/preference/PreferenceFrameLayout.java @@ -45,12 +45,18 @@ public class PreferenceFrameLayout extends FrameLayout { TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.PreferenceFrameLayout, defStyle, 0); - mTopPadding = (int) a.getDimension( + float density = context.getResources().getDisplayMetrics().density; + int defaultTopPadding = (int) (density * DEFAULT_TOP_PADDING + 0.5f); + int defaultBottomPadding = (int) (density * DEFAULT_BOTTOM_PADDING + 0.5f); + + mTopPadding = a.getDimensionPixelSize( com.android.internal.R.styleable.PreferenceFrameLayout_topPadding, - DEFAULT_TOP_PADDING); - mBottomPadding = (int) a.getDimension( + defaultTopPadding); + mBottomPadding = a.getDimensionPixelSize( com.android.internal.R.styleable.PreferenceFrameLayout_bottomPadding, - DEFAULT_BOTTOM_PADDING); + defaultBottomPadding); + + a.recycle(); } |