display subject inline
This commit is contained in:
parent
c96ced3bc3
commit
ee44e03b43
7 changed files with 32 additions and 183 deletions
|
@ -61,8 +61,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 +163,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 +556,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);
|
||||
|
@ -1492,15 +1486,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 +1522,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 +1609,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
|
||||
|
|
|
@ -33,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;
|
||||
|
@ -43,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;
|
||||
|
||||
|
||||
|
@ -213,8 +212,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
}
|
||||
});
|
||||
|
||||
mFragmentListener.messageHeaderViewAvailable(mMessageView.getMessageHeaderView());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -290,7 +287,6 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
|
|||
}
|
||||
|
||||
mMessageView.setSubject(subject);
|
||||
displayMessageSubject(subject);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -521,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);
|
||||
}
|
||||
|
@ -641,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;
|
||||
}
|
||||
|
@ -741,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();
|
||||
}
|
||||
|
||||
|
|
|
@ -293,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;
|
||||
|
||||
|
@ -543,10 +536,6 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
|
|||
}
|
||||
}
|
||||
|
||||
public void showSubjectLine() {
|
||||
mSubjectView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
public void setOnCryptoClickListener(OnCryptoClickListener onCryptoClickListener) {
|
||||
this.onCryptoClickListener = onCryptoClickListener;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -23,19 +23,36 @@
|
|||
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:padding="8dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:text="(no subject)"
|
||||
/>
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:padding="8dp"
|
||||
tools:text="(no subject)"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp"
|
||||
android:focusable="false"
|
||||
android:checked="false"
|
||||
style="?android:attr/starStyle"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -230,16 +247,6 @@
|
|||
android:id="@+id/status_icon_strip"
|
||||
>
|
||||
|
||||
<!--
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
style="?android:attr/starStyle"
|
||||
android:checked="false" />
|
||||
-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_single_message_options"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue