mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-17 21:32:26 -05:00
Set MessageList title in action bar depending on display mode
This commit is contained in:
parent
c11e5ef76b
commit
6b143d845a
@ -1,50 +1,72 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" >
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/title_layout"
|
android:id="@+id/actionbar_message_list"
|
||||||
android:layout_width="0dip"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:orientation="horizontal" >
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:orientation="vertical" >
|
<LinearLayout
|
||||||
|
android:id="@+id/title_layout"
|
||||||
|
android:layout_width="0dip"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actionbar_title_first"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="start"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actionbar_title_sub"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/actionbar_progress"
|
||||||
|
style="?android:attr/indeterminateProgressStyle"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/actionbar_title_first"
|
android:id="@+id/actionbar_unread_count"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="start"
|
android:paddingLeft="12dip"
|
||||||
android:singleLine="true"
|
android:paddingRight="12dip"
|
||||||
android:textSize="14sp" />
|
android:textColor="?android:attr/textColorTertiary"
|
||||||
|
android:textSize="32sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/actionbar_title_sub"
|
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_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:includeFontPadding="false"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:maxLines="2"
|
||||||
android:textSize="12sp" />
|
android:textSize="16sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ProgressBar
|
</FrameLayout>
|
||||||
android:id="@+id/actionbar_progress"
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
style="?android:attr/indeterminateProgressStyle"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/actionbar_unread_count"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="12dip"
|
|
||||||
android:paddingRight="12dip"
|
|
||||||
android:textColor="?android:attr/textColorTertiary"
|
|
||||||
android:textSize="32sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,50 +1,72 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" >
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/title_layout"
|
android:id="@+id/actionbar_message_list"
|
||||||
android:layout_width="0dip"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:orientation="horizontal" >
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:orientation="vertical" >
|
<LinearLayout
|
||||||
|
android:id="@+id/title_layout"
|
||||||
|
android:layout_width="0dip"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actionbar_title_first"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="start"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/actionbar_title_sub"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="?android:attr/textColorSecondary" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/actionbar_progress"
|
||||||
|
style="?android:attr/indeterminateProgressStyle"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/actionbar_title_first"
|
android:id="@+id/actionbar_unread_count"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="start"
|
android:paddingLeft="12dip"
|
||||||
android:singleLine="true"
|
android:paddingRight="12dip"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
android:textColor="?android:attr/textColorTertiary"
|
||||||
|
android:textSize="36sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/actionbar_title_sub"
|
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_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:includeFontPadding="false"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:maxLines="2"
|
||||||
android:textColor="?android:attr/textColorSecondary" />
|
android:textSize="16sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ProgressBar
|
</FrameLayout>
|
||||||
android:id="@+id/actionbar_progress"
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
style="?android:attr/indeterminateProgressStyle"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/actionbar_unread_count"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="12dip"
|
|
||||||
android:paddingRight="12dip"
|
|
||||||
android:textColor="?android:attr/textColorTertiary"
|
|
||||||
android:textSize="36sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -44,8 +44,7 @@
|
|||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<!-- From -->
|
<!-- From -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -49,6 +49,7 @@ import com.fsck.k9.search.SearchSpecification.Attribute;
|
|||||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||||
import com.fsck.k9.view.MessageHeader;
|
import com.fsck.k9.view.MessageHeader;
|
||||||
|
import com.fsck.k9.view.MessageTitleView;
|
||||||
|
|
||||||
import de.cketti.library.changelog.ChangeLog;
|
import de.cketti.library.changelog.ChangeLog;
|
||||||
|
|
||||||
@ -139,6 +140,9 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
||||||
|
|
||||||
private ActionBar mActionBar;
|
private ActionBar mActionBar;
|
||||||
|
private View mActionBarMessageList;
|
||||||
|
private View mActionBarMessageView;
|
||||||
|
private MessageTitleView mActionBarSubject;
|
||||||
private TextView mActionBarTitle;
|
private TextView mActionBarTitle;
|
||||||
private TextView mActionBarSubTitle;
|
private TextView mActionBarSubTitle;
|
||||||
private TextView mActionBarUnread;
|
private TextView mActionBarUnread;
|
||||||
@ -463,6 +467,9 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
mActionBar.setCustomView(R.layout.actionbar_custom);
|
mActionBar.setCustomView(R.layout.actionbar_custom);
|
||||||
|
|
||||||
View customView = mActionBar.getCustomView();
|
View customView = mActionBar.getCustomView();
|
||||||
|
mActionBarMessageList = customView.findViewById(R.id.actionbar_message_list);
|
||||||
|
mActionBarMessageView = customView.findViewById(R.id.actionbar_message_view);
|
||||||
|
mActionBarSubject = (MessageTitleView) customView.findViewById(R.id.message_title_view);
|
||||||
mActionBarTitle = (TextView) customView.findViewById(R.id.actionbar_title_first);
|
mActionBarTitle = (TextView) customView.findViewById(R.id.actionbar_title_first);
|
||||||
mActionBarSubTitle = (TextView) customView.findViewById(R.id.actionbar_title_sub);
|
mActionBarSubTitle = (TextView) customView.findViewById(R.id.actionbar_title_sub);
|
||||||
mActionBarUnread = (TextView) customView.findViewById(R.id.actionbar_unread_count);
|
mActionBarUnread = (TextView) customView.findViewById(R.id.actionbar_unread_count);
|
||||||
@ -1174,6 +1181,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
ft.remove(mMessageViewFragment);
|
ft.remove(mMessageViewFragment);
|
||||||
mMessageViewFragment = null;
|
mMessageViewFragment = null;
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
|
showDefaultTitleView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,7 +1252,9 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayMessageSubject(String subject) {
|
public void displayMessageSubject(String subject) {
|
||||||
setTitle(subject);
|
if (mDisplayMode == DisplayMode.MESSAGE_VIEW) {
|
||||||
|
mActionBarSubject.setText(subject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1284,7 +1295,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageHeaderViewAvailable(MessageHeader header) {
|
public void messageHeaderViewAvailable(MessageHeader header) {
|
||||||
//TODO: implement
|
mActionBarSubject.setMessageHeader(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNextMessage() {
|
private void showNextMessage() {
|
||||||
@ -1309,6 +1320,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
mMessageListContainer.setVisibility(View.VISIBLE);
|
mMessageListContainer.setVisibility(View.VISIBLE);
|
||||||
removeMessageViewFragment();
|
removeMessageViewFragment();
|
||||||
mMessageListFragment.setActiveMessage(null);
|
mMessageListFragment.setActiveMessage(null);
|
||||||
|
|
||||||
|
showDefaultTitleView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMessageView() {
|
private void showMessageView() {
|
||||||
@ -1316,6 +1329,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
|
|
||||||
mMessageListContainer.setVisibility(View.GONE);
|
mMessageListContainer.setVisibility(View.GONE);
|
||||||
mMessageViewContainer.setVisibility(View.VISIBLE);
|
mMessageViewContainer.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
showMessageTitleView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1348,4 +1363,24 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
|
|
||||||
restartActivity();
|
restartActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showDefaultTitleView() {
|
||||||
|
mActionBarMessageView.setVisibility(View.GONE);
|
||||||
|
mActionBarMessageList.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (mMessageListFragment != null) {
|
||||||
|
mMessageListFragment.updateTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
mActionBarSubject.setMessageHeader(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showMessageTitleView() {
|
||||||
|
mActionBarMessageList.setVisibility(View.GONE);
|
||||||
|
mActionBarMessageView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (mMessageViewFragment != null) {
|
||||||
|
mMessageViewFragment.updateTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,6 +417,12 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
|
|
||||||
private MessageReference mActiveMessage;
|
private MessageReference mActiveMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code true} after {@link #onCreate(Bundle)} was executed. Used in {@link #updateTitle()} to
|
||||||
|
* make sure we don't access member variables before initialization is complete.
|
||||||
|
*/
|
||||||
|
private boolean mInitialized = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to run operations that modify UI elements in the UI thread.
|
* This class is used to run operations that modify UI elements in the UI thread.
|
||||||
*
|
*
|
||||||
@ -501,7 +507,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_REFRESH_TITLE: {
|
case ACTION_REFRESH_TITLE: {
|
||||||
MessageListFragment.this.refreshTitle();
|
updateTitle();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_PROGRESS: {
|
case ACTION_PROGRESS: {
|
||||||
@ -562,7 +568,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
updateFooterView();
|
updateFooterView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshTitle() {
|
public void updateTitle() {
|
||||||
|
if (!mInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setWindowTitle();
|
setWindowTitle();
|
||||||
if (!mSearch.isManualSearch()) {
|
if (!mSearch.isManualSearch()) {
|
||||||
setWindowProgress();
|
setWindowProgress();
|
||||||
@ -716,6 +726,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
mCheckboxes = K9.messageListCheckboxes();
|
mCheckboxes = K9.messageListCheckboxes();
|
||||||
|
|
||||||
decodeArguments();
|
decodeArguments();
|
||||||
|
|
||||||
|
mInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -973,7 +985,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
mController.getFolderUnreadMessageCount(mAccount, mFolderName, mListener);
|
mController.getFolderUnreadMessageCount(mAccount, mFolderName, mListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializePullToRefresh(LayoutInflater inflater, View layout) {
|
private void initializePullToRefresh(LayoutInflater inflater, View layout) {
|
||||||
@ -3148,7 +3160,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
if (StringUtils.isNullOrEmpty(mTitle)) {
|
if (StringUtils.isNullOrEmpty(mTitle)) {
|
||||||
mTitle = getString(R.string.general_no_subject);
|
mTitle = getString(R.string.general_no_subject);
|
||||||
}
|
}
|
||||||
refreshTitle();
|
updateTitle();
|
||||||
} else {
|
} else {
|
||||||
//TODO: empty thread view -> return to full message list
|
//TODO: empty thread view -> return to full message list
|
||||||
}
|
}
|
||||||
|
@ -791,6 +791,12 @@ public class MessageViewFragment extends SherlockFragment implements OnClickList
|
|||||||
&& mAccount.hasSpamFolder());
|
&& mAccount.hasSpamFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTitle() {
|
||||||
|
if (mMessage != null) {
|
||||||
|
displayMessageSubject(mMessage.getSubject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public interface MessageViewFragmentListener {
|
public interface MessageViewFragmentListener {
|
||||||
public void onForward(Message mMessage, PgpData mPgpData);
|
public void onForward(Message mMessage, PgpData mPgpData);
|
||||||
public void disableDeleteAction();
|
public void disableDeleteAction();
|
||||||
|
@ -431,10 +431,7 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void hideSubjectLine() {
|
||||||
* The subject line defaults to GONE. Make it visible.
|
mSubjectView.setVisibility(GONE);
|
||||||
*/
|
|
||||||
public void showSubjectLine() {
|
|
||||||
mSubjectView.setVisibility(VISIBLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,15 @@ package com.fsck.k9.view;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.fsck.k9.K9;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This {@link TextView} is used in the title of the {@link com.fsck.k9.activity.MessageView} ActionBar.
|
* This {@link TextView} is used in the custom view of the {@link com.fsck.k9.activity.MessageList}
|
||||||
* It'll un-hide the subject line {@link MessageHeader} if it doesn't fit in the ActionBar's title area.
|
* 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 {
|
public class MessageTitleView extends TextView {
|
||||||
private static final String LOG_PREFIX = "MessageTitleView: ";
|
|
||||||
private MessageHeader mHeader;
|
private MessageHeader mHeader;
|
||||||
|
|
||||||
public MessageTitleView(Context context) {
|
public MessageTitleView(Context context) {
|
||||||
@ -28,28 +27,17 @@ public class MessageTitleView extends TextView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if we need to unhide the subject line in the MessageHeader or not.
|
* Check to see if we need to hide the subject line in {@link MessageHeader} or not.
|
||||||
* @param canvas Canvas to draw on.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onDraw(Canvas canvas) {
|
public void onDraw(Canvas canvas) {
|
||||||
if(mHeader != null && getLayout() != null) {
|
if (mHeader != null && getLayout() != null && getLayout().getEllipsisCount(1) == 0) {
|
||||||
if(getLayout().getEllipsisCount(1) > 0) {
|
mHeader.hideSubjectLine();
|
||||||
if(K9.DEBUG) {
|
|
||||||
Log.d(K9.LOG_TAG, LOG_PREFIX +
|
|
||||||
"Subject was truncated; enabling the subject line in the message header.");
|
|
||||||
}
|
|
||||||
mHeader.showSubjectLine();
|
|
||||||
} else {
|
|
||||||
if (K9.DEBUG) {
|
|
||||||
Log.d(K9.LOG_TAG, LOG_PREFIX + "Subject was fully shown in ActionBar.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageHeader(final MessageHeader header) {
|
public void setMessageHeader(final MessageHeader header) {
|
||||||
this.mHeader = header;
|
mHeader = header;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user