From a2ef00b4282dcf122c3bdd6fc23cf772474f6abb Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Thu, 30 Jul 2009 16:14:34 -0700 Subject: Don't invalidate view if setEnabled doesn't change the state. Check the current enabled state before setting it, in case there's no change. Otherwise some apps are repeatedly redrawing buttons based on validation of some text field (like gmail or mms message bodies). Should slightly improve the performance of soft keyboard text entry. --- core/java/android/view/View.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 7ed2712dc750..829f68ee10ff 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2983,6 +2983,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * @param enabled True if this view is enabled, false otherwise. */ public void setEnabled(boolean enabled) { + if (enabled == isEnabled()) return; + setFlags(enabled ? ENABLED : DISABLED, ENABLED_MASK); /* -- cgit v1.2.3-59-g8ed1b