@Override public boolean onPreferenceClick(Preference preference) { if (preference.getKey().equals(OsmandSettings.LOCAL_INDEXES)) { startActivity(new Intent(this, LocalIndexesActivity.class)); return true; } else if (preference == saveCurrentTrack) { SavingTrackHelper helper = new SavingTrackHelper(this); if (helper.hasDataToSave()) { progressDlg = ProgressDialog.show( this, getString(R.string.saving_gpx_tracks), getString(R.string.saving_gpx_tracks), true); final ProgressDialogImplementation impl = new ProgressDialogImplementation(progressDlg); impl.setRunnable( "SavingGPX", new Runnable() { //$NON-NLS-1$ @Override public void run() { try { SavingTrackHelper helper = new SavingTrackHelper(SettingsActivity.this); helper.saveDataToGpx(); helper.close(); } finally { if (progressDlg != null) { progressDlg.dismiss(); progressDlg = null; } } } }); impl.run(); } else { helper.close(); } return true; } return false; }
public void reloadIndexes() { reloadVoiceListPreference(getPreferenceScreen()); progressDlg = ProgressDialog.show( this, getString(R.string.loading_data), getString(R.string.reading_indexes), true); final ProgressDialogImplementation impl = new ProgressDialogImplementation(progressDlg); impl.setRunnable( "Initializing app", new Runnable() { //$NON-NLS-1$ @Override public void run() { try { showWarnings(getMyApplication().getResourceManager().reloadIndexes(impl)); } finally { if (progressDlg != null) { progressDlg.dismiss(); progressDlg = null; } } } }); impl.run(); }