mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Do MessageContainerView initialization in onFinishInflate()
This commit is contained in:
parent
f887348953
commit
160b9eb354
@ -67,34 +67,23 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
private Button mShowHiddenAttachments;
|
private Button mShowHiddenAttachments;
|
||||||
private LinearLayout mHiddenAttachments;
|
private LinearLayout mHiddenAttachments;
|
||||||
private boolean showingPictures;
|
private boolean showingPictures;
|
||||||
private boolean mHasAttachments;
|
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private AttachmentViewCallback attachmentCallback;
|
private AttachmentViewCallback attachmentCallback;
|
||||||
private OpenPgpHeaderViewCallback openPgpHeaderViewCallback;
|
|
||||||
private View mAttachmentsContainer;
|
private View mAttachmentsContainer;
|
||||||
private SavedState mSavedState;
|
private SavedState mSavedState;
|
||||||
private ClipboardManager mClipboardManager;
|
private ClipboardManager mClipboardManager;
|
||||||
private String mText;
|
private String mText;
|
||||||
private Map<AttachmentViewInfo, AttachmentView> attachments = new HashMap<AttachmentViewInfo, AttachmentView>();
|
private Map<AttachmentViewInfo, AttachmentView> attachments = new HashMap<AttachmentViewInfo, AttachmentView>();
|
||||||
private boolean displayPgpHeader;
|
|
||||||
private OpenPgpHeaderView openPgpHeaderView;
|
|
||||||
private ShowPicturesController showPicturesController;
|
|
||||||
|
|
||||||
|
|
||||||
public void initialize(ShowPicturesController showPicturesController, AttachmentViewCallback attachmentCallback,
|
@Override
|
||||||
OpenPgpHeaderViewCallback openPgpHeaderViewCallback, boolean displayPgpHeader) {
|
public void onFinishInflate() {
|
||||||
Context context = getContext();
|
|
||||||
|
|
||||||
this.showPicturesController = showPicturesController;
|
|
||||||
this.attachmentCallback = attachmentCallback;
|
|
||||||
this.openPgpHeaderViewCallback = openPgpHeaderViewCallback;
|
|
||||||
this.displayPgpHeader = displayPgpHeader;
|
|
||||||
|
|
||||||
mSidebar = findViewById(R.id.message_sidebar);
|
mSidebar = findViewById(R.id.message_sidebar);
|
||||||
|
|
||||||
mMessageContentView = (MessageWebView) findViewById(R.id.message_content);
|
mMessageContentView = (MessageWebView) findViewById(R.id.message_content);
|
||||||
mMessageContentView.configure();
|
mMessageContentView.configure();
|
||||||
mMessageContentView.setOnCreateContextMenuListener(this);
|
mMessageContentView.setOnCreateContextMenuListener(this);
|
||||||
|
mMessageContentView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
mAttachmentsContainer = findViewById(R.id.attachments_container);
|
mAttachmentsContainer = findViewById(R.id.attachments_container);
|
||||||
mAttachments = (LinearLayout) findViewById(R.id.attachments);
|
mAttachments = (LinearLayout) findViewById(R.id.attachments);
|
||||||
@ -102,19 +91,12 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
mHiddenAttachments.setVisibility(View.GONE);
|
mHiddenAttachments.setVisibility(View.GONE);
|
||||||
mShowHiddenAttachments = (Button) findViewById(R.id.show_hidden_attachments);
|
mShowHiddenAttachments = (Button) findViewById(R.id.show_hidden_attachments);
|
||||||
mShowHiddenAttachments.setVisibility(View.GONE);
|
mShowHiddenAttachments.setVisibility(View.GONE);
|
||||||
|
mShowHiddenAttachments.setOnClickListener(this);
|
||||||
|
|
||||||
showingPictures = false;
|
showingPictures = false;
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
mInflater = LayoutInflater.from(context);
|
mInflater = LayoutInflater.from(context);
|
||||||
mMessageContentView.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
if (displayPgpHeader) {
|
|
||||||
ViewStub openPgpHeaderStub = (ViewStub) findViewById(R.id.openpgp_header_stub);
|
|
||||||
openPgpHeaderView = (OpenPgpHeaderView) openPgpHeaderStub.inflate();
|
|
||||||
}
|
|
||||||
|
|
||||||
mShowHiddenAttachments.setOnClickListener(this);
|
|
||||||
|
|
||||||
mClipboardManager = ClipboardManager.getInstance(context);
|
mClipboardManager = ClipboardManager.getInstance(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,8 +362,13 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageViewContainer(MessageViewContainer messageViewContainer, boolean automaticallyLoadPictures)
|
public void displayMessageViewContainer(MessageViewContainer messageViewContainer,
|
||||||
throws MessagingException {
|
boolean automaticallyLoadPictures, ShowPicturesController showPicturesController,
|
||||||
|
AttachmentViewCallback attachmentCallback, OpenPgpHeaderViewCallback openPgpHeaderViewCallback,
|
||||||
|
boolean displayPgpHeader) throws MessagingException {
|
||||||
|
|
||||||
|
this.attachmentCallback = attachmentCallback;
|
||||||
|
|
||||||
resetView();
|
resetView();
|
||||||
|
|
||||||
WebViewClient webViewClient = K9WebViewClient.newInstance(messageViewContainer.rootPart);
|
WebViewClient webViewClient = K9WebViewClient.newInstance(messageViewContainer.rootPart);
|
||||||
@ -396,8 +383,8 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
mText = messageViewContainer.text;
|
mText = messageViewContainer.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
mHasAttachments = !messageViewContainer.attachments.isEmpty();
|
boolean hasAttachments = !messageViewContainer.attachments.isEmpty();
|
||||||
if (mHasAttachments) {
|
if (hasAttachments) {
|
||||||
renderAttachments(messageViewContainer);
|
renderAttachments(messageViewContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,6 +415,9 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (displayPgpHeader) {
|
if (displayPgpHeader) {
|
||||||
|
ViewStub openPgpHeaderStub = (ViewStub) findViewById(R.id.openpgp_header_stub);
|
||||||
|
OpenPgpHeaderView openPgpHeaderView = (OpenPgpHeaderView) openPgpHeaderStub.inflate();
|
||||||
|
|
||||||
openPgpHeaderView.setOpenPgpData(messageViewContainer.signatureResult, messageViewContainer.encrypted,
|
openPgpHeaderView.setOpenPgpData(messageViewContainer.signatureResult, messageViewContainer.encrypted,
|
||||||
messageViewContainer.pgpPendingIntent);
|
messageViewContainer.pgpPendingIntent);
|
||||||
openPgpHeaderView.setCallback(openPgpHeaderViewCallback);
|
openPgpHeaderView.setCallback(openPgpHeaderViewCallback);
|
||||||
|
@ -95,8 +95,8 @@ public class MessageTopView extends LinearLayout implements ShowPicturesControll
|
|||||||
for (MessageViewContainer container : messageViewInfo.containers) {
|
for (MessageViewContainer container : messageViewInfo.containers) {
|
||||||
MessageContainerView view = (MessageContainerView) mInflater.inflate(R.layout.message_container, null);
|
MessageContainerView view = (MessageContainerView) mInflater.inflate(R.layout.message_container, null);
|
||||||
boolean displayPgpHeader = !Account.NO_OPENPGP_PROVIDER.equals(account.getOpenPgpProvider());
|
boolean displayPgpHeader = !Account.NO_OPENPGP_PROVIDER.equals(account.getOpenPgpProvider());
|
||||||
view.initialize(this, attachmentCallback, openPgpHeaderViewCallback, displayPgpHeader);
|
view.displayMessageViewContainer(container, automaticallyLoadPictures, this, attachmentCallback,
|
||||||
view.setMessageViewContainer(container, automaticallyLoadPictures);
|
openPgpHeaderViewCallback, displayPgpHeader);
|
||||||
|
|
||||||
containerViews.addView(view);
|
containerViews.addView(view);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user