mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Restructure MessageHeader to avoid NPE when used by MessageTitleView
This commit is contained in:
parent
08198d8767
commit
ac9259a0e3
@ -86,9 +86,10 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
mContacts = Contacts.getInstance(mContext);
|
mContacts = Contacts.getInstance(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLayout() {
|
@Override
|
||||||
|
protected void onFinishInflate() {
|
||||||
mAnsweredIcon = findViewById(R.id.answered);
|
mAnsweredIcon = findViewById(R.id.answered);
|
||||||
mForwardedIcon= findViewById(R.id.forwarded);
|
mForwardedIcon = findViewById(R.id.forwarded);
|
||||||
mFromView = (TextView) findViewById(R.id.from);
|
mFromView = (TextView) findViewById(R.id.from);
|
||||||
mToView = (TextView) findViewById(R.id.to);
|
mToView = (TextView) findViewById(R.id.to);
|
||||||
mCcView = (TextView) findViewById(R.id.cc);
|
mCcView = (TextView) findViewById(R.id.cc);
|
||||||
@ -105,10 +106,6 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTime());
|
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTime());
|
||||||
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewDate());
|
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewDate());
|
||||||
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewAdditionalHeaders());
|
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewAdditionalHeaders());
|
||||||
hideAdditionalHeaders();
|
|
||||||
|
|
||||||
mAnsweredIcon.setVisibility(View.GONE);
|
|
||||||
mForwardedIcon.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
|
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
|
||||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
||||||
@ -118,6 +115,13 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
mFromView.setOnClickListener(this);
|
mFromView.setOnClickListener(this);
|
||||||
mToView.setOnClickListener(this);
|
mToView.setOnClickListener(this);
|
||||||
mCcView.setOnClickListener(this);
|
mCcView.setOnClickListener(this);
|
||||||
|
|
||||||
|
resetViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetViews() {
|
||||||
|
mSubjectView.setVisibility(VISIBLE);
|
||||||
|
hideAdditionalHeaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -226,7 +230,8 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
mMessage = message;
|
mMessage = message;
|
||||||
mAccount = account;
|
mAccount = account;
|
||||||
|
|
||||||
initializeLayout();
|
resetViews();
|
||||||
|
|
||||||
final String subject = message.getSubject();
|
final String subject = message.getSubject();
|
||||||
if (StringUtils.isNullOrEmpty(subject)) {
|
if (StringUtils.isNullOrEmpty(subject)) {
|
||||||
mSubjectView.setText(mContext.getText(R.string.general_no_subject));
|
mSubjectView.setText(mContext.getText(R.string.general_no_subject));
|
||||||
|
Loading…
Reference in New Issue
Block a user