|
1 | 1 | package com.bpmct.trmnl_nook_simple_touch; |
2 | 2 |
|
3 | 3 | import android.app.Activity; |
| 4 | +import android.app.AlertDialog; |
| 5 | +import android.content.DialogInterface; |
4 | 6 | import android.content.Context; |
5 | 7 | import android.content.Intent; |
6 | 8 | import android.graphics.Bitmap; |
@@ -371,7 +373,7 @@ private boolean anyCacheExists() { |
371 | 373 | private static final long WIFI_WARMUP_MS = 15 * 1000; |
372 | 374 | private final android.os.Handler handler = new android.os.Handler(); |
373 | 375 |
|
374 | | - private static final long CELL_FETCH_STAGGER_MS = 1500; |
| 376 | + private static final long CELL_FETCH_STAGGER_MS = 8000; |
375 | 377 |
|
376 | 378 | private void startFetchAll() { |
377 | 379 | if (isConnected()) { |
@@ -469,13 +471,22 @@ private void showNoWifiScreen() { |
469 | 471 | wifiBtn.setOnTouchListener(new View.OnTouchListener() { |
470 | 472 | public boolean onTouch(View v, android.view.MotionEvent event) { |
471 | 473 | if (event.getAction() == android.view.MotionEvent.ACTION_UP) { |
472 | | - try { |
473 | | - Intent wi = new Intent(); |
474 | | - wi.setClassName("com.android.settings", "com.android.settings.wifi.Settings_Wifi_Settings"); |
475 | | - try { startActivity(wi); } catch (Throwable t2) { |
476 | | - startActivity(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS)); |
477 | | - } |
478 | | - } catch (Throwable t) {} |
| 474 | + new AlertDialog.Builder(ShowcaseActivity.this) |
| 475 | + .setTitle("Opening Wi-Fi Settings") |
| 476 | + .setMessage("After connecting, press the Home button on the bottom of this device to return to this app.") |
| 477 | + .setPositiveButton("Open Wi-Fi Settings", new DialogInterface.OnClickListener() { |
| 478 | + public void onClick(DialogInterface dialog, int which) { |
| 479 | + try { |
| 480 | + Intent wi = new Intent(); |
| 481 | + wi.setClassName("com.android.settings", "com.android.settings.wifi.Settings_Wifi_Settings"); |
| 482 | + try { startActivity(wi); } catch (Throwable t2) { |
| 483 | + startActivity(new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS)); |
| 484 | + } |
| 485 | + } catch (Throwable t) {} |
| 486 | + } |
| 487 | + }) |
| 488 | + .setNegativeButton("Cancel", null) |
| 489 | + .show(); |
479 | 490 | } |
480 | 491 | return true; |
481 | 492 | } |
@@ -510,7 +521,14 @@ public void onReceive(android.content.Context context, Intent intent) { |
510 | 521 | handler.post(new Runnable() { |
511 | 522 | public void run() { |
512 | 523 | hideNoWifiScreen(); |
513 | | - for (int i = 0; i < NUM_CELLS; i++) fetchCell(i); |
| 524 | + for (int i = 0; i < NUM_CELLS; i++) { |
| 525 | + final int cellIdx = i; |
| 526 | + handler.postDelayed(new Runnable() { |
| 527 | + public void run() { |
| 528 | + if (isCellConfigured(ShowcaseActivity.this, cellIdx)) fetchCell(cellIdx); |
| 529 | + } |
| 530 | + }, cellIdx * CELL_FETCH_STAGGER_MS); |
| 531 | + } |
514 | 532 | } |
515 | 533 | }); |
516 | 534 | } |
|
0 commit comments