mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
simplify some of our flagging logic and remove duplication using ternary operators
This commit is contained in:
parent
6d38c1c71a
commit
994ed6653c
@ -4794,10 +4794,10 @@ public class LocalStore extends Store implements Serializable
|
|||||||
*/
|
*/
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
LocalFolder folder = (LocalFolder)mFolder;
|
||||||
if (flag == Flag.DELETED || flag == Flag.X_DESTROYED
|
if (flag == Flag.DELETED || flag == Flag.X_DESTROYED
|
||||||
|| (flag == Flag.SEEN && !isSet(Flag.DELETED)))
|
|| (flag == Flag.SEEN && !isSet(Flag.DELETED)))
|
||||||
{
|
{
|
||||||
LocalFolder folder = (LocalFolder)mFolder;
|
|
||||||
if (set && !isSet(Flag.SEEN))
|
if (set && !isSet(Flag.SEEN))
|
||||||
{
|
{
|
||||||
folder.setUnreadMessageCount(folder.getUnreadMessageCount() - 1);
|
folder.setUnreadMessageCount(folder.getUnreadMessageCount() - 1);
|
||||||
@ -4809,27 +4809,11 @@ public class LocalStore extends Store implements Serializable
|
|||||||
}
|
}
|
||||||
if ((flag == Flag.DELETED || flag == Flag.X_DESTROYED) && isSet(Flag.FLAGGED))
|
if ((flag == Flag.DELETED || flag == Flag.X_DESTROYED) && isSet(Flag.FLAGGED))
|
||||||
{
|
{
|
||||||
LocalFolder folder = (LocalFolder)mFolder;
|
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + (set ? -1 : 1));
|
||||||
if (set)
|
|
||||||
{
|
|
||||||
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (flag == Flag.FLAGGED && !isSet(Flag.DELETED))
|
if (flag == Flag.FLAGGED && !isSet(Flag.DELETED))
|
||||||
{
|
{
|
||||||
LocalFolder folder = (LocalFolder)mFolder;
|
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + (set ? 1 : -1));
|
||||||
if (set)
|
|
||||||
{
|
|
||||||
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
folder.setFlaggedMessageCount(folder.getFlaggedMessageCount() - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MessagingException me)
|
catch (MessagingException me)
|
||||||
|
Loading…
Reference in New Issue
Block a user