mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Merging to head
This commit is contained in:
@@ -225,7 +225,6 @@ limitations under the License.
|
||||
<string name="settings_backup_to_sd_summary">Escriu una còpia completa de totes les rutes i els paràmetres a la targeta SD</string>
|
||||
<string name="settings_restore_from_sd">Restaura ara</string>
|
||||
<string name="settings_restore_from_sd_summary">Restaura totes les rutes i els paràmetres des de la targeta SD.</string>
|
||||
<string name="settings_no_backup_while_recording">No es poden gestionar les còpies de seguretat mentre s\'enregistra una ruta.</string>
|
||||
|
||||
<!-- Backups -->
|
||||
<string name="restore_overwrites_warning">La restauració d\'una còpia de seguretat des de la targeta SD sobreescriurà totes les rutes i paràmetres. Esteu segur?</string>
|
||||
|
||||
@@ -212,7 +212,6 @@ limitations under the License.
|
||||
<string name="settings_backup_to_sd_summary">Hacer una copia total de sus recorridos y configuraciones a la tarjeta SD</string>
|
||||
<string name="settings_restore_from_sd">Restaurar</string>
|
||||
<string name="settings_restore_from_sd_summary">Restaurar todos los recorridos y configuraciones desde la tarjeta SD</string>
|
||||
<string name="settings_no_backup_while_recording">No se pueden manejar backups mientras se está registrando un recorrido.</string>
|
||||
|
||||
<string name="restore_overwrites_warning">Restaurar un backup desde la tarjeta SD SOBREESCRIBIRÁ todos sus recorridos y configuraciones actuales. ¿Está usted seguro?</string>
|
||||
<string name="select_backup_to_restore">Seleccionar el backup para restaurar</string>
|
||||
|
||||
@@ -213,8 +213,6 @@ limitations under the License.
|
||||
<string name="settings_backup_to_sd_summary">Copier tous vos parcours et paramètres sur la carte SD</string>
|
||||
<string name="settings_restore_from_sd">Restaurer</string>
|
||||
<string name="settings_restore_from_sd_summary">Restaurer tous les parcours et paramètres depuis la carte SD</string>
|
||||
<string name="settings_no_backup_while_recording">Sauvegarde impossible lors de l\'enregistrement d\'un parcours.</string>
|
||||
|
||||
|
||||
<string name="restore_overwrites_warning">Restaurer une sauvegarde depuis la carte SD écrasera tous vos parcours et paramètres actuels.</string>
|
||||
<string name="select_backup_to_restore">Choisissez la sauvegarde à restaurer</string>
|
||||
|
||||
@@ -256,7 +256,6 @@ limitations under the License.
|
||||
<string name="settings_backup_to_sd_summary">SDカードに全てのトラックと設定をバックアップします</string>
|
||||
<string name="settings_restore_from_sd">今すぐ復元</string>
|
||||
<string name="settings_restore_from_sd_summary">SDカードから全てのトラックと設定を復元します</string>
|
||||
<string name="settings_no_backup_while_recording">トラック記録中はバックアップ操作はできません.</string>
|
||||
|
||||
<string name="restore_overwrites_warning">SDカードからの復元を実行すると、現在のトラックと設定は *全て上書き* されてしまいます.よろしいですか?</string>
|
||||
<string name="select_backup_to_restore">復元するバックアップの選択</string>
|
||||
|
||||
@@ -217,7 +217,6 @@ limitations under the License.
|
||||
<string name="settings_backup_to_sd_summary">Tworzy kopię zapasową wszystkich tras i ustawień i zapisuje je na karcie SD</string>
|
||||
<string name="settings_restore_from_sd">Odtwórz z kopii</string>
|
||||
<string name="settings_restore_from_sd_summary">Odtwarza wszystkie trasy i ustawienia z kopii zapasowej z karty SD</string>
|
||||
<string name="settings_no_backup_while_recording">Nie można tworzyć/odtwarzać kopii zapasowej podczas rejestrowania trasy.</string>
|
||||
|
||||
<!-- Backups -->
|
||||
<string name="restore_overwrites_warning">Odtworzenie z kopii zapasowej z karty SD zastąpi wszystkie bieżące trasy i ustawienia. Jesteś tego pewien?</string>
|
||||
|
||||
@@ -157,6 +157,8 @@ limitations under the License.
|
||||
<string name="settings_display">Exibição</string>
|
||||
<string name="settings_recording">Gravação</string>
|
||||
<string name="settings_sharing">Compartilhamento</string>
|
||||
<string name="settings_not_available_summary">Não disponível na sua versão do Android</string>
|
||||
<string name="settings_not_while_recording">Não disponível durante a gravação de uma trilha</string>
|
||||
<string name="settings_announcement_frequency">Tempo entre anúncios</string>
|
||||
<string name="settings_announcement_frequency_summary">Tempo mínimo entre dois anúncios de voz</string>
|
||||
<string name="settings_min_recording_distance">Dist. mín. entre pontos</string>
|
||||
|
||||
@@ -219,7 +219,6 @@ limitations under the License.
|
||||
<string name="settings_backup_to_sd_summary">将你所有轨迹和设置的完整备份写入到 SD 存储卡</string>
|
||||
<string name="settings_restore_from_sd">立即恢复</string>
|
||||
<string name="settings_restore_from_sd_summary">从 SD 存储卡恢复所有轨迹和设置</string>
|
||||
<string name="settings_no_backup_while_recording">在记录轨迹时无法处理备份数据.</string>
|
||||
|
||||
<!-- Backups -->
|
||||
<string name="restore_overwrites_warning">从 SD 存储卡恢复备份数据将覆盖掉你当前的所有轨迹和设置. 确定要继续吗?</string>
|
||||
|
||||
@@ -50,8 +50,7 @@ limitations under the License.
|
||||
<!-- Keys for non-persisted preferences - DO NOT TRANSLATE -->
|
||||
<string name="backup_to_sd_key">backupToSd</string>
|
||||
<string name="restore_from_sd_key">restoreFromSd</string>
|
||||
|
||||
<!-- Inoperative keys used for the location of preferences items -->
|
||||
<string name="reset_key">resetToDefaults</string>
|
||||
<string name="sensor_options_key">sensorOptions</string>
|
||||
<string name="ant_options_key">antOptions</string>
|
||||
</resources>
|
||||
|
||||
@@ -196,6 +196,7 @@ limitations under the License.
|
||||
<string name="settings_sharing">Sharing</string>
|
||||
|
||||
<string name="settings_not_available_summary">Not available in your version of Android</string>
|
||||
<string name="settings_not_while_recording">Not available while recording a track</string>
|
||||
|
||||
<string name="settings_announcement_frequency">Announcement frequency</string>
|
||||
<string name="settings_announcement_frequency_summary">Minimum time between two voice announcements</string>
|
||||
@@ -238,6 +239,11 @@ limitations under the License.
|
||||
<string name="settings_timestamp_track_name_summary_on">The default track name will be the date and time at the start of the track</string>
|
||||
<string name="settings_timestamp_track_name_summary_off">Track names will have numbers which increment for each new track.</string>
|
||||
|
||||
<string name="settings_reset">Reset to defaults</string>
|
||||
<string name="settings_reset_summary">Revert all your settings to the default values</string>
|
||||
<string name="settings_reset_dialog_message">All your settings will be erased and reverted to the default values. Saved tracks will be preserved. Are you sure?</string>
|
||||
<string name="settings_reset_done">All settings have been reverted to their defaults.</string>
|
||||
|
||||
<string name="pace_label">Pace</string>
|
||||
|
||||
<string name="eclair_required">Only supported in Android 2.0 or above</string>
|
||||
@@ -259,7 +265,6 @@ limitations under the License.
|
||||
<string name="settings_backup_to_sd_summary">Write a full copy of all your tracks and settings to the SD card</string>
|
||||
<string name="settings_restore_from_sd">Restore now</string>
|
||||
<string name="settings_restore_from_sd_summary">Restore all tracks and settings from the SD card</string>
|
||||
<string name="settings_no_backup_while_recording">Cannot manipulate backups while recording a track.</string>
|
||||
|
||||
<string name="restore_overwrites_warning">Restoring a backup from the SD card will OVERWRITE all your current tracks and settings. Are you sure?</string>
|
||||
<string name="select_backup_to_restore">Select the backup to restore</string>
|
||||
|
||||
@@ -173,4 +173,11 @@ limitations under the License.
|
||||
android:persistent="false" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
<!-- Reset to defaults -->
|
||||
<Preference
|
||||
android:title="@string/settings_reset"
|
||||
android:key="@string/reset_key"
|
||||
android:summary="@string/settings_reset_summary"
|
||||
android:persistent="false" />
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import static com.google.android.apps.mytracks.MyTracksConstants.TAG;
|
||||
|
||||
import com.google.android.apps.mytracks.io.backup.BackupActivityHelper;
|
||||
import com.google.android.apps.mytracks.io.backup.BackupPreferencesListener;
|
||||
@@ -28,18 +25,28 @@ import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
import com.google.android.apps.mytracks.util.BluetoothDeviceUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An activity that let's the user see and edit the settings.
|
||||
@@ -119,6 +126,16 @@ public class MyTracksSettings extends PreferenceActivity {
|
||||
announcementFrequency.setSummary(
|
||||
R.string.settings_not_available_summary);
|
||||
}
|
||||
|
||||
// Hook up action for resetting all settings
|
||||
Preference resetPreference = findPreference(getString(R.string.reset_key));
|
||||
resetPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference arg0) {
|
||||
onResetPreferencesClick();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void customizeSensorOptionsPreferences() {
|
||||
@@ -177,19 +194,24 @@ public class MyTracksSettings extends PreferenceActivity {
|
||||
findPreference(getString(R.string.backup_to_sd_key));
|
||||
Preference restoreNowPreference =
|
||||
findPreference(getString(R.string.restore_from_sd_key));
|
||||
Preference resetPreference = findPreference(getString(R.string.reset_key));
|
||||
|
||||
// If recording, disable backup/restore
|
||||
// If recording, disable backup/restore/reset
|
||||
// (we don't want to get to inconsistent states)
|
||||
boolean recording =
|
||||
preferences.getLong(getString(R.string.recording_track_key), -1) != -1;
|
||||
backupNowPreference.setEnabled(!recording);
|
||||
restoreNowPreference.setEnabled(!recording);
|
||||
resetPreference.setEnabled(!recording);
|
||||
backupNowPreference.setSummary(
|
||||
recording ? R.string.settings_no_backup_while_recording
|
||||
recording ? R.string.settings_not_while_recording
|
||||
: R.string.settings_backup_to_sd_summary);
|
||||
restoreNowPreference.setSummary(
|
||||
recording ? R.string.settings_no_backup_while_recording
|
||||
recording ? R.string.settings_not_while_recording
|
||||
: R.string.settings_restore_from_sd_summary);
|
||||
resetPreference.setSummary(
|
||||
recording ? R.string.settings_not_while_recording
|
||||
: R.string.settings_reset_summary);
|
||||
|
||||
// Add actions to the backup preferences
|
||||
backupNowPreference.setOnPreferenceClickListener(
|
||||
@@ -315,4 +337,53 @@ public class MyTracksSettings extends PreferenceActivity {
|
||||
devicesPreference.setEntryValues(entryValuesArray);
|
||||
devicesPreference.setEntries(entriesArray);
|
||||
}
|
||||
|
||||
/** Callback for when user asks to reset all settings. */
|
||||
private void onResetPreferencesClick() {
|
||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||
.setCancelable(true)
|
||||
.setTitle(R.string.settings_reset)
|
||||
.setMessage(R.string.settings_reset_dialog_message)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int button) {
|
||||
onResetPreferencesConfirmed();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/** Callback for when user confirms resetting all settings. */
|
||||
private void onResetPreferencesConfirmed() {
|
||||
// Change preferences in a separate thread.
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i(TAG, "Resetting all settings");
|
||||
|
||||
// Actually wipe preferences (and save synchronously).
|
||||
preferences.edit().clear().commit();
|
||||
|
||||
// Give UI feedback in the UI thread.
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Give feedback to the user.
|
||||
Toast.makeText(
|
||||
MyTracksSettings.this,
|
||||
R.string.settings_reset_done,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
// Restart the settings activity so all changes are loaded.
|
||||
Intent intent = getIntent();
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,12 +193,14 @@ public class MyTracksProvider extends ContentProvider {
|
||||
@Override
|
||||
public int delete(Uri url, String where, String[] selectionArgs) {
|
||||
String table;
|
||||
boolean shouldVacuum = false;
|
||||
switch (urlMatcher.match(url)) {
|
||||
case TRACKPOINTS:
|
||||
table = TRACKPOINTS_TABLE;
|
||||
break;
|
||||
case TRACKS:
|
||||
table = TRACKS_TABLE;
|
||||
shouldVacuum = true;
|
||||
break;
|
||||
case WAYPOINTS:
|
||||
table = WAYPOINTS_TABLE;
|
||||
@@ -210,6 +212,13 @@ public class MyTracksProvider extends ContentProvider {
|
||||
Log.w(MyTracksProvider.TAG, "provider delete in " + table + "!");
|
||||
int count = db.delete(table, where, selectionArgs);
|
||||
getContext().getContentResolver().notifyChange(url, null, true);
|
||||
|
||||
if (shouldVacuum) {
|
||||
// If a potentially large amount of data was deleted, we want to reclaim its space.
|
||||
Log.i(TAG, "Vacuuming the database");
|
||||
db.execSQL("VACUUM");
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user