mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-31 07:10:14 -05:00
Add marker in message list for currently opened message
This commit is contained in:
parent
933dd95047
commit
573058bffc
@ -48,6 +48,7 @@
|
|||||||
<attr name="messageListUnreadItemBackgroundColor" format="reference|color"/>
|
<attr name="messageListUnreadItemBackgroundColor" format="reference|color"/>
|
||||||
<attr name="messageListThreadCountForegroundColor" format="reference|color"/>
|
<attr name="messageListThreadCountForegroundColor" format="reference|color"/>
|
||||||
<attr name="messageListThreadCountBackground" format="reference|color"/>
|
<attr name="messageListThreadCountBackground" format="reference|color"/>
|
||||||
|
<attr name="messageListActiveItemBackgroundColor" format="reference|color"/>
|
||||||
|
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
<item name="messageListUnreadItemBackgroundColor">#00ffffff</item>
|
<item name="messageListUnreadItemBackgroundColor">#00ffffff</item>
|
||||||
<item name="messageListThreadCountForegroundColor">?android:attr/colorBackground</item>
|
<item name="messageListThreadCountForegroundColor">?android:attr/colorBackground</item>
|
||||||
<item name="messageListThreadCountBackground">@drawable/thread_count_box_light</item>
|
<item name="messageListThreadCountBackground">@drawable/thread_count_box_light</item>
|
||||||
|
<item name="messageListActiveItemBackgroundColor">#ff2ea7d1</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.K9.Dark.Base" parent="Theme.Sherlock">
|
<style name="Theme.K9.Dark.Base" parent="Theme.Sherlock">
|
||||||
@ -96,6 +97,7 @@
|
|||||||
<item name="messageListUnreadItemBackgroundColor">#805a5a5a</item>
|
<item name="messageListUnreadItemBackgroundColor">#805a5a5a</item>
|
||||||
<item name="messageListThreadCountForegroundColor">?android:attr/colorBackground</item>
|
<item name="messageListThreadCountForegroundColor">?android:attr/colorBackground</item>
|
||||||
<item name="messageListThreadCountBackground">@drawable/thread_count_box_dark</item>
|
<item name="messageListThreadCountBackground">@drawable/thread_count_box_dark</item>
|
||||||
|
<item name="messageListActiveItemBackgroundColor">#ff33b5e5</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.K9.Light" parent="Theme.K9.Light.Base">
|
<style name="Theme.K9.Light" parent="Theme.K9.Light.Base">
|
||||||
@ -131,5 +133,5 @@
|
|||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowContentOverlay">@null</item>
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
|
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -627,6 +627,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
ft.replace(R.id.message_view_container, fragment);
|
ft.replace(R.id.message_view_container, fragment);
|
||||||
mMessageViewFragment = fragment;
|
mMessageViewFragment = fragment;
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
|
mMessageListFragment.setActiveMessage(messageReference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,6 +765,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
if (mMessageViewPlaceHolder.getParent() == null) {
|
if (mMessageViewPlaceHolder.getParent() == null) {
|
||||||
mMessageViewContainer.addView(mMessageViewPlaceHolder);
|
mMessageViewContainer.addView(mMessageViewPlaceHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMessageListFragment.setActiveMessage(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -310,6 +310,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
private static final String ARG_IS_THREAD_DISPLAY = "isThreadedDisplay";
|
private static final String ARG_IS_THREAD_DISPLAY = "isThreadedDisplay";
|
||||||
|
|
||||||
private static final String STATE_SELECTED_MESSAGES = "selectedMessages";
|
private static final String STATE_SELECTED_MESSAGES = "selectedMessages";
|
||||||
|
private static final String STATE_ACTIVE_MESSAGE = "activeMessage";
|
||||||
private static final String STATE_REMOTE_SEARCH_PERFORMED = "remoteSearchPerformed";
|
private static final String STATE_REMOTE_SEARCH_PERFORMED = "remoteSearchPerformed";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -413,6 +414,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
|
|
||||||
private Preferences mPreferences;
|
private Preferences mPreferences;
|
||||||
|
|
||||||
|
private MessageReference mActiveMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@ -751,6 +754,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
saveSelectedMessages(outState);
|
saveSelectedMessages(outState);
|
||||||
|
|
||||||
outState.putBoolean(STATE_REMOTE_SEARCH_PERFORMED, mRemoteSearchPerformed);
|
outState.putBoolean(STATE_REMOTE_SEARCH_PERFORMED, mRemoteSearchPerformed);
|
||||||
|
outState.putParcelable(STATE_ACTIVE_MESSAGE, mActiveMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -766,6 +770,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
restoreSelectedMessages(savedInstanceState);
|
restoreSelectedMessages(savedInstanceState);
|
||||||
|
|
||||||
mRemoteSearchPerformed = savedInstanceState.getBoolean(STATE_REMOTE_SEARCH_PERFORMED);
|
mRemoteSearchPerformed = savedInstanceState.getBoolean(STATE_REMOTE_SEARCH_PERFORMED);
|
||||||
|
mActiveMessage = savedInstanceState.getParcelable(STATE_ACTIVE_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1751,6 +1756,21 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
view.setBackgroundColor(outValue.data);
|
view.setBackgroundColor(outValue.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mActiveMessage != null) {
|
||||||
|
String uid = cursor.getString(UID_COLUMN);
|
||||||
|
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
|
||||||
|
|
||||||
|
if (account.getUuid().equals(mActiveMessage.accountUuid) &&
|
||||||
|
folderName.equals(mActiveMessage.folderName) &&
|
||||||
|
uid.equals(mActiveMessage.uid)) {
|
||||||
|
int res = R.attr.messageListActiveItemBackgroundColor;
|
||||||
|
|
||||||
|
TypedValue outValue = new TypedValue();
|
||||||
|
getActivity().getTheme().resolveAttribute(res, outValue, true);
|
||||||
|
view.setBackgroundColor(outValue.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Thread count
|
// Thread count
|
||||||
if (threadCount > 1) {
|
if (threadCount > 1) {
|
||||||
holder.threadCount.setText(Integer.toString(threadCount));
|
holder.threadCount.setText(Integer.toString(threadCount));
|
||||||
@ -3135,4 +3155,22 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
private void remoteSearchFinished() {
|
private void remoteSearchFinished() {
|
||||||
mRemoteSearchFuture = null;
|
mRemoteSearchFuture = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark a message as 'active'.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The active message is the one currently displayed in the message view portion of the split
|
||||||
|
* view.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param messageReference
|
||||||
|
* {@code null} to not mark any message as being 'active'.
|
||||||
|
*/
|
||||||
|
public void setActiveMessage(MessageReference messageReference) {
|
||||||
|
mActiveMessage = messageReference;
|
||||||
|
if (mAdapter != null) {
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user