Exemplo n.º 1
0
        @Override
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case IMPORT_STEP_READ_FILE:
            case IMPORT_STEP_READ_WPT_FILE:
            case IMPORT_STEP_STORE_CACHES:
              parseDialog.setMessage(res.getString(msg.arg1));
              parseDialog.setMax(msg.arg2);
              parseDialog.setProgress(0);
              break;

            case IMPORT_STEP_FINISHED:
              parseDialog.dismiss();
              fromActivity.helpDialog(
                  res.getString(R.string.gpx_import_title_caches_imported),
                  msg.arg1 + " " + res.getString(R.string.gpx_import_caches_imported));
              closeActivity();
              break;

            case IMPORT_STEP_FINISHED_WITH_ERROR:
              parseDialog.dismiss();
              fromActivity.helpDialog(
                  res.getString(R.string.gpx_import_title_caches_import_failed),
                  res.getString(msg.arg1) + "\n\n" + msg.obj);
              closeActivity();
              break;
          }
        }
Exemplo n.º 2
0
        @Override
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case IMPORT_STEP_READ_FILE:
              Message cancelMessage = importStepHandler.obtainMessage(IMPORT_STEP_CANCEL);
              progress.show(
                  (Context) fromActivity,
                  res.getString(R.string.gpx_import_title_reading_file),
                  res.getString(msg.arg1),
                  ProgressDialog.STYLE_HORIZONTAL,
                  cancelMessage);
              progress.setMaxProgressAndReset(msg.arg2);
              break;

            case IMPORT_STEP_READ_WPT_FILE:
            case IMPORT_STEP_STORE_CACHES:
              progress.setMessage(res.getString(msg.arg1));
              progress.setMaxProgressAndReset(msg.arg2);
              break;

            case IMPORT_STEP_FINISHED:
              progress.dismiss();
              fromActivity.helpDialog(
                  res.getString(R.string.gpx_import_title_caches_imported),
                  msg.arg1 + " " + res.getString(R.string.gpx_import_caches_imported));
              closeActivity();
              break;

            case IMPORT_STEP_FINISHED_WITH_ERROR:
              progress.dismiss();
              fromActivity.helpDialog(
                  res.getString(R.string.gpx_import_title_caches_import_failed),
                  res.getString(msg.arg1) + "\n\n" + msg.obj);
              closeActivity();
              break;

            case IMPORT_STEP_CANCEL:
              progress.dismiss();
              progressHandler.cancel();
              break;

            case IMPORT_STEP_CANCELED:
              fromActivity.showShortToast(res.getString(R.string.gpx_import_canceled));
              closeActivity();
              break;
          }
        }