summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2009-07-30 16:14:34 -0700
committerAmith Yamasani <yamasani@google.com>2009-07-30 16:14:34 -0700
commita2ef00b4282dcf122c3bdd6fc23cf772474f6abb (patch)
tree308162c876f982dec24acbe37847fcbf8c99d9d9
parentbad80e0dccdeaeea97991f7d092678ff0df1bc84 (diff)
downloadframeworks_base-a2ef00b4282dcf122c3bdd6fc23cf772474f6abb.zip
frameworks_base-a2ef00b4282dcf122c3bdd6fc23cf772474f6abb.tar.gz
frameworks_base-a2ef00b4282dcf122c3bdd6fc23cf772474f6abb.tar.bz2
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.
-rw-r--r--core/java/android/view/View.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7ed2712..829f68e 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);
/*