Prevent updating the UI while quitting is in progress

This commit is contained in:
Cameron Gutman 2015-03-23 15:57:29 -04:00
parent a676b8d8e6
commit 29a395f3f4

View File

@ -55,6 +55,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
private SpinnerDialog blockingLoadSpinner; private SpinnerDialog blockingLoadSpinner;
private String lastRawApplist; private String lastRawApplist;
private int lastRunningAppId; private int lastRunningAppId;
private boolean suspendGridUpdates;
private final static int START_OR_RESUME_ID = 1; private final static int START_OR_RESUME_ID = 1;
private final static int QUIT_ID = 2; private final static int QUIT_ID = 2;
@ -125,6 +126,11 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
managerBinder.startPolling(new ComputerManagerListener() { managerBinder.startPolling(new ComputerManagerListener() {
@Override @Override
public void notifyComputerUpdated(ComputerDetails details) { public void notifyComputerUpdated(ComputerDetails details) {
// Do nothing if updates are suspended
if (suspendGridUpdates) {
return;
}
// Don't care about other computers // Don't care about other computers
if (!details.uuid.toString().equalsIgnoreCase(uuidString)) { if (!details.uuid.toString().equalsIgnoreCase(uuidString)) {
return; return;
@ -497,6 +503,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
NvHTTP httpConn; NvHTTP httpConn;
String message; String message;
try { try {
suspendGridUpdates = true;
httpConn = new NvHTTP(getAddress(), httpConn = new NvHTTP(getAddress(),
managerBinder.getUniqueId(), null, PlatformBinding.getCryptoProvider(AppView.this)); managerBinder.getUniqueId(), null, PlatformBinding.getCryptoProvider(AppView.this));
if (httpConn.quitApp()) { if (httpConn.quitApp()) {
@ -521,6 +528,7 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
message = e.getMessage(); message = e.getMessage();
} finally { } finally {
// Trigger a poll immediately // Trigger a poll immediately
suspendGridUpdates = false;
if (poller != null) { if (poller != null) {
poller.pollNow(); poller.pollNow();
} }