diff options
| author | 2011-08-02 17:03:22 -0700 | |
|---|---|---|
| committer | 2011-08-02 17:03:22 -0700 | |
| commit | 04ee7956ea5009098f9a4c02436b91c18c60d225 (patch) | |
| tree | 648c8cf5b513c396ed3b062b71607c42007503db | |
| parent | 5857bceaeae70aa93f2a428a6d1c6ec8851c1b9b (diff) | |
| parent | 6805545649f2b194859033df94602492b9ec086e (diff) | |
Merge "Add the ability to enable/disable marquee fading per device"
| -rw-r--r-- | core/java/android/view/ViewConfiguration.java | 13 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 6 | ||||
| -rwxr-xr-x | core/res/res/values/config.xml | 3 |
3 files changed, 20 insertions, 2 deletions
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index dbcbd6e5ae1f..95209581f7c5 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -220,6 +220,7 @@ public class ViewConfiguration { private final int mMaximumDrawingCacheSize; private final int mOverscrollDistance; private final int mOverflingDistance; + private final boolean mFadingMarqueeEnabled; private boolean sHasPermanentMenuKey; private boolean sHasPermanentMenuKeySet; @@ -246,6 +247,7 @@ public class ViewConfiguration { mMaximumDrawingCacheSize = MAXIMUM_DRAWING_CACHE_SIZE; mOverscrollDistance = OVERSCROLL_DISTANCE; mOverflingDistance = OVERFLING_DISTANCE; + mFadingMarqueeEnabled = true; } /** @@ -297,6 +299,9 @@ public class ViewConfiguration { sHasPermanentMenuKey = false; } } + + mFadingMarqueeEnabled = res.getBoolean( + com.android.internal.R.bool.config_ui_enableFadingMarquee); } /** @@ -673,4 +678,12 @@ public class ViewConfiguration { public boolean hasPermanentMenuKey() { return sHasPermanentMenuKey; } + + /** + * @hide + * @return Whether or not marquee should use fading edges. + */ + public boolean isFadingMarqueeEnabled() { + return mFadingMarqueeEnabled; + } } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index ab66676e3ddd..65ee74581a79 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -999,7 +999,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener setEllipsize(TextUtils.TruncateAt.END); break; case 4: - setHorizontalFadingEdgeEnabled(true); + setHorizontalFadingEdgeEnabled( + ViewConfiguration.get(context).isFadingMarqueeEnabled()); setEllipsize(TextUtils.TruncateAt.MARQUEE); break; } @@ -3067,7 +3068,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (text instanceof Spanned && ((Spanned) text).getSpanStart(TextUtils.TruncateAt.MARQUEE) >= 0) { - setHorizontalFadingEdgeEnabled(true); + setHorizontalFadingEdgeEnabled( + ViewConfiguration.get(mContext).isFadingMarqueeEnabled()); setEllipsize(TextUtils.TruncateAt.MARQUEE); } diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 65dce4977eeb..73443a026603 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -84,6 +84,9 @@ specified for -large and -xlarge configurations. --> <dimen name="config_prefDialogWidth">320dp</dimen> + <!-- Enables or disables fading edges when marquee is enabled in TextView. --> + <bool name="config_ui_enableFadingMarquee">true</bool> + <!-- Whether dialogs should close automatically when the user touches outside of them. This should not normally be modified. --> <bool name="config_closeDialogWhenTouchOutside">false</bool> |