mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-07 10:40:11 -05:00
Do MessageTopView initialization in onFinishInflate()
This commit is contained in:
parent
160b9eb354
commit
cac1f1ca0d
@ -3,7 +3,6 @@ package com.fsck.k9.ui.messageview;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@ -31,7 +30,6 @@ public class MessageTopView extends LinearLayout implements ShowPicturesControll
|
||||
private MessageHeader mHeaderContainer;
|
||||
private LayoutInflater mInflater;
|
||||
private LinearLayout containerViews;
|
||||
private Fragment fragment;
|
||||
private Button mDownloadRemainder;
|
||||
private AttachmentViewCallback attachmentCallback;
|
||||
private OpenPgpHeaderViewCallback openPgpHeaderViewCallback;
|
||||
@ -43,15 +41,11 @@ public class MessageTopView extends LinearLayout implements ShowPicturesControll
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public void initialize (Fragment fragment, AttachmentViewCallback attachmentCallback,
|
||||
OpenPgpHeaderViewCallback openPgpHeaderViewCallback) {
|
||||
this.fragment = fragment;
|
||||
this.attachmentCallback = attachmentCallback;
|
||||
this.openPgpHeaderViewCallback = openPgpHeaderViewCallback;
|
||||
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
mHeaderContainer = (MessageHeader) findViewById(R.id.header_container);
|
||||
// mHeaderContainer.setOnLayoutChangedListener(this);
|
||||
mInflater = ((MessageViewFragment) fragment).getFragmentLayoutInflater();
|
||||
mInflater = LayoutInflater.from(getContext());
|
||||
|
||||
mDownloadRemainder = (Button) findViewById(R.id.download_remainder);
|
||||
mDownloadRemainder.setVisibility(View.GONE);
|
||||
@ -143,6 +137,14 @@ public class MessageTopView extends LinearLayout implements ShowPicturesControll
|
||||
mDownloadRemainder.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
public void setAttachmentCallback(AttachmentViewCallback callback) {
|
||||
attachmentCallback = callback;
|
||||
}
|
||||
|
||||
public void setOpenPgpHeaderViewCallback(OpenPgpHeaderViewCallback callback) {
|
||||
openPgpHeaderViewCallback = callback;
|
||||
}
|
||||
|
||||
public void enableDownloadButton() {
|
||||
mDownloadRemainder.setEnabled(true);
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
private LocalMessage mMessage;
|
||||
private MessageCryptoAnnotations messageAnnotations;
|
||||
private MessagingController mController;
|
||||
private LayoutInflater mLayoutInflater;
|
||||
private Handler handler = new Handler();
|
||||
private DownloadMessageListener downloadMessageListener = new DownloadMessageListener();
|
||||
private MessageCryptoHelper messageCryptoHelper;
|
||||
@ -142,13 +141,13 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
Bundle savedInstanceState) {
|
||||
Context context = new ContextThemeWrapper(inflater.getContext(),
|
||||
K9.getK9ThemeResourceId(K9.getK9MessageViewTheme()));
|
||||
mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
View view = mLayoutInflater.inflate(R.layout.message, container, false);
|
||||
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(context);
|
||||
View view = layoutInflater.inflate(R.layout.message, container, false);
|
||||
|
||||
mMessageView = (MessageTopView) view.findViewById(R.id.message_view);
|
||||
mMessageView.setAttachmentCallback(this);
|
||||
mMessageView.setOpenPgpHeaderViewCallback(this);
|
||||
|
||||
mMessageView.initialize(this, this, this);
|
||||
mMessageView.setOnToggleFlagClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -722,10 +721,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
||||
return mInitialized ;
|
||||
}
|
||||
|
||||
public LayoutInflater getFragmentLayoutInflater() {
|
||||
return mLayoutInflater;
|
||||
}
|
||||
|
||||
class LocalMessageLoaderCallback implements LoaderCallbacks<LocalMessage> {
|
||||
@Override
|
||||
public Loader<LocalMessage> onCreateLoader(int id, Bundle args) {
|
||||
|
Loading…
Reference in New Issue
Block a user