Merge pull request #3743 from k9mail/message-reply-button
Message reply button
This commit is contained in:
commit
05d9315d79
13 changed files with 181 additions and 283 deletions
|
@ -11,6 +11,7 @@ import android.content.Intent;
|
|||
import android.content.IntentSender;
|
||||
import android.content.IntentSender.SendIntentException;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -61,8 +62,6 @@ import com.fsck.k9.ui.R;
|
|||
import com.fsck.k9.ui.messageview.MessageViewFragment;
|
||||
import com.fsck.k9.ui.messageview.MessageViewFragment.MessageViewFragmentListener;
|
||||
import com.fsck.k9.ui.settings.SettingsActivity;
|
||||
import com.fsck.k9.view.MessageHeader;
|
||||
import com.fsck.k9.view.MessageTitleView;
|
||||
import com.fsck.k9.view.ViewSwitcher;
|
||||
import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener;
|
||||
import com.mikepenz.materialdrawer.Drawer.OnDrawerListener;
|
||||
|
@ -165,8 +164,6 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
private K9Drawer drawer;
|
||||
private FragmentTransaction openFolderTransaction;
|
||||
private View actionBarMessageList;
|
||||
private View actionBarMessageView;
|
||||
private MessageTitleView actionBarSubject;
|
||||
private TextView actionBarTitle;
|
||||
private TextView actionBarSubTitle;
|
||||
private Menu menu;
|
||||
|
@ -560,8 +557,6 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
|
||||
View customView = actionBar.getCustomView();
|
||||
actionBarMessageList = customView.findViewById(R.id.actionbar_message_list);
|
||||
actionBarMessageView = customView.findViewById(R.id.actionbar_message_view);
|
||||
actionBarSubject = customView.findViewById(R.id.message_title_view);
|
||||
actionBarTitle = customView.findViewById(R.id.actionbar_title_first);
|
||||
actionBarSubTitle = customView.findViewById(R.id.actionbar_title_sub);
|
||||
actionBarProgress = customView.findViewById(R.id.actionbar_progress);
|
||||
|
@ -1102,11 +1097,17 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
}
|
||||
|
||||
// Set title of menu item to toggle the read state of the currently displayed message
|
||||
int[] drawableAttr;
|
||||
if (messageViewFragment.isMessageRead()) {
|
||||
menu.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_unread_action);
|
||||
drawableAttr = new int[] { R.attr.iconActionMarkAsUnread };
|
||||
} else {
|
||||
menu.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_read_action);
|
||||
drawableAttr = new int[] { R.attr.iconActionMarkAsRead };
|
||||
}
|
||||
TypedArray ta = obtainStyledAttributes(drawableAttr);
|
||||
menu.findItem(R.id.toggle_unread).setIcon(ta.getDrawable(0));
|
||||
ta.recycle();
|
||||
|
||||
// Jellybean has built-in long press selection support
|
||||
menu.findItem(R.id.select_text).setVisible(Build.VERSION.SDK_INT < 16);
|
||||
|
@ -1492,15 +1493,6 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayMessageSubject(String subject) {
|
||||
if (displayMode == DisplayMode.MESSAGE_VIEW) {
|
||||
actionBarSubject.setText(subject);
|
||||
} else {
|
||||
actionBarSubject.showSubjectInMessageHeader();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNextMessageOrReturn() {
|
||||
if (K9.messageViewReturnToList() || !showLogicalNextMessage()) {
|
||||
|
@ -1537,11 +1529,6 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
setProgressBarIndeterminateVisibility(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageHeaderViewAvailable(MessageHeader header) {
|
||||
actionBarSubject.setMessageHeader(header);
|
||||
}
|
||||
|
||||
private boolean showNextMessage() {
|
||||
MessageReference ref = messageViewFragment.getMessageReference();
|
||||
if (ref != null) {
|
||||
|
@ -1629,24 +1616,15 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
}
|
||||
|
||||
private void showDefaultTitleView() {
|
||||
actionBarMessageView.setVisibility(View.GONE);
|
||||
actionBarMessageList.setVisibility(View.VISIBLE);
|
||||
|
||||
if (messageListFragment != null) {
|
||||
messageListFragment.updateTitle();
|
||||
}
|
||||
|
||||
actionBarSubject.setMessageHeader(null);
|
||||
}
|
||||
|
||||
private void showMessageTitleView() {
|
||||
actionBarMessageList.setVisibility(View.GONE);
|
||||
actionBarMessageView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (messageViewFragment != null) {
|
||||
displayMessageSubject(null);
|
||||
messageViewFragment.updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.PopupMenu.OnMenuItemClickListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -219,6 +220,10 @@ public class MessageTopView extends LinearLayout {
|
|||
mHeaderContainer.setOnFlagListener(listener);
|
||||
}
|
||||
|
||||
public void setOnMenuItemClickListener(OnMenuItemClickListener listener) {
|
||||
mHeaderContainer.setOnMenuItemClickListener(listener);
|
||||
}
|
||||
|
||||
public void showAllHeaders() {
|
||||
mHeaderContainer.onShowAdditionalHeaders();
|
||||
}
|
||||
|
|
|
@ -18,10 +18,12 @@ import android.os.SystemClock;
|
|||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.widget.PopupMenu.OnMenuItemClickListener;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -31,9 +33,8 @@ import android.widget.Toast;
|
|||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.Preferences;
|
||||
import com.fsck.k9.activity.K9ActivityCommon;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.activity.ChooseFolder;
|
||||
import com.fsck.k9.activity.K9ActivityCommon;
|
||||
import com.fsck.k9.activity.MessageLoaderHelper;
|
||||
import com.fsck.k9.activity.MessageLoaderHelper.MessageLoaderCallbacks;
|
||||
import com.fsck.k9.controller.MessageReference;
|
||||
|
@ -41,17 +42,17 @@ import com.fsck.k9.controller.MessagingController;
|
|||
import com.fsck.k9.fragment.AttachmentDownloadDialogFragment;
|
||||
import com.fsck.k9.fragment.ConfirmationDialogFragment;
|
||||
import com.fsck.k9.fragment.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
|
||||
import com.fsck.k9.ui.helper.FileBrowserHelper;
|
||||
import com.fsck.k9.ui.helper.FileBrowserHelper.FileBrowserFailOverCallback;
|
||||
import com.fsck.k9.mail.Flag;
|
||||
import com.fsck.k9.mailstore.AttachmentViewInfo;
|
||||
import com.fsck.k9.mailstore.LocalMessage;
|
||||
import com.fsck.k9.mailstore.MessageViewInfo;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.ui.helper.FileBrowserHelper;
|
||||
import com.fsck.k9.ui.helper.FileBrowserHelper.FileBrowserFailOverCallback;
|
||||
import com.fsck.k9.ui.messageview.CryptoInfoDialog.OnClickShowCryptoKeyListener;
|
||||
import com.fsck.k9.ui.messageview.MessageCryptoPresenter.MessageCryptoMvpView;
|
||||
import com.fsck.k9.ui.settings.account.AccountSettingsActivity;
|
||||
import com.fsck.k9.view.MessageCryptoDisplayStatus;
|
||||
import com.fsck.k9.view.MessageHeader;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
|
@ -179,6 +180,30 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
}
|
||||
});
|
||||
|
||||
mMessageView.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.reply) {
|
||||
onReply();
|
||||
return true;
|
||||
} else if (id == R.id.reply_all) {
|
||||
onReplyAll();
|
||||
return true;
|
||||
} else if (id == R.id.forward) {
|
||||
onForward();
|
||||
return true;
|
||||
} else if (id == R.id.forward_as_attachment) {
|
||||
onForwardAsAttachment();
|
||||
return true;
|
||||
} else if (id == R.id.share) {
|
||||
onSendAlternate();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mMessageView.setOnDownloadButtonClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -187,8 +212,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
}
|
||||
});
|
||||
|
||||
mFragmentListener.messageHeaderViewAvailable(mMessageView.getMessageHeaderView());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -264,7 +287,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
}
|
||||
|
||||
mMessageView.setSubject(subject);
|
||||
displayMessageSubject(subject);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -495,12 +517,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
}
|
||||
}
|
||||
|
||||
private void displayMessageSubject(String subject) {
|
||||
if (mFragmentListener != null) {
|
||||
mFragmentListener.displayMessageSubject(subject);
|
||||
}
|
||||
}
|
||||
|
||||
public void moveMessage(MessageReference reference, String destFolderName) {
|
||||
mController.moveMessage(mAccount, mMessageReference.getFolderServerId(), reference, destFolderName);
|
||||
}
|
||||
|
@ -615,12 +631,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
&& mAccount.hasSpamFolder());
|
||||
}
|
||||
|
||||
public void updateTitle() {
|
||||
if (mMessage != null) {
|
||||
displayMessageSubject(mMessage.getSubject());
|
||||
}
|
||||
}
|
||||
|
||||
public Context getApplicationContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
@ -715,10 +725,8 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
void disableDeleteAction();
|
||||
void onReplyAll(MessageReference messageReference, Parcelable decryptionResultForReply);
|
||||
void onReply(MessageReference messageReference, Parcelable decryptionResultForReply);
|
||||
void displayMessageSubject(String title);
|
||||
void setProgress(boolean b);
|
||||
void showNextMessageOrReturn();
|
||||
void messageHeaderViewAvailable(MessageHeader messageHeaderView);
|
||||
void updateMenu();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.openintents.openpgp.OpenPgpSignatureResult;
|
|||
|
||||
public enum MessageCryptoDisplayStatus {
|
||||
LOADING (
|
||||
false,
|
||||
R.attr.openpgp_grey,
|
||||
R.drawable.status_lock_disabled
|
||||
),
|
||||
|
@ -26,6 +27,7 @@ public enum MessageCryptoDisplayStatus {
|
|||
),
|
||||
|
||||
DISABLED (
|
||||
false,
|
||||
R.attr.openpgp_grey,
|
||||
R.drawable.status_lock_disabled,
|
||||
R.string.crypto_msg_title_plaintext,
|
||||
|
@ -190,6 +192,7 @@ public enum MessageCryptoDisplayStatus {
|
|||
@DrawableRes public final int statusIconRes;
|
||||
@StringRes public final Integer titleTextRes;
|
||||
@StringRes public final Integer descriptionTextRes;
|
||||
public boolean isEnabled;
|
||||
|
||||
MessageCryptoDisplayStatus(@AttrRes int colorAttr, @DrawableRes int statusIconRes, @StringRes int titleTextRes,
|
||||
Integer descriptionTextRes) {
|
||||
|
@ -200,12 +203,20 @@ public enum MessageCryptoDisplayStatus {
|
|||
this.descriptionTextRes = descriptionTextRes;
|
||||
}
|
||||
|
||||
MessageCryptoDisplayStatus(@AttrRes int colorAttr, @DrawableRes int statusIconRes) {
|
||||
MessageCryptoDisplayStatus(boolean isEnabled, @AttrRes int colorAttr, @DrawableRes int statusIconRes,
|
||||
@StringRes int titleTextRes, Integer descriptionTextRes) {
|
||||
this(colorAttr, statusIconRes, titleTextRes, descriptionTextRes);
|
||||
this.isEnabled = isEnabled;
|
||||
}
|
||||
|
||||
MessageCryptoDisplayStatus(boolean isEnabled, @AttrRes int colorAttr, @DrawableRes int statusIconRes) {
|
||||
this.colorAttr = colorAttr;
|
||||
this.statusIconRes = statusIconRes;
|
||||
|
||||
this.titleTextRes = null;
|
||||
this.descriptionTextRes = null;
|
||||
|
||||
this.isEnabled = isEnabled;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package com.fsck.k9.view;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.fsck.k9.ui.R;
|
||||
|
||||
|
||||
public class MessageCryptoStatusView extends FrameLayout {
|
||||
|
||||
private ImageView iconSingle;
|
||||
|
||||
public MessageCryptoStatusView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MessageCryptoStatusView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public MessageCryptoStatusView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
iconSingle = findViewById(R.id.crypto_status_single);
|
||||
}
|
||||
|
||||
public void setCryptoDisplayStatus(MessageCryptoDisplayStatus displayStatus) {
|
||||
@ColorInt int color = ThemeUtils.getStyledColor(getContext(), displayStatus.colorAttr);
|
||||
|
||||
iconSingle.setImageResource(displayStatus.statusIconRes);
|
||||
iconSingle.setColorFilter(color);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ import android.graphics.Typeface;
|
|||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.PopupMenu.OnMenuItemClickListener;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
|
@ -23,6 +25,7 @@ import android.view.View;
|
|||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -32,7 +35,6 @@ import com.fsck.k9.FontSizes;
|
|||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.activity.misc.ContactPicture;
|
||||
import com.fsck.k9.contacts.ContactPictureLoader;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.helper.ClipboardManager;
|
||||
import com.fsck.k9.helper.Contacts;
|
||||
import com.fsck.k9.helper.MessageHelper;
|
||||
|
@ -41,6 +43,7 @@ import com.fsck.k9.mail.Flag;
|
|||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.internet.MimeUtility;
|
||||
import com.fsck.k9.ui.ContactBadge;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.ui.messageview.OnCryptoClickListener;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
@ -57,12 +60,13 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
private TextView mBccView;
|
||||
private TextView mBccLabel;
|
||||
private TextView mSubjectView;
|
||||
private MessageCryptoStatusView mCryptoStatusIcon;
|
||||
private ImageView mCryptoStatusIcon;
|
||||
|
||||
private View mChip;
|
||||
private CheckBox mFlagged;
|
||||
private int defaultSubjectColor;
|
||||
private TextView mAdditionalHeadersView;
|
||||
private View singleMessageOptionIcon;
|
||||
private View mAnsweredIcon;
|
||||
private View mForwardedIcon;
|
||||
private Message mMessage;
|
||||
|
@ -77,6 +81,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
|
||||
private OnLayoutChangedListener mOnLayoutChangedListener;
|
||||
private OnCryptoClickListener onCryptoClickListener;
|
||||
private OnMenuItemClickListener onMenuItemClickListener;
|
||||
|
||||
/**
|
||||
* Pair class is only available since API Level 5, so we need
|
||||
|
@ -115,6 +120,8 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
|
||||
mContactBadge = findViewById(R.id.contact_badge);
|
||||
|
||||
singleMessageOptionIcon = findViewById(R.id.icon_single_message_options);
|
||||
|
||||
mSubjectView = findViewById(R.id.subject);
|
||||
mAdditionalHeadersView = findViewById(R.id.additional_headers_view);
|
||||
mChip = findViewById(R.id.chip);
|
||||
|
@ -134,6 +141,8 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
mFontSizes.setViewTextSize(mBccView, mFontSizes.getMessageViewBCC());
|
||||
mFontSizes.setViewTextSize(mBccLabel, mFontSizes.getMessageViewBCC());
|
||||
|
||||
singleMessageOptionIcon.setOnClickListener(this);
|
||||
|
||||
mFromView.setOnClickListener(this);
|
||||
mToView.setOnClickListener(this);
|
||||
mCcView.setOnClickListener(this);
|
||||
|
@ -162,6 +171,11 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
layoutChanged();
|
||||
} else if (id == R.id.crypto_status_icon) {
|
||||
onCryptoClickListener.onCryptoClick();
|
||||
} else if (id == R.id.icon_single_message_options) {
|
||||
PopupMenu popupMenu = new PopupMenu(getContext(), view);
|
||||
popupMenu.setOnMenuItemClickListener(onMenuItemClickListener);
|
||||
popupMenu.inflate(R.menu.single_message_options);
|
||||
popupMenu.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,13 +293,6 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
counterpartyAddress = fromAddrs[0];
|
||||
}
|
||||
|
||||
/* We hide the subject by default for each new message, and MessageTitleView might show
|
||||
* it later by calling showSubjectLine(). */
|
||||
boolean newMessageShown = mMessage == null || !mMessage.getUid().equals(message.getUid());
|
||||
if (newMessageShown) {
|
||||
mSubjectView.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mMessage = message;
|
||||
mAccount = account;
|
||||
|
||||
|
@ -362,21 +369,23 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
}
|
||||
|
||||
public void setCryptoStatusLoading() {
|
||||
mCryptoStatusIcon.setVisibility(View.VISIBLE);
|
||||
mCryptoStatusIcon.setEnabled(false);
|
||||
mCryptoStatusIcon.setCryptoDisplayStatus(MessageCryptoDisplayStatus.LOADING);
|
||||
setCryptoDisplayStatus(MessageCryptoDisplayStatus.LOADING);
|
||||
}
|
||||
|
||||
public void setCryptoStatusDisabled() {
|
||||
mCryptoStatusIcon.setVisibility(View.VISIBLE);
|
||||
mCryptoStatusIcon.setEnabled(false);
|
||||
mCryptoStatusIcon.setCryptoDisplayStatus(MessageCryptoDisplayStatus.DISABLED);
|
||||
setCryptoDisplayStatus(MessageCryptoDisplayStatus.DISABLED);
|
||||
}
|
||||
|
||||
public void setCryptoStatus(MessageCryptoDisplayStatus displayStatus) {
|
||||
setCryptoDisplayStatus(displayStatus);
|
||||
}
|
||||
|
||||
private void setCryptoDisplayStatus(MessageCryptoDisplayStatus displayStatus) {
|
||||
int color = ThemeUtils.getStyledColor(getContext(), displayStatus.colorAttr);
|
||||
mCryptoStatusIcon.setEnabled(displayStatus.isEnabled);
|
||||
mCryptoStatusIcon.setVisibility(View.VISIBLE);
|
||||
mCryptoStatusIcon.setEnabled(true);
|
||||
mCryptoStatusIcon.setCryptoDisplayStatus(displayStatus);
|
||||
mCryptoStatusIcon.setImageResource(displayStatus.statusIconRes);
|
||||
mCryptoStatusIcon.setColorFilter(color);
|
||||
}
|
||||
|
||||
public void onShowAdditionalHeaders() {
|
||||
|
@ -527,11 +536,11 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
}
|
||||
}
|
||||
|
||||
public void showSubjectLine() {
|
||||
mSubjectView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
public void setOnCryptoClickListener(OnCryptoClickListener onCryptoClickListener) {
|
||||
this.onCryptoClickListener = onCryptoClickListener;
|
||||
}
|
||||
|
||||
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.onMenuItemClickListener = onMenuItemClickListener;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
package com.fsck.k9.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* This {@link TextView} is used in the custom view of the {@link com.fsck.k9.activity.MessageList}
|
||||
* action bar.
|
||||
* It will hide the subject line in {@link MessageHeader} if the subject fits completely into the
|
||||
* action bar's title view.
|
||||
*/
|
||||
public class MessageTitleView extends TextView {
|
||||
private static final int MAX_LINES = 2;
|
||||
private static final String ELLIPSIS = "\u2026";
|
||||
|
||||
private MessageHeader mHeader;
|
||||
private boolean mNeedEllipsizeCheck = true;
|
||||
|
||||
public MessageTitleView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public MessageTitleView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, android.R.attr.textViewStyle);
|
||||
}
|
||||
|
||||
public MessageTitleView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTextChanged(CharSequence text, int start,
|
||||
int lengthBefore, int lengthAfter) {
|
||||
super.onTextChanged(text, start, lengthBefore, lengthAfter);
|
||||
mNeedEllipsizeCheck = true;
|
||||
}
|
||||
/**
|
||||
* Check to see if we need to hide the subject line in {@link MessageHeader} or not.
|
||||
*/
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {
|
||||
/*
|
||||
* Android does not support ellipsize in combination with maxlines
|
||||
* for TextViews. To work around that, check for ourselves whether
|
||||
* the text is longer than MAX_LINES, and ellipsize manually.
|
||||
*/
|
||||
if (mNeedEllipsizeCheck) {
|
||||
if (getLayout() != null && mHeader != null) {
|
||||
if (getLayout().getLineCount() > MAX_LINES) {
|
||||
int lineEndIndex = getLayout().getLineEnd(MAX_LINES - 1);
|
||||
setText(getText().subSequence(0, lineEndIndex - 2) + ELLIPSIS);
|
||||
showSubjectInMessageHeader();
|
||||
}
|
||||
mNeedEllipsizeCheck = false;
|
||||
}
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
public void setMessageHeader(final MessageHeader header) {
|
||||
mHeader = header;
|
||||
}
|
||||
|
||||
public void showSubjectInMessageHeader() {
|
||||
if (mHeader != null) {
|
||||
mHeader.showSubjectLine();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -53,18 +53,4 @@
|
|||
android:textSize="32sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actionbar_message_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" >
|
||||
|
||||
<com.fsck.k9.view.MessageTitleView
|
||||
android:id="@+id/message_title_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -48,19 +48,4 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actionbar_message_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" >
|
||||
|
||||
<com.fsck.k9.view.MessageTitleView
|
||||
android:id="@+id/message_title_view"
|
||||
tools:text="MessageTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.fsck.k9.view.MessageCryptoStatusView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/crypto_status_icon"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="32dp"
|
||||
android:visibility="gone"
|
||||
custom:previewInitialChild="0"
|
||||
android:background="?selectableItemBackground"
|
||||
tools:showIn="@layout/message_view_header"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/crypto_status_single"
|
||||
android:src="@drawable/status_lock_disabled"
|
||||
android:tint="?attr/openpgp_grey"
|
||||
/>
|
||||
|
||||
</com.fsck.k9.view.MessageCryptoStatusView>
|
|
@ -23,19 +23,50 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:text="(no subject)"
|
||||
/>
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
tools:text="(no subject)"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/crypto_status_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="6dp"
|
||||
android:src="@drawable/status_lock_disabled"
|
||||
android:tint="?attr/openpgp_grey"
|
||||
android:background="?selectableItemBackground"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:focusable="false"
|
||||
android:checked="false"
|
||||
style="?android:attr/starStyle"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -230,15 +261,14 @@
|
|||
android:id="@+id/status_icon_strip"
|
||||
>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
<ImageView
|
||||
android:id="@+id/icon_single_message_options"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
style="?android:attr/starStyle"
|
||||
android:checked="false" />
|
||||
|
||||
<include layout="@layout/message_crypto_status_view" />
|
||||
android:src="?iconActionSingleMessageOptions"
|
||||
android:padding="8dp"
|
||||
android:background="?selectableItemBackground"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -11,20 +11,6 @@
|
|||
MessageList.configureMenu() if you make any changes to this file.
|
||||
-->
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/previous_message"
|
||||
android:title="@string/previous_action"
|
||||
android:icon="?attr/iconActionPreviousMessage"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/next_message"
|
||||
android:title="@string/next_action"
|
||||
android:icon="?attr/iconActionNextMessage"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
<!-- MessageList -->
|
||||
<item
|
||||
android:id="@+id/search"
|
||||
|
@ -48,6 +34,13 @@
|
|||
app:showAsAction="always"
|
||||
android:title="@string/check_mail_action"/>
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/archive"
|
||||
android:icon="?attr/iconActionArchive"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/archive_action"/>
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/delete"
|
||||
|
@ -55,21 +48,37 @@
|
|||
android:icon="?attr/iconActionDelete"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/delete_action"/>
|
||||
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/archive"
|
||||
android:icon="?attr/iconActionArchive"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/archive_action"/>
|
||||
|
||||
android:id="@+id/toggle_unread"
|
||||
android:icon="?attr/iconActionMarkAsUnread"
|
||||
android:alphabeticShortcut="u"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/mark_as_unread_action"/>
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/previous_message"
|
||||
android:title="@string/previous_action"
|
||||
android:icon="?attr/iconActionPreviousMessage"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/next_message"
|
||||
android:title="@string/next_action"
|
||||
android:icon="?attr/iconActionNextMessage"
|
||||
app:showAsAction="always"
|
||||
/>
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/spam"
|
||||
android:icon="?attr/iconActionSpam"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/spam_action"/>
|
||||
|
||||
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/move"
|
||||
|
@ -136,12 +145,6 @@
|
|||
android:title="@string/copy_action"/>
|
||||
</menu>
|
||||
</item>
|
||||
<!-- MessageView -->
|
||||
<item
|
||||
android:id="@+id/toggle_unread"
|
||||
android:alphabeticShortcut="u"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/mark_as_unread_action"/>
|
||||
|
||||
<item android:id="@+id/show_headers"
|
||||
app:showAsAction="never"
|
||||
|
@ -150,7 +153,7 @@
|
|||
<item android:id="@+id/hide_headers"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/hide_headers_action"/>
|
||||
|
||||
|
||||
<!-- always -->
|
||||
<item
|
||||
android:id="@+id/compose"
|
||||
|
@ -158,7 +161,7 @@
|
|||
android:icon="?attr/iconActionCompose"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/compose_action"/>
|
||||
|
||||
|
||||
<!-- MessageList -->
|
||||
<item
|
||||
android:id="@+id/set_sort"
|
||||
|
|
18
app/ui/src/main/res/menu/single_message_options.xml
Normal file
18
app/ui/src/main/res/menu/single_message_options.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/reply"
|
||||
android:title="@string/reply_action"/>
|
||||
<item
|
||||
android:id="@+id/reply_all"
|
||||
android:title="@string/reply_all_action"/>
|
||||
<item
|
||||
android:id="@+id/forward"
|
||||
android:title="@string/forward_action"/>
|
||||
<item
|
||||
android:id="@+id/forward_as_attachment"
|
||||
android:title="@string/forward_as_attachment_action"/>
|
||||
<item
|
||||
android:id="@+id/share"
|
||||
android:title="@string/send_alternate_action"/>
|
||||
</menu>
|
Loading…
Reference in a new issue