@Override protected void onPostExecute(Boolean result) { if (null != activity) { progress.dismiss(); if (result) { ActivityMixin.showToast( activity, getName() + ' ' + getString(R.string.export_exportedto) + ": " + exportFile.toString()); if (Settings.getShareAfterExport()) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(exportFile)); shareIntent.setType("application/xml"); activity.startActivity( Intent.createChooser(shareIntent, getString(R.string.export_gpx_to))); } } else { ActivityMixin.showToast(activity, getString(R.string.export_failed)); } } }
@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; } }