1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-12 22:28:10 -05:00

extract out "setup message buttons on message display.

This commit is contained in:
Jesse Vincent 2010-07-11 15:39:41 +00:00
parent 20e47991c3
commit 5d514c2ace

View File

@ -106,6 +106,8 @@ public class MessageView extends K9Activity implements OnClickListener
View next_scrolling; View next_scrolling;
View previous; View previous;
View previous_scrolling; View previous_scrolling;
private view mDelete;
private View mArchive; private View mArchive;
private View mMove; private View mMove;
private View mSpam; private View mSpam;
@ -836,6 +838,8 @@ public class MessageView extends K9Activity implements OnClickListener
next_scrolling = findViewById(R.id.next_scrolling); next_scrolling = findViewById(R.id.next_scrolling);
previous_scrolling = findViewById(R.id.previous_scrolling); previous_scrolling = findViewById(R.id.previous_scrolling);
mDelete = findViewById(R.id.delete);
mArchive = findViewById(R.id.archive); mArchive = findViewById(R.id.archive);
mMove = findViewById(R.id.move); mMove = findViewById(R.id.move);
mSpam = findViewById(R.id.spam); mSpam = findViewById(R.id.spam);
@ -936,9 +940,27 @@ public class MessageView extends K9Activity implements OnClickListener
mAttachments.removeAllViews(); mAttachments.removeAllViews();
findSurroundingMessagesUid(); findSurroundingMessagesUid();
setupDisplayMessageButtons();
MessagingController.getInstance(getApplication()).loadMessageForView(
mAccount,
mMessageReference.folderName,
mMessageReference.uid,
mListener);
mTopView.scrollTo(0, 0);
mMessageContentView.scrollTo(0, 0);
}
private void setupDisplayMessageButtons()
{
boolean enableNext = (mNextMessage != null); boolean enableNext = (mNextMessage != null);
boolean enablePrev = (mPreviousMessage != null); boolean enablePrev = (mPreviousMessage != null);
mDelete.setEnabled(true);
if (next.isEnabled() != enableNext) if (next.isEnabled() != enableNext)
next.setEnabled(enableNext); next.setEnabled(enableNext);
if (previous.isEnabled() != enablePrev) if (previous.isEnabled() != enablePrev)
@ -952,7 +974,7 @@ public class MessageView extends K9Activity implements OnClickListener
// If moving isn't support at all, then all of them must be disabled anyway. // If moving isn't support at all, then all of them must be disabled anyway.
if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false) if (MessagingController.getInstance(getApplication()).isMoveCapable(mAccount) == false)
{ {
disableButtons(); disableMoveButtons();
} }
else else
{ {
@ -971,17 +993,8 @@ public class MessageView extends K9Activity implements OnClickListener
mSpamScrolling.setEnabled(enableSpam); mSpamScrolling.setEnabled(enableSpam);
} }
MessagingController.getInstance(getApplication()).loadMessageForView(
mAccount,
mMessageReference.folderName,
mMessageReference.uid,
mListener);
mTopView.scrollTo(0, 0);
mMessageContentView.scrollTo(0, 0);
} }
private void showButtons() private void showButtons()
{ {
View buttons = findViewById(R.id.scrolling_buttons); View buttons = findViewById(R.id.scrolling_buttons);
@ -1018,8 +1031,17 @@ public class MessageView extends K9Activity implements OnClickListener
} }
} }
private void disableButtons() private void disableButtons()
{
disableMoveButtons();
next.setEnabled(false);
next_scrolling.setEnabled(false);
previous.setEnabled(false);
previous_scrolling.setEnabled(false);
mDelete.setEnabled(false);
}
private void disableMoveButtons()
{ {
mArchive.setEnabled(false); mArchive.setEnabled(false);
mMove.setEnabled(false); mMove.setEnabled(false);
@ -1029,6 +1051,7 @@ public class MessageView extends K9Activity implements OnClickListener
mSpamScrolling.setEnabled(false); mSpamScrolling.setEnabled(false);
} }
private void setOnClickListener(int viewCode) private void setOnClickListener(int viewCode)
{ {
View thisView = findViewById(viewCode); View thisView = findViewById(viewCode);