1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-10-31 15:45:08 -04:00

Immediately update the title bar when the syncing status changes due to external events.

This commit is contained in:
Dan Applebaum 2011-02-04 23:18:08 +00:00 committed by Jesse Vincent
parent 19d863ee41
commit 4842051de6
7 changed files with 41 additions and 2 deletions

View File

@ -305,7 +305,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
mHandler.refreshTitle();
}
@Override
public void systemStatusChanged()
{
mHandler.refreshTitle();
}
};
private static String ACCOUNT_STATS = "accountStats";

View File

@ -1272,6 +1272,12 @@ public class FolderList extends K9ListActivity
mHandler.refreshTitle();
}
@Override
public void systemStatusChanged()
{
mHandler.refreshTitle();
}
};

View File

@ -2317,6 +2317,12 @@ public class MessageList
holder.message.setUid(newUid);
}
}
@Override
public void systemStatusChanged()
{
mHandler.refreshTitle();
}
};
private boolean updateForMe(Account account, String folder)

View File

@ -5239,6 +5239,15 @@ public class MessagingController implements Runnable
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "MessagingController.messagesArrivedLatch released");
}
public void systemStatusChanged()
{
for (MessagingListener l : getListeners())
{
l.systemStatusChanged();
}
}
enum MemorizingState { STARTED, FINISHED, FAILED }
static class Memory

View File

@ -180,6 +180,10 @@ public class MessagingListener
{
}
public void systemStatusChanged()
{
}
public void messageUidChanged(Account account, String folder, String oldUid, String newUid)
{

View File

@ -13,6 +13,7 @@ import android.os.IBinder;
import android.os.PowerManager;
import android.util.Log;
import com.fsck.k9.K9;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.helper.power.TracingPowerManager;
import com.fsck.k9.helper.power.TracingPowerManager.TracingWakeLock;
@ -114,10 +115,14 @@ public abstract class CoreService extends Service
{
try
{
boolean oldIsSyncDisabled = MailService.isSyncDisabled();
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "CoreService (" + className + ") running Runnable " + runner.hashCode() + " with startId " + startId);
runner.run();
if (MailService.isSyncDisabled() != oldIsSyncDisabled)
{
MessagingController.getInstance(getApplication()).systemStatusChanged();
}
}
finally
{

View File

@ -111,6 +111,7 @@ public class MailService extends CoreService
long startTime = System.currentTimeMillis();
try
{
boolean oldIsSyncDisabled = isSyncDisabled();
ConnectivityManager connectivityManager = (ConnectivityManager)getApplication().getSystemService(Context.CONNECTIVITY_SERVICE);
boolean doBackground = true;
boolean hasConnectivity = false;
@ -222,6 +223,10 @@ public class MailService extends CoreService
else if (CANCEL_CONNECTIVITY_NOTICE.equals(intent.getAction()))
{
}
if (isSyncDisabled() != oldIsSyncDisabled)
{
MessagingController.getInstance(getApplication()).systemStatusChanged();
}
}
finally
{