From a4510696aa4ebb160053e6c616808d89f8d41000 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 4 Jan 2010 02:11:33 +0000 Subject: [PATCH] It turns out that blindly enabling/disabling views is _Very_ expensive. Now we only do it when switching messageview entries if it's actually necessary --- src/com/fsck/k9/activity/MessageView.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index c5ae5e3f1..71dbe1322 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -623,13 +623,19 @@ public class MessageView extends K9Activity mAttachments.removeAllViews(); findSurroundingMessagesUid(); - next.setEnabled(mNextMessageUid != null); - previous.setEnabled(mPreviousMessageUid != null); - if (next_scrolling != null) - next_scrolling.setEnabled(mNextMessageUid != null); - if (previous_scrolling != null) - previous_scrolling.setEnabled(mPreviousMessageUid != null); + boolean enableNext = (mNextMessageUid != null); + boolean enablePrev = (mPreviousMessageUid != null); + + if (next.isEnabled() != enableNext) + next.setEnabled(enableNext); + if (previous.isEnabled() != enablePrev) + previous.setEnabled(enablePrev); + + if (next_scrolling != null && (next_scrolling.isEnabled() != enableNext)) + next_scrolling.setEnabled(enableNext); + if (previous_scrolling != null && (previous_scrolling.isEnabled() != enablePrev)) + previous_scrolling.setEnabled(enablePrev); MessagingController.getInstance(getApplication()).loadMessageForView( mAccount,