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.
This commit is contained in:
Amith Yamasani
2009-07-30 16:14:34 -07:00
parent bad80e0dcc
commit a2ef00b428

View File

@@ -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);
/*