mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Changed method to update the unread widget
This commit is contained in:
parent
98461e5a21
commit
7a252bf002
@ -31,6 +31,7 @@ import com.fsck.k9.mail.Address;
|
||||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mail.internet.BinaryTempFileBody;
|
||||
import com.fsck.k9.provider.UnreadWidgetProvider;
|
||||
import com.fsck.k9.service.BootReceiver;
|
||||
import com.fsck.k9.service.MailService;
|
||||
import com.fsck.k9.service.ShutdownReceiver;
|
||||
@ -504,19 +505,38 @@ public class K9 extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUnreadWidget() {
|
||||
try {
|
||||
UnreadWidgetProvider.updateUnreadCount(K9.this);
|
||||
} catch (Exception e) {
|
||||
if (K9.DEBUG) {
|
||||
Log.e(LOG_TAG, "Error while updating unread widget(s)", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) {
|
||||
broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message);
|
||||
updateUnreadWidget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageDeleted(Account account, String folder, Message message) {
|
||||
broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message);
|
||||
updateUnreadWidget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
|
||||
broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_RECEIVED, account, folder, message);
|
||||
updateUnreadWidget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void folderStatusChanged(Account account, String folderName,
|
||||
int unreadMessageCount) {
|
||||
updateUnreadWidget();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,7 +60,6 @@ import com.fsck.k9.mail.store.LockableDatabase.DbCallback;
|
||||
import com.fsck.k9.mail.store.LockableDatabase.WrappedException;
|
||||
import com.fsck.k9.mail.store.StorageManager.StorageProvider;
|
||||
import com.fsck.k9.provider.AttachmentProvider;
|
||||
import com.fsck.k9.provider.UnreadWidgetProvider;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -500,9 +499,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
public Void doDbWork(final SQLiteDatabase db) {
|
||||
db.execSQL("DELETE FROM messages WHERE deleted = 0 and uid not like 'Local%'");
|
||||
db.execSQL("update folders set flagged_count = 0, unread_count = 0");
|
||||
|
||||
// FIXME: hack to update unread count widget
|
||||
UnreadWidgetProvider.updateUnreadCount(K9.app);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@ -1315,9 +1311,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
public void setUnreadMessageCount(final int unreadMessageCount) throws MessagingException {
|
||||
mUnreadMessageCount = Math.max(0, unreadMessageCount);
|
||||
updateFolderColumn("unread_count", mUnreadMessageCount);
|
||||
|
||||
// FIXME: hack to update unread count widget
|
||||
UnreadWidgetProvider.updateUnreadCount(K9.app);
|
||||
}
|
||||
|
||||
public void setFlaggedMessageCount(final int flaggedMessageCount) throws MessagingException {
|
||||
|
Loading…
Reference in New Issue
Block a user