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
{