altosdroid: Rate limit map loading pacifier
authorKeith Packard <keithp@keithp.com>
Wed, 11 May 2016 06:03:45 +0000 (23:03 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 12 May 2016 06:22:15 +0000 (23:22 -0700)
Just like in altosui.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/PreloadMapActivity.java

index ab5e433..11d7128 100644 (file)
@@ -75,6 +75,8 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe
 
        /* AltosMapLoaderListener interfaces */
        public void loader_start(final int max) {
+               loader_notify_time = System.currentTimeMillis();
+
                this.runOnUiThread(new Runnable() {
                                public void run() {
                                        progress.setMax(max);
@@ -84,6 +86,13 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe
        }
 
        public void loader_notify(final int cur, final int max, final String name) {
+               long    now = System.currentTimeMillis();
+
+               if (now - loader_notify_time < 100)
+                       return;
+
+               loader_notify_time = now;
+
                this.runOnUiThread(new Runnable() {
                                public void run() {
                                        progress.setProgress(cur);