1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Reduce exposure of SingleMessageView internals

This commit is contained in:
cketti 2015-01-16 20:19:21 +01:00
parent 658657447e
commit 1e628e7177
2 changed files with 23 additions and 17 deletions

View File

@ -48,7 +48,7 @@ import com.fsck.k9.view.MessageHeader;
import org.openintents.openpgp.OpenPgpSignatureResult;
public class MessageViewFragment extends Fragment implements OnClickListener, ConfirmationDialogFragmentListener,
public class MessageViewFragment extends Fragment implements ConfirmationDialogFragmentListener,
AttachmentViewCallback {
private static final String ARG_REFERENCE = "reference";
@ -144,13 +144,19 @@ public class MessageViewFragment extends Fragment implements OnClickListener, Co
mMessageView.setAttachmentCallback(this);
mMessageView.initialize(this, new OnClickListener() {
mMessageView.initialize(this);
mMessageView.setOnToggleFlagClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onToggleFlagged();
}
});
mMessageView.downloadRemainderButton().setOnClickListener(this);
mMessageView.setOnDownloadButtonClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onDownloadRemainder();
}
});
mFragmentListener.messageHeaderViewAvailable(mMessageView.getMessageHeaderView());
@ -455,18 +461,11 @@ public class MessageViewFragment extends Fragment implements OnClickListener, Co
if (mMessage.isSet(Flag.X_DOWNLOADED_FULL)) {
return;
}
mMessageView.downloadRemainderButton().setEnabled(false);
mMessageView.disableDownloadButton();
//FIXME
// mController.loadMessageForViewRemote(mAccount, mMessageReference.folderName, mMessageReference.uid, mListener);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.download_remainder) {
onDownloadRemainder();
}
}
private void setProgress(boolean enable) {
if (mFragmentListener != null) {
mFragmentListener.setProgress(enable);

View File

@ -110,7 +110,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
private Map<AttachmentViewInfo, AttachmentView> attachments = new HashMap<AttachmentViewInfo, AttachmentView>();
public void initialize(Fragment fragment, OnClickListener flagListener) {
public void initialize(Fragment fragment) {
Activity activity = fragment.getActivity();
mMessageContentView = (MessageWebView) findViewById(R.id.message_content);
mMessageContentView.configure();
@ -119,7 +119,6 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
mHeaderContainer = (MessageHeader) findViewById(R.id.header_container);
mHeaderContainer.setOnLayoutChangedListener(this);
mHeaderContainer.setOnFlagListener(flagListener);
mAttachmentsContainer = findViewById(R.id.attachments_container);
mAttachments = (LinearLayout) findViewById(R.id.attachments);
@ -446,10 +445,6 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
showShowPicturesAction(false);
}
public Button downloadRemainderButton() {
return mDownloadRemainder;
}
public void showShowPicturesAction(boolean show) {
mShowPicturesAction.setVisibility(show ? View.VISIBLE : View.GONE);
}
@ -480,6 +475,18 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
}
}
public void setOnToggleFlagClickListener(OnClickListener listener) {
mHeaderContainer.setOnFlagListener(listener);
}
public void setOnDownloadButtonClickListener(OnClickListener listener) {
mDownloadRemainder.setOnClickListener(listener);
}
public void disableDownloadButton() {
mDownloadRemainder.setEnabled(false);
}
public void setShowDownloadButton(Message message) {
if (message.isSet(Flag.X_DOWNLOADED_FULL)) {
mDownloadRemainder.setVisibility(View.GONE);