mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-13 06:38:05 -05:00
Implemented the (Un)start and (Un)read toggles.
This commit is contained in:
parent
6bea2dddac
commit
24d7416e61
@ -6,8 +6,8 @@
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/mark_as_read"
|
||||
android:title="@string/mark_as_read_action"
|
||||
android:id="@+id/read_toggle"
|
||||
android:title="@string/read_toggle_action"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
@ -16,8 +16,8 @@
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/flag"
|
||||
android:title="@string/flag_action"
|
||||
android:id="@+id/flag_toggle"
|
||||
android:title="@string/flag_toggle_action"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item
|
||||
|
@ -144,6 +144,7 @@ http://k9mail.googlecode.com/
|
||||
|
||||
<string name="accounts_action">Accounts</string>
|
||||
<string name="mark_as_read_action">Mark as read</string>
|
||||
<string name="read_toggle_action">(un)read</string>
|
||||
<string name="send_alternate_action">Share</string>
|
||||
<string name="send_alternate_chooser_title">Choose sender</string>
|
||||
|
||||
@ -152,6 +153,7 @@ http://k9mail.googlecode.com/
|
||||
messages in the folder that are not displayed in K-9)</string>
|
||||
|
||||
<string name="flag_action">Add star</string>
|
||||
<string name="flag_toggle_action">(Un)star</string>
|
||||
<string name="unflag_action">Remove star</string>
|
||||
<string name="copy_action">Copy</string>
|
||||
<string name="show_full_header_action">Show full header</string>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.fsck.k9.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumMap;
|
||||
@ -1395,24 +1396,46 @@ public class MessageList extends K9ListActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
private void onToggleRead(MessageInfoHolder holder) {
|
||||
LocalMessage message = holder.message;
|
||||
Folder folder = message.getFolder();
|
||||
Account account = folder.getAccount();
|
||||
String folderName = folder.getName();
|
||||
mController.setFlag(account, folderName, new Message[] { message }, Flag.SEEN, !holder.read);
|
||||
holder.read = !holder.read;
|
||||
mAdapter.sortMessages();
|
||||
private void onToggleRead(final List<MessageInfoHolder> holders) {
|
||||
LocalMessage message;
|
||||
Folder folder;
|
||||
Account account;
|
||||
String folderName;
|
||||
|
||||
int i = 0;
|
||||
for (final Iterator<MessageInfoHolder> iterator = holders.iterator(); iterator.hasNext(); i++) {
|
||||
final MessageInfoHolder h = iterator.next();
|
||||
message = h.message;
|
||||
folder = message.getFolder();
|
||||
account = folder.getAccount();
|
||||
folderName = message.getFolder().getName();
|
||||
|
||||
mController.setFlag(account, folderName, new Message[]{message}, Flag.SEEN, !h.read);
|
||||
|
||||
h.read = !h.read;
|
||||
mAdapter.sortMessages();
|
||||
}
|
||||
}
|
||||
|
||||
private void onToggleFlag(MessageInfoHolder holder) {
|
||||
LocalMessage message = holder.message;
|
||||
Folder folder = message.getFolder();
|
||||
Account account = folder.getAccount();
|
||||
String folderName = folder.getName();
|
||||
mController.setFlag(account, folderName, new Message[] { message }, Flag.FLAGGED, !holder.flagged);
|
||||
holder.flagged = !holder.flagged;
|
||||
mAdapter.sortMessages();
|
||||
private void onToggleFlag(final List<MessageInfoHolder> holders) {
|
||||
LocalMessage message;
|
||||
Folder folder;
|
||||
Account account;
|
||||
String folderName;
|
||||
|
||||
int i = 0;
|
||||
for (final Iterator<MessageInfoHolder> iterator = holders.iterator(); iterator.hasNext(); i++) {
|
||||
final MessageInfoHolder h = iterator.next();
|
||||
message = h.message;
|
||||
folder = message.getFolder();
|
||||
account = folder.getAccount();
|
||||
folderName = message.getFolder().getName();
|
||||
|
||||
mController.setFlag(account, folderName, new Message[]{message}, Flag.FLAGGED, !h.flagged);
|
||||
|
||||
h.flagged = !h.flagged;
|
||||
mAdapter.sortMessages();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkMail(Account account, String folderName) {
|
||||
@ -1960,7 +1983,7 @@ public class MessageList extends K9ListActivity implements
|
||||
public void onClick(View v) {
|
||||
// Perform action on clicks
|
||||
MessageInfoHolder message = (MessageInfoHolder) getItem((Integer)v.getTag());
|
||||
onToggleFlag(message);
|
||||
onToggleFlag(Arrays.asList(new MessageInfoHolder[]{message}));
|
||||
}
|
||||
};
|
||||
|
||||
@ -2695,14 +2718,14 @@ public class MessageList extends K9ListActivity implements
|
||||
mSelectedCount = 0;
|
||||
break;
|
||||
}
|
||||
/*case R.id.mark_as_read: {
|
||||
onToggleRead(holder);
|
||||
case R.id.read_toggle: {
|
||||
onToggleRead(selection);
|
||||
break;
|
||||
}
|
||||
case R.id.flag: {
|
||||
onToggleFlag(holder);
|
||||
case R.id.flag_toggle: {
|
||||
onToggleFlag(selection);
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
case R.id.archive: {
|
||||
onArchive(selection);
|
||||
mSelectedCount = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user