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